我是靠谱客的博主 跳跃香烟,这篇文章主要介绍pytorch 错误处理,现在分享给大家,希望可以做个参考。

#####
    model.cuda()
  File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 304, in cuda
    return self._apply(lambda t: t.cuda(device))
  File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 201, in _apply
    module._apply(fn)
  File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/rnn.py", line 137, in _apply
    self._flat_weights = [getattr(self, weight) for weight in self._flat_weights_names]
  File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 576, in __getattr__
    type(self).__name__, name))
AttributeError: 'LSTM' object has no attribute '_flat_weights_names'
(myconda) root@6d450886ed2f:/mnt/Tang# 

在服务器上跑模型,模型文件下载后,本地不能直接使用而是报错 'LSTM' object has no attribute '_flat_weights_names'

原因是版本问题,服务器pytorch  版本为1.3.0,本地版本为1.4.0 修改后就可以用了

最后

以上就是跳跃香烟最近收集整理的关于pytorch 错误处理的全部内容,更多相关pytorch 错误处理内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(123)

评论列表共有 0 条评论

立即
投稿
返回
顶部