HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

accelerate — A library that enables the same PyTorch code to be run across any distributed configuration. More in

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandenableslibrarysameclithataccelerate

Problem

How to use the accelerate command: A library that enables the same PyTorch code to be run across any distributed configuration. More information: <https://huggingface.co/docs/accelerate/index>.

Solution

accelerate — A library that enables the same PyTorch code to be run across any distributed configuration. More information: <https://huggingface.co/docs/accelerate/index>.

Print environment information:
accelerate env


Interactively create a configuration file:
accelerate config


Print the estimated GPU memory cost of running a Hugging Face model with different data types:
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:
accelerate launch {{path/to/script.py}} --multi_gpu --num_machines 2

Code Snippets

Print environment information

accelerate env

Interactively create a configuration file

accelerate config

Print the estimated GPU memory cost of running a Hugging Face model with different data types

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}}

Context

tldr-pages: common/accelerate

Revisions (0)

No revisions yet.