这是indexloc提供的服务,不要输入任何密码
Skip to content

Title: ValueError when initializing tfrs.metrics.FactorizedTopK with a candidates dataset. #748

@malinphy

Description

@malinphy

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'>'.

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions