zhaoyingjun / chatbot

ChatGPT带火了聊天机器人,主流的趋势都调整到了GPT类模式,本项目也与时俱进,会在近期更新GPT类版本。基于本项目和自己的语料可以训练出自己想要的聊天机器人,用于智能客服、在线问答、闲聊等场景。
3.51k stars 1.02k forks source link

int() argument must be a string, a bytes-like object or a number, not 'NoneType' #133

Open 19980715dyy opened 2 years ago

19980715dyy commented 2 years ago

tf.keras.preprocessing.sequence.pad_sequences([[1,2],[2,3]], maxlen=20,padding='post') the code above is ok.

but , tf.keras.preprocessing.sequence.pad_sequences(input_tensor, maxlen=20,padding='post') File "/home/student2/software/anaconda3/envs/tf/lib/python3.8/site-packages/keras_preprocessing/sequence.py", line 98, in pad_sequences trunc = np.asarray(trunc, dtype=dtype) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' I don't kown why?

type(input_tensor) is list type(input_tensor[0][0]) is int

19980715dyy commented 2 years ago

seq2seq_tensorflow

19980715dyy commented 2 years ago

input_tensor 里面有None值,将None换成其他数值就行了。

但是又出现这个错误output, state = self.gru(x_emb, initial_state=hidden) tensorflow.python.framework.errors_impl.InvalidArgumentError: Exception encountered when calling layer "gru" (type GRU).

baifachuan commented 2 years ago

不是替换的问题,而是tokenizer序列化后再反序列出来有问题,丢失了很多key,不要提前去生成词袋,运行的时候动态生成就行。

sunyrain commented 2 years ago

我也遇到了同样的问题,所以该怎么办呢?

wenChingzhou commented 1 year ago

同问 何解