2023-10-31 17:17:44 +00:00
|
|
|
# Accelerate
|
|
|
|
|
2023-11-15 04:25:25 +00:00
|
|
|
> A library that enables the same PyTorch code to be run across any distributed configuration.
|
2023-10-31 17:17:44 +00:00
|
|
|
> More information: <https://huggingface.co/docs/accelerate/index>.
|
|
|
|
|
|
|
|
- Print environment information:
|
|
|
|
|
|
|
|
`accelerate env`
|
|
|
|
|
|
|
|
- Interactively create a configuration file:
|
|
|
|
|
|
|
|
`accelerate config`
|
|
|
|
|
2023-12-03 12:59:57 +00:00
|
|
|
- Print the estimated GPU memory cost of running a Hugging Face model with different data types:
|
2023-10-31 17:17:44 +00:00
|
|
|
|
|
|
|
`accelerate estimate-memory {{name/model}}`
|
|
|
|
|
|
|
|
- Test an Accelerate configuration file:
|
|
|
|
|
|
|
|
`accelerate test --config_file {{path/to/config.yaml}}`
|
|
|
|
|
|
|
|
- Run a model on CPU with Accelerate:
|
|
|
|
|
|
|
|
`accelerate launch {{path/to/script.py}} {{--cpu}}`
|
|
|
|
|
|
|
|
- Run a model on multi-GPU with Accelerate, with 2 machines:
|
|
|
|
|
2023-12-31 07:14:34 +00:00
|
|
|
`accelerate launch {{path/to/script.py}} --multi_gpu --num_machines 2`
|