tensorflow / tensorflow/recommenders
Title: ValueError when initializing tfrs.metrics.FactorizedTopK with a candidates dataset.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
I encountered a ValueError when attempting to initialize tfrs.metrics.FactorizedTopK with a dataset of candidate embeddings in the TensorFlow Recommenders library. It appears that the function is trying to convert a string into a shape, resulting in an error. I have been trying the sample code which was given at the following web page https://www.tensorflow.org/recommenders/examples/basic_retrieval
It is not working on the given colab link.
The following line
metrics = tfrs.metrics.FactorizedTopK(
candidates=movies.batch(128).map(movie_model)
)
gives the following error.
ValueError Traceback (most recent call last)
[<ipython-input-14-e82bf640c968>](https://localhost:8080/#) in <cell line: 1>()
----> 1 metrics = tfrs.metrics.FactorizedTopK(
2 candidates=movies.batch(128).map(movie_model)
3 )
5 frames
[/usr/local/lib/python3.10/dist-packages/keras/src/backend/common/variables.py](https://localhost:8080/#) in standardize_shape(shape)
533 continue
534 if not is_int_dtype(type(e)):
--> 535 raise ValueError(
536 f"Cannot convert '{shape}' to a shape. "
537 f"Found invalid entry '{e}' of type '{type(e)}'. "
ValueError: Cannot convert '('c', 'o', 'u', 'n', 't', 'e', 'r')' to a shape. Found invalid entry 'c' of type '<class 'str'>'.
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 by reproducing the basic retrieval example from the linked TensorFlow Recommenders page or Colab, focusing on the FactorizedTopK initialization with movies.batch(128).map(movie_model). Trace the reported Keras shape-conversion error involving 'counter'; done means the sample initializes without the 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
- Needs clarification
- Newbie friendliness
- 38/100