darts框架使用

文|Seraph

高版本Pytorch问题

  1. 运行test.py报错IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
    解决:update函数的参数loss.data[0]prec1.data[0]prec5.data[0]等修改为loss.item()prec1.item()prec5.item()
  2. 执行python visualize.py DARTS报错:
    test failed: ExecutableNotFound: failed to execute ['dot', '-Tpng'],make sure the Graphviz executables are on your systems ' PATH
    解决:除了pip install graphviz,还需要apt install graphviz
    FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open'
    解决:安装apt install xdg-utils
  3. 使用train_search.py得到的weight.pt进行test.py测试报错:RuntimeError: Error(s) in loading state_dict for NetworkCIFAR
  • Missing key(s) in state_dict:
    解决:修改utils.py模块中的load函数如下,(Pytorch老版本兼容问题)
def load(model, model_path):
  model.load_state_dict(torch.load(model_path)False)
  • size mismatch for : copying a param of from checkpoint, where the shape is torch.Size in current model.
    解决:输入运行命令时输入与.pt文件中模型一样的--init_channels 16--layers 8。由于test.py和train.py中这两个参数的默认值时一样的,而train_search.py是不一样的,所以要统一参数值,才能使运行模型一致。
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值