huggingface/pytorch-image-models · error · RuntimeError

split {split} not found in info ({info.get('splits', {}).key

Error message

split {split} not found in info ({info.get('splits', {}).keys()})

What it means

ReaderWds/_parse_split_info reads an info.json (or similar) describing the webdataset splits; the requested split name was not a key in its 'splits' mapping, so the reader cannot determine filenames/sample counts.

Source

Thrown at timm/data/readers/reader_wds.py:118

        split_filenames = expand_urls(split)
        if split_name:
            split_info = info['splits'][split_name]
            if not num_samples:
                _fc = {f: c for f, c in zip(split_info['filenames'], split_info['shard_lengths'])}
                num_samples = sum(_fc[f] for f in split_filenames)
                split_info['filenames'] = tuple(_fc.keys())
                split_info['shard_lengths'] = tuple(_fc.values())
                split_info['num_samples'] = num_samples
            split_info = _info_convert(split_info)
        else:
            split_info = SplitInfo(
                name=split_name,
                num_samples=num_samples,
                filenames=split_filenames,
            )
    else:
        if 'splits' not in info or split not in info['splits']:
            raise RuntimeError(f"split {split} not found in info ({info.get('splits', {}).keys()})")
        split = split
        split_info = info['splits'][split]
        split_info = _info_convert(split_info)

    return split_info


def log_and_continue(exn):
    """Call in an exception handler to ignore exceptions, issue a warning, and continue."""
    _logger.warning(f'Handling webdataset error ({repr(exn)}). Ignoring.')
    # NOTE: try force an exit on errors that are clearly code / config and not transient
    if isinstance(exn, TypeError):
        raise exn
    return True


def _decode(
        sample,

View on GitHub (pinned to 9a5261e31b)

Solutions

  1. Print the available keys: python -c "import json;print(json.load(open('wds-root/info.json'))['splits'].keys())" and use one of those names.
  2. If split names were changed during dataset export, rebuild info.json or rename the split argument (e.g. use 'val').
  3. Ensure --data-dir points at the directory containing the correct info.json for your dataset.

Example fix

# before
reader = ReaderWds('/data/imagenet-wds', split='validation')

# after
reader = ReaderWds('/data/imagenet-wds', split='val')  # matches info.json
Defensive patterns

Strategy: validation

Validate before calling

import json
info = json.load(open(f'{root}/info.json'))
split = 'val' if 'val' in info.get('splits',{}) else 'validation'
assert split in info['splits'], f"available: {list(info['splits'])}"

Try / catch

try:
    reader = ReaderWds(root, split=split)
except RuntimeError as e:
    if 'not found in info' in str(e):
        print(json.load(open(f'{root}/info.json')).get('splits', {}).keys())
    raise

Prevention

When it happens

Trigger: Creating ReaderWds(root, split='validation') when info.json only defines 'train' and 'val'; also triggered when no 'splits' key exists at all.

Common situations: Split-name mismatch across dataset builds ('valid' vs 'validation' vs 'val'); pointing --data-dir at a directory whose info.json belongs to a different dataset layout; manually authored info.json missing the splits section.

Related errors


AI-assisted analysis of huggingface/pytorch-image-models@9a5261e31b (2026-08-27). Data as JSON: /api/errors/db0853df8d7393e7. Report an issue: GitHub.