This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
if tf.test.gpu_device_name(): | |
print(f"Default GPU Device: {tf.test.gpu_device_name()}") | |
else: | |
print("Please install GPU version of TF") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get file (>100MB) from Google Drive | |
# ./wgetgdrive.sh $1 $2 | |
ID=$1 | |
FILE_NAME=$2 | |
URL="https://docs.google.com/uc?export=download&id=$ID" | |
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate $URL -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=$ID" -O $FILE_NAME && rm -rf /tmp/cookies.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import sys | |
print('__Python VERSION:', sys.version) | |
print('__pyTorch VERSION:', torch.__version__) | |
print("Whether CUDA is available:", torch.cuda.is_available()) | |
print('__CUDA VERSION', ) | |
from subprocess import call | |
print('__CUDNN VERSION:', torch.backends.cudnn.version()) | |
print('__Number CUDA Devices:', torch.cuda.device_count()) | |
print('__Devices') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from pathlib import Path | |
from PIL import Image | |
# usage: python3 photo_resizer.py img.png | |
img_file = sys.argv[1] | |
path = Path(img_file) | |
assert path.parent == Path(), "The image must in the same directory with photo_resizer.py" |