guotong1988 / text-style-transfer-chinese

金庸和古龙之间的文本风格转换
26 stars 4 forks source link

报错 _pickle.UnpicklingError: invalid load key, '['. #9

Closed JingxinLee closed 2 years ago

JingxinLee commented 2 years ago

使用您提供的vocab文件,报错, self.size, self.word2id, self.id2word = pickle.load(f) _pickle.UnpicklingError: invalid load key, '['.

guotong1988 commented 2 years ago

最新代码修复了

JingxinLee commented 2 years ago

感谢,现在报另一个错误。请问您的python和tf版本是多少,我的是3.7.11, tf是1.14。

Traceback (most recent call last): File "main.py", line 228, in model = create_model(sess, args, vocab) File "main.py", line 192, in create_model model = Model(args, vocab) File "main.py", line 107, in init cell_g, soft_func, scope='generator') File "/home/projects/TST/text-style-transfer-chinese/code/nn.py", line 107, in rnn_decode output, h = cell(inp, h) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py", line 1159, in call inputs, state, cell_call_fn=self.cell.call, scope=scope) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py", line 1436, in _call_wrapped_cell output, new_state = cell_call_fn(inputs, state, kwargs) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/ops/rnn_cell_impl.py", line 385, in call self, inputs, state, scope=scope, *args, *kwargs) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/layers/base.py", line 537, in call outputs = super(Layer, self).call(inputs, args, kwargs) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 586, in call self.name) File "/home/anaconda3/envs/qg/lib/python3.7/site-packages/tensorflow/python/keras/engine/input_spec.py", line 111, in assert_input_compatibility layer_name + ' is incompatible with the layer: ' ValueError: Input 0 of layer gru_cell_2 is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.

guotong1988 commented 2 years ago

TF版本要比较低,1.3