-
Notifications
You must be signed in to change notification settings - Fork 20
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
Failure to load paragraph classifier model #5
Comments
Oh, I think this is a version problem. This code was written before Tensorflow 2 IIRC. You could try rolling back (as there may be other underlying issues even if you fix this one). If you want to try fixing this -- you can remove the You may also be able to get more insight from current group members (@zjensen262?) but IDK if anyone is actively maintaining/updating this code. |
Any follow ups on this? I'm getting a different error when I try to load |
I just added a yml file (https://github.com/olivettigroup/materials-synthesis-generative-models/blob/master/environment.yml) from the conda environment we use. That should give you an idea of what versions of the packages are needed. I tested the paragraph classifier loading with these so let me know if it still doesn't work |
Hi,
many thanks for open-sourcing code and models, which we want to use to classify a large corpus of papers on synthesis.
Could someone could help me out real quick with the following issue? I run
p = paragraph_classifier.ParagraphClassifier()
p.load("/home/ubuntu/scratch/models/paragraph_classifier.model")
where the path points to the pre-trained model in https://figshare.com/s/1a07d18ad20008ddd562.
I get the following error message (below). Could the issue be different code version or am I doing something wrong?
Many thanks,
Libraries
Keras==2.4.3
Keras-Preprocessing==1.1.2
tensorflow==2.3.1
tensorflow-cpu==2.3.1
tensorflow-estimator==2.3.0
Python 3.8.6
Traceback
ValueError Traceback (most recent call last)
in
----> 1 p.load("/home/ubuntu/scratch/models/paragraph_classifier.model")
~/git/materials-synthesis-generative-models/models/paragraph_classifier.py in load(self, filename)
105 def load(self, filename='bin/paragraph_classifier.model'):
106 self.model = load_model(filename)
--> 107 self.fast_predict = K.function(
108 [self.model.inputs] + [K.learning_phase()],
109 [self.model.layers[-1].output]
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/keras/backend.py in function(inputs, outputs, updates, name, **kwargs)
3934 from tensorflow.python.keras import models # pylint: disable=g-import-not-at-top
3935 from tensorflow.python.keras.utils import tf_utils # pylint: disable=g-import-not-at-top
-> 3936 model = models.Model(inputs=inputs, outputs=outputs)
3937
3938 wrap_outputs = isinstance(outputs, list) and len(outputs) == 1
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py in new(cls, *args, **kwargs)
240 # Functional model
241 from tensorflow.python.keras.engine import functional # pylint: disable=g-import-not-at-top
--> 242 return functional.Functional(*args, **kwargs)
243 else:
244 return super(Model, cls).new(cls, *args, **kwargs)
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py in init(self, inputs, outputs, name, trainable)
113 # 'arguments during initialization. Got an unexpected argument:')
114 super(Functional, self).init(name=name, trainable=trainable)
--> 115 self._init_graph_network(inputs, outputs)
116
117 @trackable.no_automatic_dependency_tracking
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
455 self._self_setattr_tracking = False # pylint: disable=protected-access
456 try:
--> 457 result = method(self, *args, **kwargs)
458 finally:
459 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py in _init_graph_network(self, inputs, outputs)
142 base_layer_utils.create_keras_history(self._nested_outputs)
143
--> 144 self._validate_graph_inputs_and_outputs()
145
146 # A Network does not create weights of its own, thus it is already
~/.virtualenvs/deepmd/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py in _validate_graph_inputs_and_outputs(self)
634 if not hasattr(x, '_keras_history'):
635 cls_name = self.class.name
--> 636 raise ValueError('Input tensors to a ' + cls_name + ' ' +
637 'must come from
tf.keras.Input
. '638 'Received: ' + str(x) +
ValueError: Input tensors to a Functional must come from
tf.keras.Input
. Received: 0 (missing previous layer metadata).The text was updated successfully, but these errors were encountered: