#####
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 修改後就可以用了