tensorflow / tensorflow/recommenders
Not able to save model for the quickstart example
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
Here is the quickstart example: https://www.tensorflow.org/recommenders/examples/quickstart
It works fine, but I am not able to save the model by model.save('my_model') at the end. It throws exception:
WARNING:tensorflow:Skipping full serialization of Keras layer <__main__.MovieLensModel object at 0x7f727eec7690>, because it is not built.
WARNING:tensorflow:Skipping full serialization of Keras layer <__main__.MovieLensModel object at 0x7f727eec7690>, because it is not built.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-5a8adf13c269> in <module>()
----> 1 model.save("my_model")
3 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/saving/saving_utils.py in raise_model_input_error(model)
96 'set. Usually, input shapes are automatically determined from calling'
97 ' `.fit()` or `.predict()`. To manually set the shapes, call '
---> 98 '`model.build(input_shape)`.'.format(model))
99
100
ValueError: Model <__main__.MovieLensModel object at 0x7f727eec7690> cannot be saved because the input shapes have not been set. Usually, input shapes are automatically determined from calling `.fit()` or `.predict()`. To manually set the shapes, call `model.build(input_shape)`.
This is reproducible. See https://colab.research.google.com/drive/1yktbZXJUb__VAqWvrCH1h0xgJt3XR7Wc?usp=sharing
How can I fix this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TensorFlow Recommenders quickstart example and reproduce the failure in the linked Colab notebook. Inspect the MovieLensModel call path around model.save('my_model') and the input-shape warning. Done means the quickstart model saves successfully without the reported ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, tensorflow
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100