Hugging Face datasets "FileNotFoundError: Couldn't find a dataset script" in CI
load_dataset could not locate the dataset locally or on the Hub. The name is wrong or unqualified, a local path does not exist, or a private dataset was requested without a token so the Hub hides it.
What this error means
load_dataset fails with "FileNotFoundError: Couldn't find a dataset script at <path> or any data file in the directory" on the runner.
FileNotFoundError: Couldn't find a dataset script at /home/runner/work/app/my_dataset/my_dataset.py
or any data file in the directory. Couldn't find 'my_dataset' on the Hugging Face Hub either.Common causes
The dataset id or local path is wrong
A typo, a missing org/ prefix, or a path that does not exist on the runner means datasets finds nothing to load.
A private dataset requested without a token
Without HF_TOKEN, the Hub hides the private dataset, so it appears missing.
How to fix it
Use the exact dataset id and set a token if private
- Copy the dataset id from its Hub page (including the org).
- For a local dataset, confirm the path exists in the checkout.
- Set
HF_TOKENin the job for a private dataset.
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}Load with the correct config name
Some datasets require a config; pass it explicitly so datasets resolves the right files.
from datasets import load_dataset
load_dataset("glue", "mrpc")How to prevent it
- Copy dataset ids and config names from the Hub page.
- Set
HF_TOKENfor private datasets in CI. - Verify local dataset paths exist after checkout.