来自 Gan 的负载生成器模型
Load generator model from Gan
我训练了 CycleGan,现在我想对其进行评估。
在 cycleGan 训练结束时,我找到了以下文件:latest_net_G_A.pth
当我尝试加载模型并对其进行评估时,我遇到了一些问题:
model = torch.load(PATH)
model.eval()
AttributeError: ‘collections.OrderedDict’ has no attribute ‘eval’
我也试过了:
model = Generator()
model.load_state_dict(torch.load(PATH))
model.eval()
AttributeError : ‘torch.C_.Generator’ object has no attribute ‘load_state_dict’
谢谢
可以分享一下你的训练代码和拟合方法吗?看来您没有评估方法或评估装饰器,这就是您收到此错误的原因。
您正在从 Generator
实例调用 load_state_dict
,但生成器没有这样的方法。也许你想打电话给 torch.nn.Module.load_state_dict
我训练了 CycleGan,现在我想对其进行评估。
在 cycleGan 训练结束时,我找到了以下文件:latest_net_G_A.pth
当我尝试加载模型并对其进行评估时,我遇到了一些问题:
model = torch.load(PATH)
model.eval()
AttributeError: ‘collections.OrderedDict’ has no attribute ‘eval’
我也试过了:
model = Generator()
model.load_state_dict(torch.load(PATH))
model.eval()
AttributeError : ‘torch.C_.Generator’ object has no attribute ‘load_state_dict’
谢谢
可以分享一下你的训练代码和拟合方法吗?看来您没有评估方法或评估装饰器,这就是您收到此错误的原因。
您正在从 Generator
实例调用 load_state_dict
,但生成器没有这样的方法。也许你想打电话给 torch.nn.Module.load_state_dict