DDPM玩具代码来源:https://github.com/abarankab/DDPM
1.import报错:
不能用相对引用,需要把from .ema impot xxx 改成 from ema import xxx。所有类似的相对引用都需要修改。
2.报错:ValueError: args.log_to_wandb set to True but args.project_name is None
该报错信息是因为wandb没有注册的原因,参考链接wandb使用方法以及具体设置_wandb.init_神晟的光辉的博客-CSDN博客https://blog.csdn.net/weixin_43164054/article/details/124156206
注册wandb账号并在当前虚拟环境下输入wandb login,将key复制后输入即可正常运行
3.wandb初始化报错
将初始化步骤中的entity参数删除就可以了,参考使用wandb报错:ERROR Error while calling W&B API: project not found (<Response [404]>)_error error while calling w&b api: user is not log_菜包好次的博客-CSDN博客https://blog.csdn.net/weixin_43835996/article/details/126955917
wandb.init(entity='',
project='',
name=args.exp_name,
config=args)
改为:
wandb.init(project='',
name=args.exp_name,
config=args)
4.报错:AttributeError: Can't pickle local object 'BaseDataset.img_transformer.<locals>.<lambda>'.............
EOFError: Ran out of input
搜索项目里的所有.py代码文件,一个文件的Ctrl+F搜索,看代码里面是否含有workers、mutilprocessing这两个关键字。搜索到workers将其值改为0即可,参考AttributeError: Can't pickle local object 'BaseDataset.img_transformer..'_weixin_39450145的博客-CSDN博客https://blog.csdn.net/weixin_39450145/article/details/104901193
train_loader = script_utils.cycle(DataLoader( train_dataset, batch_size=batch_size, shuffle=True, drop_last=True, num_workers=2, ))
将其中的num_workers=0,问题解决