deepfake-faceswap 除錯 Tensorflow win10 cuda9.0 cuDNN7.0
pip安裝tensorflow-gpu
在Python目錄\Lib\site-packages\tensorflow\python\platform\build_info.py中有tensorflow對應的NV軟體版本號
需下載對應版本號安裝,否則import報錯.
可在github上檢視release文件對應的版本號,安裝特定版本pip install tensorflow==1.2.0
cuda9.0下載地址
https://developer.nvidia.com/cuda-toolkit-archive
cuDNN7.0下載地址,需要註冊nv賬號
https://developer.nvidia.com/rdp/cudnn-archive
下載解壓之後把三個資料夾複製到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0,然後不要忘了在環境變數中的使用者變數中的Path中新增“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0”
解除安裝參考:
https://blog.csdn.net/shuiyuejihua/article/details/78738664
CUDA 9.0安裝失敗解決方法:https://blog.csdn.net/zzpong/article/details/80282814
PSSecurityException之PowerShell許可權設定
Windows下PowerShell預設的許可權級別是Restricted,不允許執行PS指令碼(即.ps1檔案)。如果在Restricted許可權級別下執行,會得到錯誤資訊:
.\XXXX.ps1 : File XXXX.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at At line:1 char:1 + .\XXXX.ps1 params[] ... + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess |
要解決這類問題,通常的做法是,用管理員許可權啟動PS命令列,將執行許可權修改為RemoteSigned或者Unrestricted:
Set-ExecutionPolicy RemoteSigned
到這裡,一般就可以解決大多數情況下的問題。
但是,有的時候會發現有的PS指令碼還是會丟擲上面的錯誤。如果你的系統是64位的Windows,那麼有可能你執行指令碼是呼叫的powershell.exe並不是你改過許可權的那一個。從下面兩個位置下執行powershell並檢視許可權設定:
- C:\Windows\System32\WindowsPowerShell\v1.0
- C:\Windows\SystemWoW64\WindowsPowerShell\v1.0
Get-ExecutionPolicy
如果有Restricted將其改為RemoteSigned或者Unrestricted。
執行:
cli.py中有執行引數命令
報錯:
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[32768,512] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[Node: training/Adam/mul_32 = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](training/Adam/sub_14, training/Adam/gradients/model_1/dense_1/MatMul_grad/MatMul_1)]]
查詢資料應該是GPU RAM不夠 730為2G
使用Model_LowMem,修改model.py中的:
ENCODER_DIM = 256
def Encoder(self):
input_ = Input(shape=IMAGE_SHAPE)
x = input_
x = self.conv(128)(x)
x = self.conv(256)(x)
#x = self.conv(512)(x)
x = Dense(ENCODER_DIM)(Flatten()(x))
x = Dense(4 * 4 * 512)(x)
x = Reshape((4, 4, 512))(x)
x = self.upscale(512)(x)
return KerasModel(input_, x)
之後不報錯.