UKPLab / emnlp2017-bilstm-cnn-crf

BiLSTM-CNN-CRF architecture for sequence tagging
Apache License 2.0
822 stars 263 forks source link

Running python3 Train_POS.py and get an error #28

Open elixuy opened 6 years ago

elixuy commented 6 years ago

Hi, I am facing the following error when trying to run python3 Train_POS.py . How could I fix this? WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py:1114: calling reduce_max (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead Traceback (most recent call last): File "Train_Chunking.py", line 69, in <module> model.fit(epochs=25) File "/root/codebase/emnlp2017-bilstm-cnn-crf/neuralnets/BiLSTM.py", line 381, in fit self.buildModel() File "/root/codebase/emnlp2017-bilstm-cnn-crf/neuralnets/BiLSTM.py", line 250, in buildModel model.compile(loss=lossFct, optimizer=opt) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 910, in compile sample_weight, mask) File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 436, in weighted score_array = fn(y_true, y_pred) File "/root/codebase/emnlp2017-bilstm-cnn-crf/neuralnets/keraslayers/ChainCRF.py", line 355, in sparse_loss mask = self._fetch_mask() File "/root/codebase/emnlp2017-bilstm-cnn-crf/neuralnets/keraslayers/ChainCRF.py", line 300, in _fetch_mask if self._inbound_nodes: AttributeError: 'ChainCRF' object has no attribute '_inbound_nodes'

nreimers commented 6 years ago

Hi, your error message indicates that Python 2.7 packages are used /usr/local/lib/python2.7/dist-packages/keras/.

Maybe the local Python setup got mixed up between Python 2 and Python 3?

I can recommend to use miniconda / anaconda for creating a nice an clean Python enviromnent with the correct python version you need.

For more details how to setup an env. with conda, you can see the readme here: https://github.com/UKPLab/elmo-bilstm-cnn-crf