koushikkonwar / Few-Shot-

Few shot learning in NLP
11 stars 11 forks source link

Key error while predicting #1

Open arunzz opened 3 years ago

arunzz commented 3 years ago

Hi

On execution of this line X_train = model.predict(embed(np.array(train['text'].values.tolist()))) The following error occurs _ .local/lib/python3.8/site-packages/tensorflow/python/keras/engine/network.py:926 return [tensors[inp._keras_history.layer.name] for inp in ref_inputs] KeyError: 'input1'

Please help. Tensorflow version - 2.2.0 Keras - 2.4 Python - 3.8

mchaitanyak35 commented 3 years ago

Hi,

The error is because embed returns a dict instead of a numpy array, so if you replace that line with below line you won't face this issue.

np.array(embed(np.array(train['text'].values.tolist()))['outputs'])

Thanks, Krishna