[go: nahoru, domu]

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

'Sequential' object has no attribute '_get_save_spec' #39001

Closed
davidbayon opened this issue Apr 28, 2020 · 6 comments
Closed

'Sequential' object has no attribute '_get_save_spec' #39001

davidbayon opened this issue Apr 28, 2020 · 6 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter type:bug Bug

Comments

@davidbayon
Copy link

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Google Colab
  • TensorFlow installed from (source or binary): -
  • TensorFlow version (or github SHA if from source): 2.2

Command used to run the converter or code if you’re using the Python API
https://colab.research.google.com/drive/1IJWCGMZ9Wrf8C89oLJ_AWnGPH1ea4dma

converter = tf.lite.TFLiteConverter.from_keras_model(model)

The output from the converter invocation

AttributeError Traceback (most recent call last)
in ()
----> 1 converter = tf.lite.TFLiteConverter.from_keras_model(model)

1 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/saving/saving_utils.py in model_input_signature(model, keep_original_batch_size)
75 TensorSpecs. This list does not contain the training argument.
76 """
---> 77 input_specs = model._get_save_spec(dynamic_batch=not keep_original_batch_size) # pylint: disable=protected-access
78 if input_specs is None:
79 return None

AttributeError: 'Sequential' object has no attribute '_get_save_spec'

Failure details
Fails to convert

Any other info / logs
When running the exact same code on a Windows 10 machine with TF2.1, the error is different :

D:\dev\Anaconda3\lib\site-packages\keras\engine\base_layer.py in call(self, inputs, **kwargs)
487 # Actually call the layer,
488 # collecting output(s), mask(s), and shape(s).
--> 489 output = self.call(inputs, **kwargs)
490 output_mask = self.compute_mask(inputs, previous_mask)
491

TypeError: call() got an unexpected keyword argument 'training'

@davidbayon davidbayon added the TFLiteConverter For issues related to TFLite converter label Apr 28, 2020
@Saduf2019
Copy link
Contributor

@davidbayon
I ran the code shared by you but face a different error, please refer to gist here

@Saduf2019 Saduf2019 added the stat:awaiting response Status - Awaiting response from author label Apr 29, 2020
@LunaMK
Copy link
LunaMK commented May 1, 2020

tf.keras not same keras
model=tf.keras.models.load_model('model.h5', compile=False)

@davidbayon
Copy link
Author
davidbayon commented May 1, 2020 via email

@davidbayon
Copy link
Author

Issue was :
model=tf.keras.models.load_model('model.h5', compile=False) had to be used instead of
model=keras.models.load_model('model.h5', compile=False)

@GeorgeAnaneNyarko
Copy link

Please what is the solution code to that error

@roboticvedant
Copy link

I am having same issue with this model:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author TFLiteConverter For issues related to TFLite converter type:bug Bug
Projects
None yet
Development

No branches or pull requests

5 participants