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)