Sleepychord / ChinesePoemGeneration

基于深度学习的古诗生成(deep learning based Chinese poem generation)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There is something wrong during running the demo.py

burbage233 opened this issue · comments

image
u'春'
此字在语料库中未出现过,请更换首字

Traceback (most recent call last):
File "D:/app/桌面文件/pytorch_pycharm/ChinesePoemGeneration-master-gru/demo.py", line 82, in
poems = infer(model, final, words, word2int, emb, hidden_size = model.hidden_size, start=start, n = 20, num = 5 if random.random() < 0.5 else 7)
File "D:\app\桌面文件\pytorch_pycharm\ChinesePoemGeneration-master-gru\main.py", line 48, in infer
x, h = model(x, h)
File "C:\Users\lenovo.conda\envs\py36\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\lenovo.conda\envs\py36\lib\site-packages\torch\nn\modules\rnn.py", line 837, in forward
result = _VF.gru(input, hx, self._flat_weights, self.bias, self.num_layers,
File "C:\Users\lenovo.conda\envs\py36\lib\site-packages\torch\nn\modules\module.py", line 1131, in getattr
type(self).name, name))
AttributeError: 'GRU' object has no attribute '_flat_weights'

my pytorch version is 1.9.0