xai-org/x-algorithm · error · ValueError

Unknown {dataset_type=} for the SID retrieval family

Error message

Unknown {dataset_type=} for the SID retrieval family

What it means

The SID-retrieval config's _make_dataset only supports a small set of dataset types tuned for SID (semantic ID) retrieval, hard-coding use_post_sid=True and sid_num_levels=NUM_SID_TOKENS. Any other dataset_type string falls through and raises this error.

Source

Thrown at phoenix/xrex/configs/xrecsys_sid_retrieval.py:125

        case "aggregated_kafka":
            return PhoenixDataset(
                hash_table=hash_table,
                path="/path/to/offline_kafka_dump",
                history_seq_len=HISTORY_SEQ_LEN,
                candidate_seq_len=CANDIDATE_SEQ_LEN,
                input_vocab_size=INPUT_VOCAB_SIZE,
                hash_vocab_size=HASH_VOCAB_SIZE,
                num_continuous_actions=NUM_CONTINUOUS_ACTIONS,
                pad_token=PAD_TOKEN,
                num_negatives_per_example=0,
                num_kafka_partitions=1024,
                include_candidate_post_ids=True,
                multimodal_embedding_type=None,
                use_post_sid=True,
                sid_num_levels=NUM_SID_TOKENS,
            )
        case _:
            raise ValueError(f"Unknown {dataset_type=} for the SID retrieval family")


SEQUENCE_LEN = NUM_USER_PREFIX + HISTORY_SEQ_LEN + NUM_SID_TOKENS


def make_trainer(
    *,
    name: str,
    dataset,
    attn_impl: str = "jax_attn",
    fa_version: str = "3",
) -> SidRetrievalTrainer:
    return SidRetrievalTrainer(
        name=name,
        precision_level=2,
        reuse_run_id=False,
        evals=[],
        eval_every_n=0,

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Use one of the dataset types the SID-retrieval _make_dataset actually matches (inspect the match cases just above line 125)
  2. Copy configs only from within the SID retrieval family, or start from its MODEL_CFGS templates
  3. Register a factory in config_registry.RANKING_DATASET_FACTORIES if you need a custom dataset that sets use_post_sid=True and sid_num_levels=NUM_SID_TOKENS

Example fix

# before
cfg = {"dataset_type": "aggregated_kafka"}  # not supported here

# after
cfg = {"dataset_type": "sid_retrieval_kafka"}  # a case handled in this _make_dataset
Defensive patterns

Strategy: validation

Validate before calling

# there is no DATASET_TYPES constant for this family; enumerate the supported match cases
SID_RETRIEVAL_DATASET_TYPES = frozenset({"aggregated_kafka"})  # adjust to actual match cases

def validate_sid_dataset_type(dataset_type: str) -> None:
    if dataset_type not in SID_RETRIEVAL_DATASET_TYPES:
        raise SystemExit(
            f"Invalid dataset_type {dataset_type!r} for SID retrieval; valid: {sorted(SID_RETRIEVAL_DATASET_TYPES)}"
        )

Type guard

def is_sid_retrieval_dataset_type(dataset_type: str) -> bool:
    return dataset_type in SID_RETRIEVAL_DATASET_TYPES

Try / catch

try:
    ds = _make_dataset(mparams, dataset_type, hash_table, config_name)
except ValueError as e:
    if "SID retrieval family" in str(e):
        raise SystemExit("Use a dataset_type supported by xrecsys_sid_retrieval") from e
    raise

Prevention

When it happens

Trigger: Calling _make_dataset in xrecsys_sid_retrieval with a dataset_type not handled by its match — e.g. reusing 'toy_dataset' or a ranking-family type not supported in the SID retrieval family.

Common situations: Porting a config from xrecsys/xrecsys_two_tower into the SID retrieval family without pruning unsupported dataset options; version drift where a dataset type was added elsewhere but not here; typos.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/68f54896fe738634. Report an issue: GitHub.