Skip to content

Fix DatasetDict examples in the NumPy and JAX guides - #8783

Open
shaikn6 wants to merge 1 commit into
huggingface:mainfrom
shaikn6:docs-datasetdict-samples
Open

shaikn6 wants to merge 1 commit into
huggingface:mainfrom
shaikn6:docs-datasetdict-samples

Conversation

@shaikn6

@shaikn6 shaikn6 commented Oct 11, 2026

Copy link
Copy Markdown

The DatasetDict examples in the NumPy and JAX guides call DatasetDict.from_dict(data), but DatasetDict has no from_dict (only Dataset does), so the snippet fails:

AttributeError: type object 'DatasetDict' has no attribute 'from_dict'

This builds the DatasetDict from Dataset.from_dict(...) per split instead, keeping the same data dict and the lines after it.

Checked against main (9e7496a): the old snippet raises the error above, and both updated snippets run and return the train rows shown in the docs. I left the JAX output as is; current JAX prints Array(...) where the page shows DeviceArray(...), which is the case for the other JAX snippets on that page too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant