tensorflow/models · error · ValueError
length of vocab_sizes: {len(vocab_sizes)} is not equal to th
Error message
length of vocab_sizes: {len(vocab_sizes)} is not equal to the length of embedding_dim: {len(embedding_dim)} What it means
Error "length of vocab_sizes: {len(vocab_sizes)} is not equal to the length of embedding_dim: {len(embedding_dim)}" thrown in tensorflow/models.
Source
Thrown at official/recommendation/ranking/task.py:72
vocab_sizes: List of sizes of categories/id's in the table.
embedding_dim: An integer or a list of embedding table dimensions.
table_name_prefix: a prefix for embedding tables.
batch_size: Per-replica batch size.
max_ids_per_chip_per_sample: Maximum number of embedding ids per chip per
sample.
max_ids_per_table: Maximum number of embedding ids per table.
max_unique_ids_per_table: Maximum number of unique embedding ids per table.
allow_id_dropping: bool to allow id dropping.
initialize_tables_on_host: bool : if the embedding table size is more than
what HBM can handle, this flag will help initialize the full embedding
tables on host and then copy shards to HBM.
Returns:
A dictionary of feature_name, FeatureConfig pairs.
"""
if isinstance(embedding_dim, List):
if len(vocab_sizes) != len(embedding_dim):
raise ValueError(
f'length of vocab_sizes: {len(vocab_sizes)} is not equal to the '
f'length of embedding_dim: {len(embedding_dim)}'
)
elif isinstance(embedding_dim, int):
embedding_dim = [embedding_dim] * len(vocab_sizes)
else:
raise ValueError(
'embedding_dim is not either a list or an int, got '
f'{type(embedding_dim)}'
)
if isinstance(max_ids_per_table, List):
if len(vocab_sizes) != len(max_ids_per_table):
raise ValueError(
f'length of vocab_sizes: {len(vocab_sizes)} is not equal to the '
f'length of max_ids_per_table: {len(max_ids_per_table)}'
)
elif isinstance(max_ids_per_table, int):View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/recommendation/ranking/task.py:72 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/bb6d8a7f2f3ebbde.
Report an issue: GitHub.