Closed 3chrisprosise closed 6 years ago
Hi @3chrisprosise See the readme.md:
Note: The CNN for character based representations doesn't work with Tensorflow. You will get the error message:
TypeError: unsupported operand type(s) for *: 'IndexedSlices' and 'int'
Solution: Use Theano as backend or don't use character based representations using CNN (parameter: charEmbeddings).
It would be highly appreciated if someone could port the code (the CRF-layer) to Keras 2.x and Tensorflow 1.x.
Sadly character based embeddings does not work with Tensorflow 0.12.x for whatever reason. So I recommend to use Theano as Backend when using this code.
This issue is solved in the latest version (2.1.5), which runs with Keras 2.1.5 and Tensorflow 1.7.0
In BilSTM.py after nnInput sent into the train_on_batch function, it caused TypeError : unsupported operand type(s) for *: 'IndexedSlices' and 'int'
in line 107 when calling self.model.train_on_batch()
with the dataset GermEval, our Env : Keras==1.2.2 nltk==3.2.2 numpy=1.14.1 scipy=1.0.0 theano==0.9.0 h5py==2.6.0 tensorflow==0.12.1
In Epho 1 it shows that : --------- Epoch 1 -----------
Layer (type) Output Shape Param # Connected to
token_emd (Embedding) (None, None, 100) 64854500
casing_emd (Embedding) (None, None, 8) 64
char_emd (TimeDistributed) (None, None, 51, 30) 2850
char_cnn (TimeDistributed) (None, None, 51, 30) 2730
char_pooling (TimeDistributed) (None, None, 30) 0
varLSTM_1 (Bidirectional) (None, None, 200) 191200 merge_1[0][0]
varLSTM_2 (Bidirectional) (None, None, 150) 165600 varLSTM_1[0][0]
hidden_layer (TimeDistributed) (None, None, 26) 3926 varLSTM_2[0][0]
chaincrf_1 (ChainCRF) (None, None, 26) 728 hidden_layer[0][0]
Total params: 65,221,598 Trainable params: 367,034 Non-trainable params: 64,854,564
Could you please tell me how to correct it and how this error occured ?