HF auto train dataset load_metric error

Let’s do it like this:

  1. Restart the space.
  2. Try training your model.
  3. If you encounter any issues, share the logs without restarting the space.
1 Like

Hi,
I did not encounter any problems looking at the log which is below (prior to restarting). However, I don’t see the model appearing in the space profile at this time but it can taka while I know. For now these are the logs after running the fine-tuning and NO restart. Ian

===== Build Queued at 2025-06-02 10:49:57 / Commit SHA: 258f64f =====

→ FROM docker.io/huggingface/autotrain-advanced:latest@sha256:123d1c66880e890daae8642aedb2b70b2addfa7995d20c8d0aa8976ceed8ca36
DONE 0.0s

DONE 0.0s

→ Pushing image
DONE 0.9s

→ Exporting cache
DONE 0.1s

1 Like

There are two options under Logs: Build and Container. What you shared is from the Build section. Could you please share the Container part?

Click ‘Lock Scroll’ as well to make an accurate selection.

1 Like

Just showing the Error part at the bottom of the container log:

ERROR | 2025-06-02 12:20:12 | autotrain.trainers.common:wrapper:215 - train has failed due to an exception: Traceback (most recent call last):
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/common.py”, line 212, in wrapper
return func(*args, **kwargs)
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/extractive_question_answering/main.py”, line 65, in train
train_data = load_dataset(
File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 1735, in load_dataset
builder_instance = load_dataset_builder(
File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 1519, in load_dataset_builder
builder_instance: DatasetBuilder = builder_cls(
File “/app/env/lib/python3.10/site-packages/datasets/builder.py”, line 1357, in init
super().init(*args, **kwargs)
File “/app/env/lib/python3.10/site-packages/datasets/builder.py”, line 322, in init
self.config, self.config_id = self._create_builder_config(
File “/app/env/lib/python3.10/site-packages/datasets/builder.py”, line 475, in _create_builder_config
builder_config = self.BUILDER_CONFIG_CLASS(**config_kwargs)
TypeError: BuilderConfig.init() got an unexpected keyword argument ‘token’

ERROR | 2025-06-02 12:20:12 | autotrain.trainers.common:wrapper:216 - BuilderConfig.init() got an unexpected keyword argument ‘token’
INFO | 2025-06-02 12:20:12 | autotrain.trainers.common:pause_space:156 - Pausing space…

1 Like

It seems that the older version of the datasets library is not compatible with AutoTrain.

If I were you, I would try using an older container version, something like:
FROM huggingface/autotrain-advanced:5e9f28f

From

FROM huggingface/autotrain-advanced:latest   
CMD pip uninstall -y autotrain-advanced && pip install -U autotrain-advanced && pip install datasets==2.9  && autotrain app --host 0.0.0.0 --port 7860 --workers 1

To

FROM huggingface/autotrain-advanced:5e9f28f
CMD  autotrain app --host 0.0.0.0 --port 7860 --workers 1

Try using some older versions to see if any of them work.

Check this message again:

1 Like

I tried that suggestion again and got the datasets load_metric error again. I will try other versions. Thanks very much for your help! Ian

1 Like
FROM huggingface/autotrain-advanced:5e9f28f
CMD  autotrain app --host 0.0.0.0 --port 7860 --workers 1

Did you try without the following ? I updated the post. Can you refresh the page and check again.

pip uninstall -y autotrain-advanced && pip install -U autotrain-advanced

Otherwise pip install -U installs again new version of datasets.

1 Like

My apologies but I am a little lost here. Could you please just restate what I should try again? Thanks very much, Ian

1 Like

No problem. You need to update Dockerfile. Put the following, commit the changes and restart the space:

FROM huggingface/autotrain-advanced:5e9f28f
CMD  autotrain app --host 0.0.0.0 --port 7860 --workers 1

like this one:

2 Likes

Hi there,
well, I did what you said this morning and then went back to Space-Autotrain but that page has now removed the Extractive Question Answer option in the menu on the left hand side of the screen. No idea why. So I cannot proceed any further. Does anyone know why they have removed this option?
I will check back to see if it is reinstated, and if it is I will try again.
Thanks again for all your help. Ian

1 Like

There are no signs of changes on the library side…
Maybe it’s because of updates to related libraries.:thinking:

Thanks for your reply. It is missing in my page. See attached image.

1 Like

Hi,
Because we’re currently using an older version of Docker, which didn’t support this task at the time:

FROM huggingface/autotrain-advanced:5e9f28f

Could you please try using a more recent version?

https://hub.docker.com/r/huggingface/autotrain-advanced/tags?page=4

Maybe e561508, e41671c etc…

2 Likes

Hi,
I tried your first version option and got some different errors. I notice that there was also a warning about loading the datasets being deprecated. Here are the logs:

INFO | 2025-06-05 15:52:50 | autotrain.app.utils:kill_process_by_pid:52 - Sent SIGTERM to process with PID 82

INFO | 2025-06-05 15:52:50 | autotrain.app.utils:get_running_jobs:26 - Killing PID: 82

subprocess.CalledProcessError: Command ‘[’/app/env/bin/python’, ‘-m’, ‘autotrain.trainers.extractive_question_answering’, ‘–training_config’, ‘autotrain-ws4nc-nzib4/training_params.json’]’ returned non-zero exit status 1.

raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)

File “/app/env/lib/python3.10/site-packages/accelerate/commands/launch.py”, line 704, in simple_launcher

simple_launcher(args)

File “/app/env/lib/python3.10/site-packages/accelerate/commands/launch.py”, line 1106, in launch_command

args.func(args)

File “/app/env/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py”, line 48, in main

sys.exit(main())

File “/app/env/bin/accelerate”, line 8, in

Traceback (most recent call last):

ValueError: Loading squad requires you to execute the dataset script in that repo on your local machine. Make sure you have read the code there to avoid malicious use, then set the option trust_remote_code=True to remove this error.

raise ValueError(

File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 811, in get_module

).get_module()

File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 2016, in metric_module_factory

raise e1 from None

File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 2022, in metric_module_factory

return deprecated_function(*args, **kwargs)

File “/app/env/lib/python3.10/site-packages/datasets/utils/deprecation_utils.py”, line 46, in wrapper

metric_module = metric_module_factory(

File “/app/env/lib/python3.10/site-packages/datasets/load.py”, line 2104, in load_metric

return deprecated_function(*args, **kwargs)

File “/app/env/lib/python3.10/site-packages/datasets/utils/deprecation_utils.py”, line 46, in wrapper

SQUAD_METRIC = load_metric(“squad”)

File “/app/src/autotrain/trainers/extractive_question_answering/utils.py”, line 63, in

from autotrain.trainers.extractive_question_answering import utils

File “/app/src/autotrain/trainers/extractive_question_answering/main.py”, line 30, in

exec(code, run_globals)

File “/app/env/lib/python3.10/runpy.py”, line 86, in _run_code

return _run_code(code, main_globals, None,

File “/app/env/lib/python3.10/runpy.py”, line 196, in _run_module_as_main

Traceback (most recent call last):

Downloading extra modules: 3.29kB [00:00, 10.8MB/s]

Downloading extra modules: 0%| | 0.00/1.11k [00:00<?, ?B/s]

Downloading builder script: 4.50kB [00:00, 10.3MB/s]

Downloading builder script: 0%| | 0.00/1.72k [00:00<?, ?B/s]

SQUAD_METRIC = load_metric(“squad”)

/app/src/autotrain/trainers/extractive_question_answering/utils.py:63: FutureWarning: load_metric is deprecated and will be removed in the next major version of datasets. Use ‘evaluate.load’ instead, from the new library :hugs: Evaluate: 🤗 Evaluate

To avoid this warning pass in values for each of the problematic parameters or run accelerate config.

--dynamo_backend was set to a value of 'no'

--mixed_precision was set to a value of 'no'

--num_machines was set to a value of 1

--num_processes was set to a value of 0

The following values were not passed to accelerate launch and had defaults used instead:

INFO | 2025-06-05 15:52:37 | autotrain.backends.local:create:13 - Training PID: 82

INFO | 2025-06-05 15:52:37 | autotrain.commands:launch_command:490 - {‘data_path’: ‘lhoestq/squad’, ‘model’: ‘FacebookAI/roberta-base’, ‘lr’: 5e-05, ‘epochs’: 3, ‘max_seq_length’: 512, ‘max_doc_stride’: 128, ‘batch_size’: 8, ‘warmup_ratio’: 0.1, ‘gradient_accumulation’: 1, ‘optimizer’: ‘adamw_torch’, ‘scheduler’: ‘linear’, ‘weight_decay’: 0.0, ‘max_grad_norm’: 1.0, ‘seed’: 42, ‘train_split’: ‘train’, ‘valid_split’: ‘validation’, ‘text_column’: ‘context’, ‘question_column’: ‘question’, ‘answer_column’: ‘answers’, ‘logging_steps’: -1, ‘project_name’: ‘autotrain-ws4nc-nzib4’, ‘auto_find_batch_size’: False, ‘mixed_precision’: ‘none’, ‘save_total_limit’: 1, ‘token’: ‘*****’, ‘push_to_hub’: True, ‘eval_strategy’: ‘epoch’, ‘username’: ‘ianmd’, ‘log’: ‘tensorboard’, ‘early_stopping_patience’: 5, ‘early_stopping_threshold’: 0.01}

INFO | 2025-06-05 15:52:37 | autotrain.commands:launch_command:489 - [‘accelerate’, ‘launch’, ‘–cpu’, ‘-m’, ‘autotrain.trainers.extractive_question_answering’, ‘–training_config’, ‘autotrain-ws4nc-nzib4/training_params.json’]

INFO | 2025-06-05 15:52:37 | autotrain.backends.local:create:8 - Starting local training…

INFO | 2025-06-05 15:52:37 | autotrain.app.ui_routes:handle_form:500 - hardware: local-ui

INFO | 2025-06-05 15:51:35 | autotrain.app.ui_routes:fetch_params:381 - Task: extractive-qa

INFO | 2025-06-05 15:51:26 | autotrain.app.ui_routes:fetch_params:381 - Task: llm:sft

INFO: 10.20.9.132:64994 - “GET /?__sign=eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sIm9uQmVoYWxmT2YiOnsia2luZCI6InVzZXIiLCJfaWQiOiI2N2VlNTdmZDM1NDdmODIzMTAyNTI5M2MiLCJ1c2VyIjoiaWFubWQiLCJzZXNzaW9uSWQiOiI2ODQxYjBiZmQxODAyNTdlOTQwZDE2M2YifSwiaWF0IjoxNzQ5MTM4NjY3LCJzdWIiOiIvc3BhY2VzL2lhbm1kL2F1dG90cmFpbi10ZXN0aW5nIiwiZXhwIjoxNzQ5MjI1MDY3LCJpc3MiOiJodHRwczovL2h1Z2dpbmdmYWNlLmNvIn0.UGSotJCwOS7c-QT3iWaC5oVY3CtukdEOsztqO4Ji341Bz0cbnKag2yGMak0Dv1sVDfF9n3t-RVE601e2ogHrBg HTTP/1.1” 307 Temporary Redirect

INFO: Uvicorn running on http://0.0.0.0:7860 (Press CTRL+C to quit)

INFO: Application startup complete.

INFO: Waiting for application startup.

INFO: Started server process [54]

INFO | 2025-06-05 15:47:41 | autotrain.app.app::24 - AutoTrain started successfully

INFO | 2025-06-05 15:47:41 | autotrain.app.app::23 - AutoTrain version: 0.8.10.dev0

INFO | 2025-06-05 15:47:41 | autotrain.app.app::13 - Starting AutoTrain…

INFO | 2025-06-05 15:47:40 | autotrain.app.ui_routes::298 - AutoTrain started successfully

INFO | 2025-06-05 15:47:36 | autotrain.app.ui_routes::32 - Starting AutoTrain…