Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forwarding args to the Accelerator in the Trainer class #3392

Open
2 of 4 tasks
santiag0m opened this issue Feb 10, 2025 · 0 comments
Open
2 of 4 tasks

Forwarding args to the Accelerator in the Trainer class #3392

santiag0m opened this issue Feb 10, 2025 · 0 comments

Comments

@santiag0m
Copy link

santiag0m commented Feb 10, 2025

System Info

- `transformers` version: 4.46.3
- Platform: Linux
- Accelerate version: 1.3.0

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • One of the scripts in the examples/ folder of Accelerate or an officially supported no_trainer script in the examples folder of the transformers repo (such as run_no_trainer_glue.py)
  • My own task or dataset (give details below)

Reproduction

The issue happens when initializing a Trainer object:

from transformers.trainer import Trainer

trainer = Trainer(
    accelerator_config = {**kwargs},  # Custom Accelerator arguments
)

Expected behavior

Hey!

Is there a reason on why the accelerator_config only gets forwarded to the Accelerator args when Accelerate is not available (or less than 0.28.0)?

I would like to provide custom arguments to the accelerator when I initialize the Trainer class but it seems those arguments won't be picked up by the accelerator construction due to the conditional here:

        if is_accelerate_available("0.28.0"):
            args["dataloader_config"] = dataloader_config
        else:
            args.update(accelerator_config)


        # create accelerator object
        self.accelerator = Accelerator(**args)
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

No branches or pull requests

1 participant