tensorflow / tensorflow/recommenders

Error: inputs' should be zero or more (nested) Tensors. Received 'None' with type '<class 'NoneType'>'

Open
#724 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
300
PR merge metrics
No merged PRs in 30d

Description

Getting below error when trying Quickstart example.

File "/Users/terry/Documents/project/recommender/recommenders/collab_filtering_movie.py", line 222, in
model.evaluate(cached_test, return_dict=True)
File "/Users/terry/Documents/project/recommender/recommenders/.venv/lib/python3.12/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/Users/terry/Documents/project/recommender/recommenders/tensorflow_recommenders/models/base.py", line 90, in test_step
loss = self.compute_loss(inputs, training=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/terry/Documents/project/recommender/recommenders/collab_filtering_movie.py", line 136, in compute_loss
return self.task(user_embeddings, positive_movie_embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/terry/Documents/project/recommender/recommenders/tensorflow_recommenders/tasks/retrieval.py", line 198, in call
metric.update_state(
File "/Users/terry/Documents/project/recommender/recommenders/tensorflow_recommenders/metrics/factorized_top_k.py", line 194, in update_state
return tf.group(update_ops)
^^^^^^^^^^^^^^^^^^^^
TypeError: Exception encountered when calling Retrieval.call().

'inputs' should be zero or more (nested) Tensors. Received 'None' with type '<class 'NoneType'>'.


OSX 14.2.1
python 3.12
tensorflow 2.16.2
tensorflow-recommenders 0.7.3
tensorflow-datasets 4.9.6
keras 3.4.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Quickstart failure from recommenders/collab_filtering_movie.py, especially model.evaluate at line 222 and compute_loss at line 136. Read tensorflow_recommenders/tasks/retrieval.py and metrics/factorized_top_k.py around the reported calls, using the listed TensorFlow, Keras, Python, and TFRS versions. Done means the example evaluation completes without the NoneType TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.