DelurGan 训练常见问题
问:AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'
答:这是因为在仅支持 CPU 的平台上运行时,训练命令却尝试选择 CUDA 设备。
在命令中添加 --gpu_ids -1,让项目以 CPU 模式运行:
python train.py --gpu_ids -1
如果你原本希望使用 GPU 训练,请在修改命令前确认本地 PyTorch 构建包含 CUDA 支持:
import torch
print(torch.cuda.is_available())
print(torch.version.cuda)
问:ImportError: cannot import name 'SSIM'
答:从 ssim 包中导入 ssim,并将其别名设为 SSIM:
from ssim import ssim as SSIM
这可以修复那些期望名称为 SSIM、而已安装模块实际暴露的函数名为 ssim 的代码。
