Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Node' object has no attribute 'input_masks' #63

Open
spacemonqi opened this issue Jan 11, 2022 · 0 comments
Open

AttributeError: 'Node' object has no attribute 'input_masks' #63

spacemonqi opened this issue Jan 11, 2022 · 0 comments

Comments

@spacemonqi
Copy link

spacemonqi commented Jan 11, 2022

As the original versions are deprecated, I am using:

Keras = 2.7.0
TensorFlow = 2.7.0
Python = 3.8.2

Running the code after fixing the error in #54 results in the following


--------- Epoch 1 -----------
Traceback (most recent call last):
File "Train_POS.py", line 69, in
model.fit(epochs=25)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/neuralnets/BiLSTM.py", line 392, in fit
self.trainModel()
File "/home/daniel/emnlp2017-bilstm-cnn-crf/neuralnets/BiLSTM.py", line 272, in trainModel
self.models[modelName].train_on_batch(nnInput, nnLabels)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 1727, in train_on_batch
logs = self.train_function(iterator)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 828, in call
result = self._call(*args, **kwds)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 871, in _call
self._initialize(args, kwds, add_initializers_to=initializers)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 725, in _initialize
self._stateful_fn._get_concrete_function_internal_garbage_collected( # pylint: disable=protected-access
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 2969, in _get_concrete_function_internal_garbage_collected
graph_function, _ = self._maybe_define_function(args, kwargs)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3361, in _maybe_define_function
graph_function = self._create_graph_function(args, kwargs)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/function.py", line 3196, in _create_graph_function
func_graph_module.func_graph_from_py_func(
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 990, in func_graph_from_py_func
func_outputs = python_func(*func_args, **func_kwargs)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py", line 634, in wrapped_fn
out = weak_wrapped_fn().wrapped(*args, **kwds)
File "/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 977, in wrapper
raise e.ag_error_metadata.to_exception(e)
AttributeError: in user code:

/home/daniel/emnlp2017-bilstm-cnn-crf/venv_scratch/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py:805 train_function  *
    return step_function(self, iterator)
/home/daniel/emnlp2017-bilstm-cnn-crf/neuralnets/keraslayers/ChainCRF.py:357 sparse_loss  *
    mask = self._fetch_mask()
/home/daniel/emnlp2017-bilstm-cnn-crf/neuralnets/keraslayers/ChainCRF.py:303 _fetch_mask  *
    mask = self._inbound_nodes[0].input_masks[0]

AttributeError: 'Node' object has no attribute 'input_masks'

Any help would be much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant