Accelerate
  • ๐ŸŒGETTING STARTED
    • BOINC AI Accelerate
    • Installation
    • Quicktour
  • ๐ŸŒTUTORIALS
    • Overview
    • Migrating to BOINC AI Accelerate
    • Launching distributed code
    • Launching distributed training from Jupyter Notebooks
  • ๐ŸŒHOW-TO GUIDES
    • Start Here!
    • Example Zoo
    • How to perform inference on large models with small resources
    • Knowing how big of a model you can fit into memory
    • How to quantize model
    • How to perform distributed inference with normal resources
    • Performing gradient accumulation
    • Accelerating training with local SGD
    • Saving and loading training states
    • Using experiment trackers
    • Debugging timeout errors
    • How to avoid CUDA Out-of-Memory
    • How to use Apple Silicon M1 GPUs
    • How to use DeepSpeed
    • How to use Fully Sharded Data Parallelism
    • How to use Megatron-LM
    • How to use BOINC AI Accelerate with SageMaker
    • How to use BOINC AI Accelerate with Intelยฎ Extension for PyTorch for cpu
  • ๐ŸŒCONCEPTS AND FUNDAMENTALS
    • BOINC AI Accelerate's internal mechanism
    • Loading big models into memory
    • Comparing performance across distributed setups
    • Executing and deferring jobs
    • Gradient synchronization
    • TPU best practices
  • ๐ŸŒREFERENCE
    • Main Accelerator class
    • Stateful configuration classes
    • The Command Line
    • Torch wrapper classes
    • Experiment trackers
    • Distributed launchers
    • DeepSpeed utilities
    • Logging
    • Working with large models
    • Kwargs handlers
    • Utility functions and classes
    • Megatron-LM Utilities
    • Fully Sharded Data Parallelism Utilities
Powered by GitBook
On this page
  • Installation and Configuration
  • Installing ๐ŸŒ Accelerate
  • Configuring ๐ŸŒ Accelerate
  1. GETTING STARTED

Installation

Installation and Configuration

Before you start, you will need to setup your environment, install the appropriate packages, and configure ๐ŸŒ Accelerate. ๐ŸŒ Accelerate is tested on Python 3.8+.

Installing ๐ŸŒ Accelerate

๐ŸŒ Accelerate is available on pypi and conda, as well as on GitHub. Details to install from each are below:

pip

To install ๐ŸŒ Accelerate from pypi, perform:

Copied

pip install accelerate

conda

๐ŸŒ Accelerate can also be installed with conda with:

Copied

conda install -c conda-forge accelerate

Source

New features are added every day that havenโ€™t been released yet. To try them out yourself, install from the GitHub repository:

Copied

pip install git+https://github.com/boincai/accelerate

If youโ€™re working on contributing to the library or wish to play with the source code and see live results as you run the code, an editable version can be installed from a locally-cloned version of the repository:

Copied

git clone https://github.com/boincai/accelerate
cd accelerate
pip install -e .

Configuring ๐ŸŒ Accelerate

After installing, you need to configure๐ŸŒ Accelerate for how the current system is setup for training. To do so run the following and answer the questions prompted to you:

Copied

accelerate config

To write a barebones configuration that doesnโ€™t include options such as DeepSpeed configuration or running on TPUs, you can quickly run:

Copied

python -c "from accelerate.utils import write_basic_config; write_basic_config(mixed_precision='fp16')"

๐ŸŒ Accelerate will automatically utilize the maximum number of GPUs available and set the mixed precision mode.

To check that your configuration looks fine, run:

Copied

accelerate env

An example output is shown below, which describes two GPUs on a single machine with no mixed precision being used:

Copied

- `Accelerate` version: 0.11.0.dev0
- Platform: Linux-5.10.0-15-cloud-amd64-x86_64-with-debian-11.3
- Python version: 3.7.12
- Numpy version: 1.19.5
- PyTorch version (GPU?): 1.12.0+cu102 (True)
- `Accelerate` default config:
        - compute_environment: LOCAL_MACHINE
        - distributed_type: MULTI_GPU
        - mixed_precision: no
        - use_cpu: False
        - num_processes: 2
        - machine_rank: 0
        - num_machines: 1
        - main_process_ip: None
        - main_process_port: None
        - main_training_function: main
        - deepspeed_config: {}
        - fsdp_config: {}
PreviousBOINC AI AccelerateNextQuicktour

Last updated 1 year ago

๐ŸŒ