trl
trl copied to clipboard
Bug: normalize --accelerate_config=<name> CLI syntax
Reproduction
--accelerate_config accepts the documented two-token form, but the equivalent standard equals form is not normalized before TRL forwards launch arguments to Accelerate.
from trl.cli.accelerate_config import resolve_accelerate_config_argument
launch_args = resolve_accelerate_config_argument(
["--accelerate_config=single_gpu", "--num_processes", "2"]
)
assert launch_args[0] == "--config_file"
On main at 6d484baed4db18c2799b9d5b32c2520cba6b4df2, the assertion fails because the function leaves --accelerate_config=single_gpu unchanged. The two-token form (--accelerate_config single_gpu) is normalized correctly.
Expected behavior
Both spellings should resolve the packaged configuration and preserve remaining Accelerate launch arguments:
--config_file .../single_gpu.yaml --num_processes 2
System Info
The defect was reproduced from the main commit above. Local regression validation used:
- Platform: macOS-26.5.2-arm64-arm-64bit
- Python version: 3.11.15
- PyTorch version: 2.13.0
- accelerator(s): cpu
- Transformers version: 5.15.1
- Accelerate version: 1.14.0
- Datasets version: 5.0.1
Checklist
- [x] I checked that this issue is not already filed.
- [x] I included system information.
- [x] The code sample is minimal, complete, and reproducible.
- [x] The code sample is formatted in a code block.