Accelerate

Latest version: v1.2.1

Safety actively analyzes 690691 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 16

1.2.1

* fix: add max_memory to _init_infer_auto_device_map's return statement in https://github.com/huggingface/accelerate/pull/3279 by Nech-C
* fix load_state_dict for npu in https://github.com/huggingface/accelerate/pull/3211 by statelesshz

**Full Changelog**: https://github.com/huggingface/accelerate/compare/v1.2.0...v1.2.1

1.2.0

Core
* enable `find_executable_batch_size` on XPU by faaany in https://github.com/huggingface/accelerate/pull/3236
* Use `numpy._core` instead of `numpy.core` by qgallouedec in https://github.com/huggingface/accelerate/pull/3247
* Add warnings and fallback for unassigned devices in infer_auto_device_map by Nech-C in https://github.com/huggingface/accelerate/pull/3066
* Allow for full dynamo config passed to Accelerator by muellerzr in https://github.com/huggingface/accelerate/pull/3251
* [WIP] FEAT Decorator to purge accelerate env vars by BenjaminBossan in https://github.com/huggingface/accelerate/pull/3252
* [`data_loader`] Optionally also propagate set_epoch to batch sampler by tomaarsen in https://github.com/huggingface/accelerate/pull/3246
* use XPU instead of GPU in the `accelerate config` prompt text by faaany in https://github.com/huggingface/accelerate/pull/3268

Big Modeling
* Fix `align_module_device`, ensure only cpu tensors for `get_state_dict_offloaded_model` by kylesayrs in https://github.com/huggingface/accelerate/pull/3217
* Remove hook for bnb 4-bit by SunMarc in https://github.com/huggingface/accelerate/pull/3223
* [docs] add instruction to install bnb on non-cuda devices by faaany in https://github.com/huggingface/accelerate/pull/3227
* Take care of case when "_tied_weights_keys" is not an attribute by fabianlim in https://github.com/huggingface/accelerate/pull/3226
* Update deferring_execution.md by max-yue in https://github.com/huggingface/accelerate/pull/3262
* Revert default behavior of `get_state_dict_from_offload` by kylesayrs in https://github.com/huggingface/accelerate/pull/3253
* Fix: Resolve 3060, `preload_module_classes` is lost for nested modules by wejoncy in https://github.com/huggingface/accelerate/pull/3248

DeepSpeed
* Select the DeepSpeedCPUOptimizer based on the original optimizer class. by eljandoubi in https://github.com/huggingface/accelerate/pull/3255
* support for wrapped schedulefree optimizer when using deepspeed by winglian in https://github.com/huggingface/accelerate/pull/3266

Documentation

* Update code in tracking documentation by faaany in https://github.com/huggingface/accelerate/pull/3235
* Replaced set/check breakpoint with set/check trigger in the troubleshooting documentation by relh in https://github.com/huggingface/accelerate/pull/3259

* Update set-seed by faaany in https://github.com/huggingface/accelerate/pull/3228
* Fix typo by faaany in https://github.com/huggingface/accelerate/pull/3221
* Use real path for `checkpoint` by faaany in https://github.com/huggingface/accelerate/pull/3220
* Fixed multiple typos for Tutorials and Guides docs by henryhmko in https://github.com/huggingface/accelerate/pull/3274

New Contributors
* winglian made their first contribution in https://github.com/huggingface/accelerate/pull/3266
* max-yue made their first contribution in https://github.com/huggingface/accelerate/pull/3262
* as12138 made their first contribution in https://github.com/huggingface/accelerate/pull/3261
* relh made their first contribution in https://github.com/huggingface/accelerate/pull/3259
* wejoncy made their first contribution in https://github.com/huggingface/accelerate/pull/3248
* henryhmko made their first contribution in https://github.com/huggingface/accelerate/pull/3274


Full Changelog
* Fix `align_module_device`, ensure only cpu tensors for `get_state_dict_offloaded_model` by kylesayrs in https://github.com/huggingface/accelerate/pull/3217
* remove hook for bnb 4-bit by SunMarc in https://github.com/huggingface/accelerate/pull/3223
* enable `find_executable_batch_size` on XPU by faaany in https://github.com/huggingface/accelerate/pull/3236
* take care of case when "_tied_weights_keys" is not an attribute by fabianlim in https://github.com/huggingface/accelerate/pull/3226
* [docs] update code in tracking documentation by faaany in https://github.com/huggingface/accelerate/pull/3235
* Add warnings and fallback for unassigned devices in infer_auto_device_map by Nech-C in https://github.com/huggingface/accelerate/pull/3066
* [`data_loader`] Optionally also propagate set_epoch to batch sampler by tomaarsen in https://github.com/huggingface/accelerate/pull/3246
* [docs] add instruction to install bnb on non-cuda devices by faaany in https://github.com/huggingface/accelerate/pull/3227
* Use `numpy._core` instead of `numpy.core` by qgallouedec in https://github.com/huggingface/accelerate/pull/3247
* Allow for full dynamo config passed to Accelerator by muellerzr in https://github.com/huggingface/accelerate/pull/3251
* [WIP] FEAT Decorator to purge accelerate env vars by BenjaminBossan in https://github.com/huggingface/accelerate/pull/3252
* use XPU instead of GPU in the `accelerate config` prompt text by faaany in https://github.com/huggingface/accelerate/pull/3268
* support for wrapped schedulefree optimizer when using deepspeed by winglian in https://github.com/huggingface/accelerate/pull/3266
* Update deferring_execution.md by max-yue in https://github.com/huggingface/accelerate/pull/3262
* Fix: Resolve 3257 by as12138 in https://github.com/huggingface/accelerate/pull/3261
* Replaced set/check breakpoint with set/check trigger in the troubleshooting documentation by relh in https://github.com/huggingface/accelerate/pull/3259
* Select the DeepSpeedCPUOptimizer based on the original optimizer class. by eljandoubi in https://github.com/huggingface/accelerate/pull/3255
* Revert default behavior of `get_state_dict_from_offload` by kylesayrs in https://github.com/huggingface/accelerate/pull/3253
* Fix: Resolve 3060, `preload_module_classes` is lost for nested modules by wejoncy in https://github.com/huggingface/accelerate/pull/3248
* [docs] update set-seed by faaany in https://github.com/huggingface/accelerate/pull/3228
* [docs] fix typo by faaany in https://github.com/huggingface/accelerate/pull/3221
* [docs] use real path for `checkpoint` by faaany in https://github.com/huggingface/accelerate/pull/3220
* Fixed multiple typos for Tutorials and Guides docs by henryhmko in https://github.com/huggingface/accelerate/pull/3274

Code Diff
Release diff: https://github.com/huggingface/accelerate/compare/v1.1.1...v1.2.0

1.1.0

Internals:
* Allow for a `data_seed` argument in https://github.com/huggingface/accelerate/pull/3150
* Trigger `weights_only=True` by default for all compatible objects when checkpointing and saving with `torch.save` in https://github.com/huggingface/accelerate/pull/3036
* Handle negative values for `dim` input in `pad_across_processes` in https://github.com/huggingface/accelerate/pull/3114
* Enable cpu bnb distributed lora finetune in https://github.com/huggingface/accelerate/pull/3159

DeepSpeed
* Support torch dynamo for deepspeed>=0.14.4 in https://github.com/huggingface/accelerate/pull/3069

Megatron
* update Megatron-LM plugin code to version 0.8.0 or higher in https://github.com/huggingface/accelerate/pull/3174

Big Model Inference
* New `has_offloaded_params` utility added in https://github.com/huggingface/accelerate/pull/3188

Examples
* Florence2 distributed inference example in https://github.com/huggingface/accelerate/pull/3123

Full Changelog
* Handle negative values for `dim` input in `pad_across_processes` by mariusarvinte in https://github.com/huggingface/accelerate/pull/3114
* Fixup DS issue with weakref by muellerzr in https://github.com/huggingface/accelerate/pull/3143
* Refactor scaler to util by muellerzr in https://github.com/huggingface/accelerate/pull/3142
* DS fix, continued by muellerzr in https://github.com/huggingface/accelerate/pull/3145
* Florence2 distributed inference example by hlky in https://github.com/huggingface/accelerate/pull/3123
* POC: Allow for a `data_seed` by muellerzr in https://github.com/huggingface/accelerate/pull/3150
* Adding multi gpu speech generation by dame-cell in https://github.com/huggingface/accelerate/pull/3149
* support torch dynamo for deepspeed>=0.14.4 by oraluben in https://github.com/huggingface/accelerate/pull/3069
* Fixup Zero3 + `save_model` by muellerzr in https://github.com/huggingface/accelerate/pull/3146
* Trigger `weights_only=True` by default for all compatible objects by muellerzr in https://github.com/huggingface/accelerate/pull/3036
* Remove broken dynamo test by oraluben in https://github.com/huggingface/accelerate/pull/3155
* fix version check bug in `get_xpu_available_memory` by faaany in https://github.com/huggingface/accelerate/pull/3165
* enable cpu bnb distributed lora finetune by jiqing-feng in https://github.com/huggingface/accelerate/pull/3159
* [Utils] `has_offloaded_params` by kylesayrs in https://github.com/huggingface/accelerate/pull/3188
* fix bnb by eljandoubi in https://github.com/huggingface/accelerate/pull/3186
* [docs] update neptune API by faaany in https://github.com/huggingface/accelerate/pull/3181
* docs: fix a wrong word in comment in src/accelerate/accelerate.py:1255 by Rebornix-zero in https://github.com/huggingface/accelerate/pull/3183
* [docs] use nn.module instead of tensor as model by faaany in https://github.com/huggingface/accelerate/pull/3157
* Fix typo by kylesayrs in https://github.com/huggingface/accelerate/pull/3191
* MLU devices : Checks if mlu is available via an cndev-based check which won't trigger the drivers and leave mlu by huismiling in https://github.com/huggingface/accelerate/pull/3187
* update Megatron-LM plugin code to version 0.8.0 or higher. by eljandoubi in https://github.com/huggingface/accelerate/pull/3174
* 🚨 🚨 🚨 Goodbye Python 3.8! 🚨 🚨 🚨 by muellerzr in https://github.com/huggingface/accelerate/pull/3194
* Update transformers.deepspeed references from transformers 4.46.0 release by loadams in https://github.com/huggingface/accelerate/pull/3196
* eliminate dead code by statelesshz in https://github.com/huggingface/accelerate/pull/3198
* take `torch.nn.Module` model into account when moving to device by faaany in https://github.com/huggingface/accelerate/pull/3167
* [docs] add xpu part and fix bug in `torchrun` by faaany in https://github.com/huggingface/accelerate/pull/3166
* Models With Tied Weights Need Re-Tieing After FSDP Param Init by fabianlim in https://github.com/huggingface/accelerate/pull/3154
* add the missing xpu for local sgd by faaany in https://github.com/huggingface/accelerate/pull/3163
* typo fix in big_modeling.py by a-r-r-o-w in https://github.com/huggingface/accelerate/pull/3207
* [Utils] `align_module_device` by kylesayrs in https://github.com/huggingface/accelerate/pull/3204

New Contributors
* mariusarvinte made their first contribution in https://github.com/huggingface/accelerate/pull/3114
* hlky made their first contribution in https://github.com/huggingface/accelerate/pull/3123
* dame-cell made their first contribution in https://github.com/huggingface/accelerate/pull/3149
* kylesayrs made their first contribution in https://github.com/huggingface/accelerate/pull/3188
* eljandoubi made their first contribution in https://github.com/huggingface/accelerate/pull/3186
* Rebornix-zero made their first contribution in https://github.com/huggingface/accelerate/pull/3183
* loadams made their first contribution in https://github.com/huggingface/accelerate/pull/3196

**Full Changelog**: https://github.com/huggingface/accelerate/compare/v1.0.1...v1.1.0

1.0.1

Bugfixes

* Fixes an issue where the `auto` values were no longer being parsed when using [deepspeed](https://github.com/huggingface/accelerate/pull/3143)
* Fixes a broken test in the deepspeed tests related to the [auto values](https://github.com/huggingface/accelerate/pull/3145)

**Full Changelog**: https://github.com/huggingface/accelerate/compare/v1.0.0...v1.0.1

1.0

With `accelerate` 1.0, we are officially stating that the core parts of the API are now "stable" and ready for the future of what the world of distributed training and PyTorch has to handle. With these release notes, we will focus first on the major breaking changes to get your code fixed, followed by what is new specifically between 0.34.0 and 1.0.

To read more, check out our official blog [here](https://huggingface.co/blog/accelerate-v1)

Migration assistance

* Passing in `dispatch_batches`, `split_batches`, `even_batches`, and `use_seedable_sampler` to the `Accelerator()` should now be handled by creating an `accelerate.utils.DataLoaderConfiguration()` and passing this to the `Accelerator()` instead (`Accelerator(dataloader_config=DataLoaderConfiguration(...))`)
* `Accelerator().use_fp16` and `AcceleratorState().use_fp16` have been removed; this should be replaced by checking `accelerator.mixed_precision == "fp16"`
* `Accelerator().autocast()` no longer accepts a `cache_enabled` argument. Instead, an `AutocastKwargs()` instance should be used which handles this flag (among others) passing it to the `Accelerator` (`Accelerator(kwargs_handlers=[AutocastKwargs(cache_enabled=True)])`)
* `accelerate.utils.is_tpu_available` should be replaced with `accelerate.utils.is_torch_xla_available`
* `accelerate.utils.modeling.shard_checkpoint` should be replaced with `split_torch_state_dict_into_shards` from the `huggingface_hub` library
* `accelerate.tqdm.tqdm()` no longer accepts `True`/`False` as the first argument, and instead, `main_process_only` should be passed in as a named argument

Multiple Model DeepSpeed Support

After long request, we finally have multiple model DeepSpeed support in Accelerate! (though it is quite early still). Read the full tutorial [here](https://huggingface.co/docs/accelerate/v1.0.0/en/usage_guides/deepspeed_multiple_model#using-multiple-models-with-deepspeed), however essentially:

When using multiple models, a DeepSpeed plugin should be created for each model (and as a result, a separate config). a few examples are below:

Knowledge distillation

(Where we train only one model, zero3, and another is used for inference, zero2)

python
from accelerate import Accelerator
from accelerate.utils import DeepSpeedPlugin

zero2_plugin = DeepSpeedPlugin(hf_ds_config="zero2_config.json")
zero3_plugin = DeepSpeedPlugin(hf_ds_config="zero3_config.json")

deepspeed_plugins = {"student": zero2_plugin, "teacher": zero3_plugin}


accelerator = Accelerator(deepspeed_plugins=deepspeed_plugins)


To then select which plugin to be used at a certain time (aka when calling `prepare`), we call `accelerator.state.select_deepspeed_plugin("name"), where the first plugin is active by default:

python
accelerator.state.select_deepspeed_plugin("student")
student_model, optimizer, scheduler = ...
student_model, optimizer, scheduler, train_dataloader = accelerator.prepare(student_model, optimizer, scheduler, train_dataloader)

accelerator.state.select_deepspeed_plugin("teacher") This will automatically enable zero init
teacher_model = AutoModel.from_pretrained(...)
teacher_model = accelerator.prepare(teacher_model)


Multiple disjoint models

For disjoint models, separate accelerators should be used for each model, and their own `.backward()` should be called later:

python
for batch in dl:
outputs1 = first_model(**batch)
first_accelerator.backward(outputs1.loss)
first_optimizer.step()
first_scheduler.step()
first_optimizer.zero_grad()

outputs2 = model2(**batch)
second_accelerator.backward(outputs2.loss)
second_optimizer.step()
second_scheduler.step()
second_optimizer.zero_grad()


FP8

We've enabled MS-AMP support up to FSDP. At this time we are not going forward with implementing FSDP support with MS-AMP, due to design issues between both libraries that don't make them inter-op easily.

FSDP
* Fixed FSDP auto_wrap using characters instead of full str for layers
* Re-enable setting state dict type manually

Big Modeling
* Removed cpu restriction for bnb training

What's Changed
* Fix FSDP auto_wrap using characters instead of full str for layers by muellerzr in https://github.com/huggingface/accelerate/pull/3075
* Allow DataLoaderAdapter subclasses to be pickled by implementing `__reduce__` by byi8220 in https://github.com/huggingface/accelerate/pull/3074
* Fix three typos in src/accelerate/data_loader.py by xiabingquan in https://github.com/huggingface/accelerate/pull/3082
* Re-enable setting state dict type by muellerzr in https://github.com/huggingface/accelerate/pull/3084
* Support sequential cpu offloading with torchao quantized tensors by a-r-r-o-w in https://github.com/huggingface/accelerate/pull/3085
* fix bug in `_get_named_modules` by faaany in https://github.com/huggingface/accelerate/pull/3052
* use the correct available memory API for XPU by faaany in https://github.com/huggingface/accelerate/pull/3076
* fix `skip_keys` usage in forward hooks by 152334H in https://github.com/huggingface/accelerate/pull/3088
* Update README.md to include distributed image generation gist by sayakpaul in https://github.com/huggingface/accelerate/pull/3077
* MAINT: Upgrade ruff to v0.6.4 by BenjaminBossan in https://github.com/huggingface/accelerate/pull/3095
* Revert "Enable Unwrapping for Model State Dicts (FSDP)" by SunMarc in https://github.com/huggingface/accelerate/pull/3096
* MS-AMP support (w/o FSDP) by muellerzr in https://github.com/huggingface/accelerate/pull/3093
* [docs] DataLoaderConfiguration docstring by stevhliu in https://github.com/huggingface/accelerate/pull/3103
* MAINT: Permission for GH token in stale.yml by BenjaminBossan in https://github.com/huggingface/accelerate/pull/3102
* [docs] Doc sprint by stevhliu in https://github.com/huggingface/accelerate/pull/3099
* Update image ref for docs by muellerzr in https://github.com/huggingface/accelerate/pull/3105
* No more t5 by muellerzr in https://github.com/huggingface/accelerate/pull/3107
* [docs] More docstrings by stevhliu in https://github.com/huggingface/accelerate/pull/3108
* 🚨🚨🚨 The Great Deprecation 🚨🚨🚨 by muellerzr in https://github.com/huggingface/accelerate/pull/3098
* POC: multiple model/configuration DeepSpeed support by muellerzr in https://github.com/huggingface/accelerate/pull/3097
* Fixup test_sync w/ deprecated stuff by muellerzr in https://github.com/huggingface/accelerate/pull/3109
* Switch to XLA instead of TPU by SunMarc in https://github.com/huggingface/accelerate/pull/3118
* [tests] skip pippy tests for XPU by faaany in https://github.com/huggingface/accelerate/pull/3119
* Fixup multiple model DS tests by muellerzr in https://github.com/huggingface/accelerate/pull/3131
* remove cpu restriction for bnb training by jiqing-feng in https://github.com/huggingface/accelerate/pull/3062
* fix deprecated `torch.cuda.amp.GradScaler` FutureWarning for pytorch 2.4+ by Mon-ius in https://github.com/huggingface/accelerate/pull/3132
* 🐛 [HotFix] Handle Profiler Activities Based on PyTorch Version by yhna940 in https://github.com/huggingface/accelerate/pull/3136
* only move model to device when model is in cpu and target device is xpu by faaany in https://github.com/huggingface/accelerate/pull/3133
* fix tip brackets typo by davanstrien in https://github.com/huggingface/accelerate/pull/3129
* typo of "scalar" instead of "scaler" by tonyzhaozh in https://github.com/huggingface/accelerate/pull/3116
* MNT Permission for PRs for GH token in stale.yml by BenjaminBossan in https://github.com/huggingface/accelerate/pull/3112

New Contributors
* xiabingquan made their first contribution in https://github.com/huggingface/accelerate/pull/3082
* a-r-r-o-w made their first contribution in https://github.com/huggingface/accelerate/pull/3085
* 152334H made their first contribution in https://github.com/huggingface/accelerate/pull/3088
* sayakpaul made their first contribution in https://github.com/huggingface/accelerate/pull/3077
* Mon-ius made their first contribution in https://github.com/huggingface/accelerate/pull/3132
* davanstrien made their first contribution in https://github.com/huggingface/accelerate/pull/3129
* tonyzhaozh made their first contribution in https://github.com/huggingface/accelerate/pull/3116

**Full Changelog**: https://github.com/huggingface/accelerate/compare/v0.34.2...v1.0.0

1.0.0

Page 1 of 16

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.