tensorflow/models · error · ValueError
length of vocab_sizes
Error message
length of vocab_sizes: {len(vocab_sizes)} is not equal to the length of max_ids_per_table: {len(max_ids_per_table)} What it means
Raised when max_ids_per_table is a list whose length differs from the number of vocab_sizes entries; each feature needs a matching table limit.
Solutions
- Give max_ids_per_table exactly len(vocab_sizes) entries
- Or pass a single int to apply the same per-table capacity everywhere
- Or set it to None if no capacity constraint is needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/recommendation/ranking/task.py:86 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/6d669c6aa0b9c159.
Report an issue: GitHub.
Appendix: source
Thrown at official/recommendation/ranking/task.py:86
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):
max_ids_per_table = [max_ids_per_table] * len(vocab_sizes)
elif max_ids_per_table is not None:
raise ValueError(
'max_ids_per_table is not either a list or an int or None, got '
f'{type(max_ids_per_table)}'
)
if isinstance(max_unique_ids_per_table, List):
if len(vocab_sizes) != len(max_unique_ids_per_table):
raise ValueError(
f'length of vocab_sizes: {len(vocab_sizes)} is not equal to the '
'length of max_unique_ids_per_table: '
f'{len(max_unique_ids_per_table)}'
)View on GitHub (pinned to e006f5f0d5)