#测试tfGPU是否能够使用: import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' print('GPU', tf.test.is_gpu_available()) a = tf.constant(2.0) b = tf.constant(4.0) print(a + b)
from IPython.utils import io from google.colab import drive import psutil import humanize import os with io.capture_output() as captured: install_dependencies() print("Dependencies installed.")
import GPUtil as GPU printm()
1 2 3 4 5 6 7
#@title Set Time Zone !rm /etc/localtime !ln -s /usr/share/zoneinfo/HST /etc/localtime !date
#above is for HST, you can find yours in #/usr/share/zoneinfo
1
! rm -rf ./drive
1 2 3 4
#@title Mount Google Drive
from google.colab import drive drive.mount('/content/drive', force_remount=True)
1 2 3 4
#@title Cleanup folders if needed
!rm -r face_a !rm -r face_b
1 2 3 4 5 6 7 8 9
#@title Download training data !cp "/content/drive/My Drive/colab_files/faceswap/faces/face_a.zip" . !cp "/content/drive/My Drive/colab_files/faceswap/faces/face_b.zip" .
#@title Install Tensorflow !pip install -r faceswap/requirements_nvidia.txt #@ 这里会报错“ERROR: albumentations 0.1.12 has requirement imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible.” 但没关系
#@title 查看结果: Setting Faceswap backend to NVIDIA 09/26/2020 16:14:02 INFO Log level set to: INFO Using TensorFlow backend. 09/26/2020 16:14:04 INFO Model A Directory: /content/face_a/faceA 09/26/2020 16:14:04 INFO Model B Directory: /content/face_b/faceB 09/26/2020 16:14:04 INFO Training data directory: /content/drive/My Drive/colab_files/faceswap/models/model 09/26/2020 16:14:04 INFO =================================================== 09/26/2020 16:14:04 INFO Starting 09/26/2020 16:14:04 INFO Press 'ENTER' to save and quit 09/26/2020 16:14:04 INFO Press 'S' to save model weights immediately 09/26/2020 16:14:04 INFO =================================================== 09/26/2020 16:14:05 INFO Loading data, this may take a while... 09/26/2020 16:14:05 INFO Loading Model from Dlight plugin... 09/26/2020 16:14:05 INFO Using configuration saved in state file 09/26/2020 16:14:10 INFO Loaded model from disk: '/content/drive/My Drive/colab_files/faceswap/models/model' 09/26/2020 16:14:10 INFO Loading Trainer from Original plugin... 09/26/2020 16:14:12 INFO Enabled TensorBoard Logging [16:14:27] [#04386] Loss A: 0.05719, Loss B: 0.05088 09/26/2020 16:14:32 INFO [Saved models] - Average since last save: face_loss_A: 0.05719, face_loss_B: 0.05088 [16:19:42] [#04746] Loss A: 0.04279, Loss B: 0.03795 09/26/2020 16:19:46 INFO [Saved models] - Average since last save: face_loss_A: 0.04535, face_loss_B: 0.04580 [16:25:01] [#05106] Loss A: 0.04427, Loss B: 0.04492 09/26/2020 16:25:06 INFO [Saved models] - Average since last save: face_loss_A: 0.04406, face_loss_B: 0.04483 [16:25:19] [#05120] Loss A: 0.04438, Loss B: 0.03987