Repository navigation
Releases: huggingface/accelerate
Release list
v1.15.0: FSDP2 activation memory, dtensor improvements
v1.15.0: FSDP2 activation memory, dtensor improvements
FSDP2
A large batch of FSDP2 work this release: two fixes that cut activation memory at long sequence lengths, tied-embedding support on torch >= 2.13, and a round of checkpointing correctness and scale fixes.
Activation checkpointing was wrapping each child of the matched layer (self_attn, mlp, the norms) instead of the layer itself, so every inter-child activation stayed saved for backward. It now wraps the layer.
There's also a new FSDP2-only activation_checkpointing_offload, which moves the remaining per-layer checkpoint inputs to pinned CPU memory. Gradients are exactly those of plain activation checkpointing:
# fsdp2.yaml
fsdp_config:
fsdp_version: 2
fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
fsdp_activation_checkpointing: true
fsdp_activation_checkpointing_offload: trueaccelerate launch --config_file fsdp2.yaml train.py- FSDP2 activation checkpointing: wrap the matched transformer layer itself, not each of its children by @qgallouedec in #4172
- Add FSDP2
activation_checkpointing_offload: offload checkpointed layer inputs to pinned CPU memory by @qgallouedec in #4175 - Fix FSDP2 tied-embedding models on torch >= 2.13: put the output embedding in the same fully_shard group by @qgallouedec in #4171
- Fix FSDP2/PEFT/
FULL_STATE_DICTdropping every rank's adapter shard except rank 0 by @AmineDiro in #4206 - FSDP2: per-rank torch.save/load for SHARDED_STATE_DICT to fix 2800+ NPU checkpoint timeout by @gygdh-001 in #4105
- Fix FSDP sharded checkpoint path resolution by @HaomingSong in #4119
- Raise a clear error when FSDP is enabled on a mesh with no shard dimension by @qgallouedec in #4180
DTensor
Two fixes for DTensor-sharded models, which you hit with FSDP2, tensor parallelism, or any N-D parallelism setup: gradient clipping no longer fails on the foreach op when plain tensors and DTensors are mixed, and prepare_model leaves an already-sharded model where it is:
- Clip grad norm support for dtensors by @michaelbenayoun in #4219
- prepare_model: don't move DTensor-sharded models to the device by @qgallouedec in #4181
Offloading & Quantization
An entire model can now be dispatched to disk, including tied weights — useful for tools like llm-compressor that compress large models on machines that can't hold them:
- [Offloading] Support full disk offloading by @kylesayrs in #4083
- Fix disk offload crash on FP8 tensors by @shoemoney in #4151
Trackers
Custom trackers can be registered by name and then selected from log_with= like any built-in one:
from accelerate import Accelerator
from accelerate.tracking import register_tracker_class
register_tracker_class(MyTracker) # MyTracker.name == "my_tracker"
accelerator = Accelerator(log_with="my_tracker")- Add register_tracker_class to register custom trackers by name by @javierdejesusda in #4060
- Fix MLFLOW_NESTED_RUN never being able to turn nesting off by @yupengtang in #4223
Device support
Neuron gains a torch dynamo backend (so --torch-compile works with the Transformers Trainer) and MPS is now reported and handled properly by accelerate env and find_executable_batch_size.
- Add
neuronbackend for torch dynamo by @michaelbenayoun in #4097 - Add the neuron device branch in state by @michaelbenayoun in #4218
- Report MPS as the accelerator in
accelerate envby @xquantize in #4158 - Fix accelerate env never reading the MPS chip name by @yupengtang in #4221
- Treat MPS out-of-memory errors as OOM in find_executable_batch_size by @caiotheodoro in #4227
- Fix memory accounting for integrated CUDA devices by @harshitakrishna18 in #4187
- Ensure device-agnostic in docs by @kaixuanliu in #4163
CLI
- Handle missing accelerate executable in env command by @tandede in #4168
- Fix accelerate launch --cpu never setting the KMP variables by @yupengtang in #4222
- Fix
estimate-memoryfor timm>=1.0.29 by adding thehf-hub:prefix by @iamsharduld in #4213
Minor fixes
- Refuse context parallelism for models with sliding-window or chunked attention layers by @qgallouedec in #4177
- Fix convert_model_to_fp8_ao converting the first and last linear layers by @vineethsaivs in #4147
- Fix get_non_persistent_buffers mutating module._non_persistent_buffers_set by @sohumt123 in #4116
- fix: preserve dataloader iteration state when resuming from checkpoint by @TomQunChao in #4071
- Fix load_accelerator_state only restoring one RNG backend by @Rakshit-gen in #4217
- Reach through the DeepSpeed optimizer wrapper in AcceleratedOptimizer.eval() by @vineethsaivs in #4130
- Fix compile_regions running the uncompiled module by @hjinnkim in #4188
- Forward reduce_batch_size_fn through the find_executable_batch_size decorator form by @vineethsaivs in #4160
- Fix distributedType -> distributed_type typo in downcast_bf16 guard by @uttam12331 in #4149
- Fix duplicated words in user-facing messages by @Sreekant13 in #4091
- Add missing type hints in checkpointing.py by @RudrenduPaul in #4153
- Add missing type hints in utils/memory.py by @RudrenduPaul in #4152
- docs: fix parameter names and a ghost entry in docstrings by @DaoyuanLi2816 in #4076
- docs: fix documented parameter names that do not match the signature by @massimiliano1991 in #4156
- docs: fix garbled sentence in CONTRIBUTING.md by @simpleqt in #4231
- docs: fix three dead links left by the docs restructure by @simpleqt in #4230
- Fix mixed precision argument typo in examples README by @noobyalan in #4192
- Make doc builds faster by @mishig25 in #4103
- Add security policy by @SunMarc in #4134
- Bump pre-commit ruff hook to v0.13.1 to match the quality extra by @devangpratap in #4089
- Fix flaky behavior in gated-model CLI test by making the test deterministic by @sywangyi in #4073
- [test] Update min version torch by @SunMarc in #4170
- Fix CI by @SunMarc in #4229
- chore(deps): bump the actions group across 1 directory with 7 updates by @dependabot[bot] in #4167
- chore(deps): bump the actions group across 1 directory with 4 updates by @dependabot[bot] in #4182
- chore: update build_and_run_tests.yml by @hf-security-analysis[bot] in #4169
New Contributors
- @TomQunChao made their first contribution in #4071
- @DaoyuanLi2816 made their first contribution in #4076
- @devangpratap made their first contribution in #4089
- @Sreekant13 made their first contribution in #4091
- @javierdejesusda made their first contribution in #4060
- @gygdh-001 made their first contribution in #4105
- @sohumt123 made their first contribution in #4116
- @HaomingSong made their first contribution in #4119
- @vineethsaivs made their first contribution in #4147
- @uttam12331 made their first contribution in #4149
- @RudrenduPaul made their first contribution in #4153
- @xquantize made their first contribution in #4158
- @tandede made their first contribution in #4168
- @harshitakrishna18 made their first contribution in #4187
- @shoemoney made their first contribution in #4151
- @massimiliano1991 made their first contribution in #4156
- @hjinnkim made their first contribution in #4188
- @noobyalan made their first contribution in #4192
- @yupengtang made their first contribution in #4221
- @iamsharduld made their first contribution in #4213
- @caiotheodoro made their first contribution in #4227
- @Rakshit-gen made their first contribution in #4217
- @AmineDiro made their first contribution in #4206
- @simpleqt made their first contribution in #4231
Full Changelog: v1.14.0...v1.15.0
v1.14.0: AMD ROCm support, FSDP2 hardening
FSDP2 Improvements
This release brings a large batch of FSDP2 fixes and quality-of-life improvements: correct dtype handling on load, sharding of embeddings/norms, QLoRA crash prevention, and a more robust auto-wrap policy.
- Fsdp2 fully_shard embedding and norm by @SunMarc in #4015
- Fix fsdp2 load full state dict dtype mismatch by @SunMarc in #4021
- Fix region compilation fsdpv2 by @SunMarc in #4022
- [FSDP2] Cast model to uniform dtype before fully_shard to fix mixed-dtype AssertionError by @roycho96 in #3985
- [FSDP2] Auto-exclude non-floating frozen Params4bit from fully_shard to prevent QLoRA crash by @roycho96 in #3987
- fix(FSDP2): auto-wrap policy ignoring _no_split_modules fallback by @JohnGiorgi in #3999
- fix: use key-based matching in fsdp2_load_full_state_dict by @roycho96 in #3982
- fix: add missing model_has_params4bit guard to fsdp2_load_full_state_dict call by @roycho96 in #3981
- Fix to-fsdp2: drop REMOVED / NOT_YET_IMPLEMENTED FSDP1 keys instead of leaking them by @lollinng in #4065
- Prevent double-wrapping models in prepare_model() by @joshuaswanson in #3977
AMD ROCm support
Accelerate now works end-to-end on AMD ROCm devices. Thanks @Abdennacer-Badaoui!
- Make accelerate work end-to-end on AMD ROCm by @Abdennacer-Badaoui in #4025
Neuron
Further Neuron improvements to reduce recompilation and cover missing device cases.
- Add padded allgather and broadcast for Neuron devices to reduce recompilation by @czkkkkkk in #4000
- fix: add missing neuron device case by @michaelbenayoun in #4042
Quantization & Offloading
We improved offloading support for quantized models, including Torchao, int8, and tied-weight handling.
- Torchao offload by @SunMarc in #3973
- Fix int8 offload hook detachment statistics restoration by @jiqing-feng in #4044
- Fix keep_in_fp32_modules not working for tied weights in load_and_quantize_model by @jiqing-feng in #4043
- Fix dtype_byte_size for FP8 fnuz / e8m0fnu dtypes by @lollinng in #4063
Data Loading
- Feat: Support dynamic batch size in BatchSamplerShard with even_batches by @yuxinyuan in #3969
- Fix iterable dataset sharding condition when n_shards == num_processes by @SunMarc in #3958
- Fix implicit padding in split_between_processes when apply_padding=False and num_samples < num_processes by @3manifold in #4052
Minor fixes
- [DeepSpeed] allow kernels flash-attn in SP by @kashif in #3959
- Fix: Conditionally import torch.distributed.algorithms.join in accelerator.py by @0xDELUXA in #3962
- Fix is_hf_initialized attribute by @SunMarc in #3976
- feat(utils): add max reduction type by @imstevenpmwork in #4027
- fix(state): make MLU backend part of the _prepare_backend elif chain by @Anai-Guo in #4057
- fix notebook launcher cuda init by @SunMarc in #4059
- pytorch-triton-xpu rename to triton-xpu by @sywangyi in #4007
- Relax numerical tolerance for XPU in test_big_modeling by @YangKai0616 in #4001
- Fix gloo backend error in test_load_checkpoint_and_dispatch_with_broadcast on XPU by @kaixuanliu in #4056
- Raise ValueError instead of a bare string in ParallelismConfig.get_device_mesh by @lollinng in #4064
- tests: Gracefully handle missing set_device for mps by @booxter in #4028
- test: add regression test for no_split_module_classes accepting set type by @UFO0506 in #4048
- Fix all tests by @SunMarc in #4072
- docs: add aggregate profiler memory example by @aryanputta in #4054
- DOC: document missing parameters in load_accelerator_state, find_executable_batch_size, and send_to_device by @kratos0718 in #4051
- docs: Fix docstring of fsdp2_prepare_auto_wrap_policy by @slocoro in #4037
- Fix DistributedType documentation by @3manifold in #3980
- Fix grammar, spelling, and consistency issues across docs and examples by @cihandemir in #3961
- docs: fix typos in docstrings, comments, and user docs by @mokashang in #4040
- chore: update doc-builder workflow SHA by @rtrompier in #4009
- chore: bump doc-builder SHA for main doc build workflow by @rtrompier in #4018
- [CI] Bump style-bot SHA + switch to GitHub App by @paulinebm in #4031
- Fix TrackioTracker.log() ignoring step parameter by @joshuaswanson in #3975
- fix: pass step parameter in TrackioTracker.log() by @liuyun7345 in #3970
- fix(tracking): default step=None on tracker.log and accept extra kwargs in MLflowTracker by @1fanwang in #4039
- Fix MLflowTracker.store_init_configuration mutating the caller's config dict by @ATOM00blue in #4046
- fix(tracker): guard init_trackers and log against None kwargs by @xodn348 in #4026
- 🔒 Pin GitHub Actions to commit SHAs by @paulinebm in #3992
- chore: update build-docker-images-release.yml by @hf-security-analysis[bot] in #4069
- chore: enable Dependabot weekly GitHub Actions bumps by @hf-dependantbot-rollout[bot] in #4049
- Bump the actions group with 8 updates by @dependabot[bot] in #4068
Full Changelog: v1.13.0...v1.14.0
v1.13.0: Neuron support, IPEX removal, and distributed training fixes
AWS Neuron support
We now have support for AWS Neuron (Trainium/Inferentia) devices. Thanks @michaelbenayoun for adding this.
- Neuron integration by @michaelbenayoun in #3935
XPU Improvements
We've removed IPEX dependency and improved device-agnostic code for XPU.
- using spawn instead of fork for XPU device by @kaixuanliu in #3884
- Remove ipex by @yao-matrix in #3883
- enhance new codes to XPU, and make them be device agnostic by @yao-matrix in #3890
- Fix KMP_AFFINITY incorrectly set for non-CPU training by @hexfaker in
#3912
FSDP2 Improvements
We've added a bunch of important fixes for FSDP2 users: upcasting only grad-requiring params, better tied embedding errors, DCP optimizer loading, bf16 optimizer step crash fix, and torch < 2.7.0 compatibility.
- Upcast FSDP2 parameters only if requires_grad by @ojh31 in #3848
- Fix FSDP2 tied embedding errors with targeted ValueError guidance by @amanzoni1 in #3878
- bug: fsdp cannot load optimizer state using dcp by @flymin in #3904
- fix crash in optimizer.step when fsdp2 is enabled and model is bfloat16 by @sywangyi in #3905
- Fix FSDP2 crash with ignored_params on torch < 2.7.0 by @Mr-Neutr0n in #3924
DeepSpeed Sequence Parallelism
We've added several fixes to the DeepSpeed + Sequence Parallelism integration introduced in v1.12.0, including evaluation support during SP training and proper process group handling.
- [SP] fix loss computation example by @kashif in #3858
- [SP and CP] error out if both CP and SP enabled by @kashif in #3862
- DeepSpeed has its own process group by @kashif in #3916
- [Deepspeed] skip device mesh creation when deepspeed and sp_size >1 by @kashif in #3914
- Enable evaluation during deepspeed Sequence Parallel by @jp1924 in #3917
FP8
We've enhanced FP8 training. Thanks @shimizust for fixing torchao support.
- Fix FP8 torchao default config with padding and FSDP2 all-gather support by @shimizust in #3831
- Fix execution with Transformer Engine by @ksivaman in #3852
- add MS-AMP deprecation warnings by @neha222222 in #3857
Performance
Accelerate now imports faster by deferring heavy dependencies, and torch.compile hooks are disabled lazily.
- Faster import by @SunMarc in #3953
- lazy compile disable by @SunMarc in #3947
- Disable hook compile by @SunMarc in #3888
Minor fixes
- Allow non-Tensor values in a batch with dispatch_batches=True by @tomaarsen in #3850
- fix module and optimizer parameter mismatch before prepare_tp_ by @naomili0924 in #3845
- Fix KeyError in extract_model_from_parallel for partial torch.compile by @amanzoni1 in #3881
- Fix hf_device_map device index comparison in prepare_model by @rezaqorbani in #3895
- Fix StatefulDataLoader KeyError with num_workers > 0 by @veeceey in #3931
- Fix stateful dataloader DDP by @SunMarc in #3952
- Fix: Remove duplicate W&B initialization in offline mode by @shantanugupta2004 in #3886
- Avoid using nvidia-smi on a CPU-only Colab instance by @FlorianVal in #3872
- Fix logging logic when in_order is set to True by @yuxinyuan in #3280
- Fix cpu offload check by @SunMarc in #3946
- fix bug when both cpu_ram_efficient_loading and cpu_offload are enabled by @kaixuanliu in #3910
- Fix async compatibility across python versions by @SunMarc in #3901
- fix tp only bug by @sywangyi in #3908
- fix parallelism_config None error by @jp1924 in #3927
- Np parall fix by @sywangyi in #3900
- change the default value of fsdp_min_num_params to int by @CodeMan62 in #3902
- Fix mutable default in Megatron init and IndexError on empty ModuleList by @jashshah999 in #3944
- Prepare TP fix by @michaelbenayoun in #3945
- feat: added fine tuning example focused on TPUs by @tengomucho in #3847
- Remove 8bit force hook for bnb by @SunMarc in #3907
- docs: flag MS-AMP as deprecated in low-precision training guides by @ManasVardhan in #3929
- fix: correct typo 'guarentee' to 'guarantee' by @thecaptain789 in #3922
- Updating support of Megatron-LM by @pengdurice in #3842
- Update support of Megatron-LM PR 2 by @pengdurice in #3887
- Fix RNG state setting for HPU by @michaelbenayoun in #3936
- fix: load the HPU RNG state by @michaelbenayoun in #3937
v1.12.0: Deepspeed Ulysses/ALST
Deepspeed Ulysses/ALST integration
Deepspeed Ulysses/ALST is an efficient way of training on long sequences by employing sequence parallelism and attention head parallelism. You can learn more about this technology in this paper https://arxiv.org/abs/2506.13996 or this deepspeed tutorial https://www.deepspeed.ai/tutorials/ulysses-alst-sequence-parallelism/.
To enable Deepspeed Ulysses, you first need to create ParallelismConfig and setting sp related args:
parallelism_config = ParallelismConfig(
sp_backend="deepspeed",
sp_size=2,
sp_handler=DeepSpeedSequenceParallelConfig(...),
)Then, you need to make sure to compute the correct loss as described on our docs
...
losses_per_rank = torch.distributed.nn.functional.all_gather(loss, group=sp_group)
good_tokens = (shift_labels != -100).view(-1).sum()
good_tokens_per_rank = torch.distributed.nn.functional.all_gather(good_tokens, group=sp_group)
total_loss = sum(
losses_per_rank[rank] * good_tokens_per_rank[rank]
for rank in range(sp_world_size)
if good_tokens_per_rank[rank] > 0
)
total_good_tokens = sum(good_tokens_per_rank)
loss = total_loss / max(total_good_tokens, 1)Thanks @S1ro1 for starting this work and for @stas00 for finishing this work. Also thanks @kashif for adding docs and reviewing/testing this PR !
This feature will also be available in HF Trainer thanks for this PR from @stas00: huggingface/transformers#41832
Minor changes
- Remove warning for
cpu_ram_efficient_loadingby @SunMarc in #3816 - update typo in bnb quantisation 4bit flag docstring by @hbraith in #3828
- ArXiv -> HF Papers by @qgallouedec in #3834
- Fix typo in broadcast_object_list docstring by @wsntxxn in #3823
- [Bug] Update torch.optim.Optimizer parameter states after tensor parallelism by @naomili0924 in #3835
- use self hosted runner by @SunMarc in #3841
- device type helper by @kashif in #3843
New Contributors
- @hbraith made their first contribution in #3828
- @wsntxxn made their first contribution in #3823
- @naomili0924 made their first contribution in #3835
Full Changelog: v1.11.0...v1.12.0
v1.11.0: TE MXFP8, FP16/BF16 with MPS, Python 3.10
TE MXFP8 support
We've added support for MXFP8 in our TransformerEngine integration. To use that, you need to set use_mxfp8_block_scaling in fp8_config. See nvidia docs [here]. (https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/examples/fp8_primer.html#MXFP8-and-block-scaling)
FP16/BF16 Training for MPS devices
BF16 and FP16 support for MPS devices is finally here. You can now pass mixed_precision = "fp16" or "bf16" when training on a mac (fp16 requires torch 2.8 and bf16 requires torch 2.6)
FSDP updates
The following PRs add respectively support to ignored_params and no_sync() for FSDPv2:
- feat: add ignored_params support for fsdp2 by @kmehant in #3731
- fix: model.set_requires_gradient_sync(False) should be called to turn off gradient synchronization in FSDP2 by @EquationWalker in #3762
Mixed precision can now be passed as a dtype string from accelerate cli flag or fsdp_config in accelerate config file:
Nd-parallel updates
Some minor updates concerning nd-parallelism.
- Context Parallelism docs typos fixed by @sergiopaniego in #3761
- Feat: add to_json by @S1ro1 in #3743
- make torch_native_parallelism examples device agnostic by @yao-matrix in #3759
- [ND Parallel] Update examples, cleanup by @S1ro1 in #3737
Bump to Python 3.10
We've dropped support for python 3.9 as it reached EOL in October.
Lots of minor fixes:
- fix: CPU RAM efficient loading for nd or HSDP parallelisms by @kmehant in #3740
- xpu INT64 all_gather issue fixed in 2.9 by @yao-matrix in #3756
- Specify device_ids in torch.distributed.barrier for PartialState by @qgallouedec in #3744
- fix: specify device for process_tensor in example usage by @qgallouedec in #3755
- Lower complexity of get_balanced_memory by adding a set by @SamuelBarryCS in #3776
- Fix (skip) cuda cache flush when origin device is
cpuand offloaded tometaby @Qubitium in #3796 - Fix convert LayerNorm without bias to fp8 by @mjun0812 in #3725
- Add optional typing by @cyyever in #3769
- refactor: Use
within Accelerator.autocast()instead of__enter__()and__exit__()for more elegant style. by @EquationWalker in #3767 - switch XPU ccl backend to torch-builtin xccl in test_zero3_integration by @yao-matrix in #3773
- fix FSDP2 test case failure on XPU by @yao-matrix in #3771
- Fix tests by @SunMarc in #3722
- Protect import for device_mesh by @SunMarc in #3742
- Fix
SWANLAB_MODEby @SunMarc in #3808 - Fix tracking swanlab by @SunMarc in #3810
- refactor: nit change for get_parameters_from_modules (code debt) by @kmehant in #3815
- Remove deprecated FindTiedParametersResult by @cyyever in #3786
- Add optional typing by @cyyever in #3769
- remove mlflow from testing by @SunMarc in #3783
- enable 2 model hook ut cases on XPU by @yao-matrix in #3774
- Added Tip for better rendering by @sergiopaniego in #3781
- Fix typos by @cyyever in #3753
- fix: torch_npu import error in some envs by @yanyongyu in #3764
- Fix: typo makes tests fail by @S1ro1 in #3765
- fix Muti node CUDA error: invalid device ordinal #3775 by @RicardoDominguez in #3779
- use reset_peak_memory_stats on xpu by @yao-matrix in #3772
New Contributors
- @mjun0812 made their first contribution in #3725
- @sergiopaniego made their first contribution in #3761
- @EquationWalker made their first contribution in #3762
- @yanyongyu made their first contribution in #3764
- @RicardoDominguez made their first contribution in #3779
- @SamuelBarryCS made their first contribution in #3776
- @Qubitium made their first contribution in #3796
Full Changelog: v1.10.1...v1.11.0
v1.10.1: Patchfix
Full Changelog: v1.10.0...v1.10.1
v1.10.0: N-D Parallelism
N-D Parallelism
Training large models across multiple GPUs can be complex, especially when combining different parallelism strategies (e.g TP, CP, DP). To simplify this process, we've collaborated with Axolotl to introduce an easy-to-use integration that allows you to apply any combination of parallelism strategies directly in your training script. Just pass a ParallelismConfig specifying the size of each parallelism type—it's that simple.
Learn more about how it works in our latest blogpost.
parallelism_config = ParallelismConfig(
dp_shard_size=2,
dp_replicate_size=2,
cp_size=2,
tp_size=2,
)
accelerator = Accelerator(
parallelism_config=parallelism_config,
...
)
model = AutoModelForCausalLM.from_pretrained("your-model-name", device_mesh=accelerator.torch_device_mesh)
model = accelerator.prepare(model)- Parallelism config + TP + HSDP + BYODM (Bring Your Own Device Mesh) by @salmanmohammadi in #3682
- Feat: context parallel v2.0 by @S1ro1 in #3700
- set default submesh_tp_size to prevent unset local variable error by @winglian in #3687
- Add Parallelism getter property to Accelerator class by @WoosungMyung in #3703
- Fix: prepare works even if nothing except tp specified (rare) by @S1ro1 in #3707
- Set parallelism_config in constructor due to Trainer reset of State by @winglian in #3713
- Fix: tp size wouldn't read from env by @S1ro1 in #3716
- Remove
ParallelismConfigfromPartialStateby @SunMarc in #3720
FSDP improvements
We've fixed ignored modules attribute. With this, it is now possible to train PEFT model that moe layers that contrains q_proj and v_proj parameters. This is especially important for fine-tuning gpt-oss model.
- ENH: Allow FSDP ignored modules to be regex by @BenjaminBossan in #3698
- TST Add test for FSDP ignored_modules as str by @BenjaminBossan in #3719
Minor improvements
- feature: CpuOffload pre_forward don't attempt to move if already on device by @JoeGaffney in #3695
- Fix: Ensure environment variable values are case-insensitive in Accelerate by @jp1924 in #3712
- remove use_ipex by @SunMarc in #3721
New Contributors
- @salmanmohammadi made their first contribution in #3682
- @WoosungMyung made their first contribution in #3703
- @jp1924 made their first contribution in #3712
- @JoeGaffney made their first contribution in #3695
Full Changelog: v1.9.0...v1.10.0
v1.9.0: Trackio support, Model loading speedup, Minor distributed improvements
Trackio tracker support
We've added support for a trackio, lightweight, 💯 free experiment tracking Python library built on top of 🤗 Datasets and Spaces.
Main features are:
- Local-first design: dashboard runs locally by default. You can also host it on Spaces by specifying a
space_id. - Persists logs locally (or in a private Hugging Face Dataset)
- Visualize experiments with a Gradio dashboard locally (or on Hugging Face Spaces)
- Everything here, including hosting on Hugging Faces, is free!
To use it with accelerate, you need to set log_with and initialize the trackers
accelerator = Accelerator(log_with="trackio")
config={"learning_rate": 0.001, "batch_size": 32}
# init_kwargs in order to host the dashboard on spaces
init_kwargs = {"trackio": {"space_id": "hf_username/space_name"}
accelerator.init_trackers("example_project", config=config, init_kwargs=init_kwargs})Thanks @pcuenca for the integration !
Model loading speedup when relying set_module_tensor_to_device
Setting tensor while clearing cache is very slow, so we added clear_device option to disable it.
Another small optimization is using non_blocking everywhere and syncing just before returning control to the user. This makes the loading slightly faster.
- Speedup model loading by 4-5x in Diffusers ⚡ by @a-r-r-o-w in #3674
FDSP, Deepspeed, FP8 minor improvements
- Add support for e5e2 and default to hybrid when launcher is used by @IlyasMoutawwakil in #3640
- Fix FP8 tests, enable FP8 to be used without direct
Accelerator()configuring by @pstjohn in #3677 - Bunch of FSDP improvements by @S1ro1 in #3671
- Fix: properly error when DDP + Dtensor model by @S1ro1 in #3629
- Fix fsdp2 example typo by @shimizust in #3657
- Added a check in no_sync() to avoid errors when using deepspeed zero2/3 by @xliu0105 in #3656
🚨🚨🚨 Breaking changes 🚨🚨🚨
find_executable_batch_size() will no longer halves the batch after every OOM. Instead, we will multiply the batch size by 0.9. This should help user not waste gpu capacity.
What's Changed
- [typo] shards instead of shard by @SunMarc in #3645
- Docs: Fix typos in gradient accumulation guide by @kilavvy in #3649
- xpu enablement on left cases by @yao-matrix in #3654
- unpin datasets in examples requirements by @SunMarc in #3681
- fix: wandb config not saved in offline mode by @ved1beta in #3648
- accelerate/data_loader.py: do not yield if the base_dataloader is empty by @0xnightwind in #3659
- warn for invalid keys by @ved1beta in #3613
- Update Gaudi runner image to latest SynapseAI and enable previously disabled tests by @IlyasMoutawwakil in #3653
New Contributors
- @kilavvy made their first contribution in #3649
- @shimizust made their first contribution in #3657
- @xliu0105 made their first contribution in #3656
- @0xnightwind made their first contribution in #3659
Full Changelog: v1.8.1...v1.9.0
v1.8.1: Patchfix
- Add support for e5e2 and default to hybrid when launcher is used by @IlyasMoutawwakil in #3640
- shards by @SunMarc in #3645
Full Changelog: v1.8.0...v1.8.1
v1.8.0: FSDPv2 + FP8, Regional Compilation for DeepSpeed, Faster Distributed Training on Intel CPUs, ipex.optimize deprecation
FSDPv2 refactor + FP8 support
We've simplified how to prepare FSDPv2 models, as there were too many ways to compose FSDP2 with other features (e.g., FP8, torch.compile, activation checkpointing, etc.). Although the setup is now more restrictive, it leads to fewer errors and a more performant user experience. We’ve also added support for FP8. You can read about the results here. Thanks to @S1ro1 for this contribution!
Faster Distributed Training on Intel CPUs
We updated the CCL_WORKER_COUNT variable and added KMP parameters for Intel CPU users. This significantly improves distributed training performance (e.g., Tensor Parallelism), with up to a 40% speed-up on Intel 4th Gen Xeon when training transformer TP models.
- Set ccl and KMP param in simple launch by @jiqing-feng in #3575
Regional Compilation for DeepSpeed
We added support for regional compilation with the DeepSpeed engine. DeepSpeed’s .compile() modifies models in-place using torch.nn.Module.compile(...), rather than the out-of-place torch.compile(...), so we had to account for that. Thanks @IlyasMoutawwakil for this feature!
- Fix deepspeed regional compilation by @IlyasMoutawwakil in #3609
ipex.optimize deprecation
ipex.optimize is being deprecated. Most optimizations have been upstreamed to PyTorch, and future improvements will land there directly. For users without PyTorch 2.8, we’ll continue to rely on IPEX for now.
- remove ipex.optimize in accelerate by @yao-matrix in #3608
Better XPU Support
We've greatly expanded and stabilized support for Intel XPUs:
- enable fsdp2 benchmark on XPU by @yao-matrix in #3590
- enable big_model_inference on xpu by @yao-matrix in #3595
- enable test_load_checkpoint_and_dispatch_with_broadcast cases on XPU by @yao-matrix in
- enable test_cli & test_example cases on XPU by @yao-matrix in #3578
- enable torchao and pippy test cases on XPU by @yao-matrix in #3599
- enable regional_compilation benchmark on xpu by @yao-matrix in #3592
- fix xpu 8bit value loading by @jiqing-feng in #3623
- add device-agnostic GradScaler by @yao-matrix in #3588
- add xpu support in TorchTensorParallelPlugin by @yao-matrix in #3627
Trackers
We've added support for SwanLab as an experiment tracking backend. Huge thanks to @ShaohonChen for this contribution ! We also deferred all tracker initializations to prevent premature setup of distributed environments.
- Integrate SwanLab for offline/online experiment tracking for Accelerate by @ShaohonChen in #3605
- Fix: Defer Tracker Initialization to Prevent Premature Distributed Setup by @yuanjua in #3581
What's Changed
- Fix bf16 training with TP by @SunMarc in #3610
- better handle FP8 with and without deepspeed by @IlyasMoutawwakil in #3611
- Update Gaudi Runners by @IlyasMoutawwakil in #3593
- goodbye torch_ccl by @yao-matrix in #3580
- Add support for standalone mode when default port is occupied on single node by @laitifranz in #3576
- Resolve logger warnings by @emmanuel-ferdman in #3582
- Add kwargs to optimizer, scheduler and dataloader using function
accelerator().load_state()by @luiz0992 in #3540 - [docs] no hard-coded cuda in the ddp documentation by @faaany in #3589
- change to use torch.device by @yao-matrix in #3594
- Fix: list object has no attribute keys by @S1ro1 in #3603
- Update Gaudi Runners by @IlyasMoutawwakil in #3593
- Fix bf16 training with TP by @SunMarc in #3610
- better handle FP8 with and without deepspeed by @IlyasMoutawwakil in #3611
- Remove device_count for TPU launcher to avoid initializing runtime by @sorgfresser in #3587
- Fix missing te.LayerNorm in intel_transformer_engine by @IlyasMoutawwakil in #3619
- Add fp8_e5m2 support in
dtype_byte_sizeby @SunMarc in #3625 - [Deepspeed] deepspeed auto grad accum by @kashif in #3630
- Remove hardcoded cuda from fsdpv2 by @IlyasMoutawwakil in #3631
- Integrate SwanLab for offline/online experiment tracking for Accelerate by @ShaohonChen in #3605
- Fix Typos in Documentation and Comments by @leopardracer in #3621
- feat: use datasets.IterableDataset shard if possible by @SunMarc in #3635
- [DeepSpeed] sync gradient accum steps from deepspeed plugin by @kashif in #3632
- Feat: add cpu offload by @S1ro1 in #3636
- Fix: correct labels for fsdp2 examples by @S1ro1 in #3637
- fix grad acc deepspeed by @SunMarc in #3638
New Contributors
- @laitifranz made their first contribution in #3576
- @emmanuel-ferdman made their first contribution in #3582
- @yuanjua made their first contribution in #3581
- @sorgfresser made their first contribution in #3587
- @ShaohonChen made their first contribution in #3605
- @leopardracer made their first contribution in #3621
Full Changelog: v1.7.0...v1.8.0