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
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\XXXX.ps1 params[] ...
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

要解决这类问题,通常的做法是,用管理员权限启动PS命令行,将执行权限修改为RemoteSigned或者Unrestricted

Set-ExecutionPolicy RemoteSigned

image

到这里,一般就可以解决大多数情况下的问题。

但是,有的时候会发现有的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)

之后不报错.

猜你喜欢

转载自blog.csdn.net/fantasysolo/article/details/82149291