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
  1. REFERENCE

DeepSpeed utilities

PreviousDistributed launchersNextLogging

Last updated 1 year ago

Utilities for DeepSpeed

class accelerate.DeepSpeedPlugin

( hf_ds_config: typing.Any = Nonegradient_accumulation_steps: int = Nonegradient_clipping: float = Nonezero_stage: int = Noneis_train_batch_min: str = Trueoffload_optimizer_device: bool = Noneoffload_param_device: bool = Noneoffload_optimizer_nvme_path: str = Noneoffload_param_nvme_path: str = Nonezero3_init_flag: bool = Nonezero3_save_16bit_model: bool = None )

This plugin is used to integrate DeepSpeed.

deepspeed_config_process

( prefix = ''mismatches = Noneconfig = Nonemust_match = True**kwargs )

Process the DeepSpeed config with the values from the kwargs.

class accelerate.utils.DummyOptim

( paramslr = 0.001weight_decay = 0**kwargs )

Parameters

  • lr (float) โ€” Learning rate.

  • params (iterable) โ€” iterable of parameters to optimize or dicts defining parameter groups

  • weight_decay (float) โ€” Weight decay. **kwargs โ€” Other arguments.

Dummy optimizer presents model parameters or param groups, this is primarily used to follow conventional training loop when optimizer config is specified in the deepspeed config file.

class accelerate.utils.DummyScheduler

( optimizertotal_num_steps = Nonewarmup_num_steps = 0lr_scheduler_callable = None**kwargs )

Parameters

  • optimizer (torch.optim.optimizer.Optimizer) โ€” The optimizer to wrap.

  • total_num_steps (int, optional) โ€” Total number of steps.

  • warmup_num_steps (int, optional) โ€” Number of steps for warmup.

  • lr_scheduler_callable (callable, optional) โ€” A callable function that creates an LR Scheduler. It accepts only one argument optimizer. **kwargs โ€” Other arguments.

Dummy scheduler presents model parameters or param groups, this is primarily used to follow conventional training loop when scheduler config is specified in the deepspeed config file.

class accelerate.utils.DeepSpeedEngineWrapper

( engine )

Parameters

  • engine (deepspeed.runtime.engine.DeepSpeedEngine) โ€” deepspeed engine to wrap

Internal wrapper for deepspeed.runtime.engine.DeepSpeedEngine. This is used to follow conventional training loop.

class accelerate.utils.DeepSpeedOptimizerWrapper

( optimizer )

Parameters

  • optimizer (torch.optim.optimizer.Optimizer) โ€” The optimizer to wrap.

Internal wrapper around a deepspeed optimizer.

class accelerate.utils.DeepSpeedSchedulerWrapper

( scheduleroptimizers )

Parameters

  • scheduler (torch.optim.lr_scheduler.LambdaLR) โ€” The scheduler to wrap.

  • optimizers (one or a list of torch.optim.Optimizer) โ€”

Internal wrapper around a deepspeed scheduler.

๐ŸŒ
<source>
<source>
<source>
<source>
<source>
<source>
<source>