Skip to content

Conversation

SkafteNicki
Copy link
Collaborator

@SkafteNicki SkafteNicki commented Aug 13, 2025

What does this PR do?

Fixes #20949
Add new argument exclude_frozen_parameters to DeepSpeed strategy that add support for saving checkpoints without frozen parameters. See the linked issue for explanation why this may be beneficial.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--21060.org.readthedocs.build/en/21060/

@SkafteNicki SkafteNicki self-assigned this Aug 13, 2025
@SkafteNicki SkafteNicki added the feature Is an improvement or enhancement label Aug 13, 2025
@github-actions github-actions bot added fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package labels Aug 13, 2025
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87%. Comparing base (c3ca8a5) to head (69dae7c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21060   +/-   ##
=======================================
- Coverage      87%      87%   -0%     
=======================================
  Files         269      269           
  Lines       23574    23594   +20     
=======================================
+ Hits        20561    20577   +16     
- Misses       3013     3017    +4     

@Borda
Copy link
Contributor

Borda commented Sep 2, 2025

the failign tests are without installed deepspeed

-- Process 0 terminated with the following error:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/multiprocessing/spawn.py", line 68, in _wrap
    fn(i, *args)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/pytorch/strategies/launchers/multiprocessing.py", line 173, in _wrapping_function
    results = function(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/pytorch/trainer/trainer.py", line 604, in _fit_impl
    self._run(model, ckpt_path=ckpt_path)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/pytorch/trainer/trainer.py", line 973, in _run
    self.strategy.setup_environment()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/pytorch/strategies/ddp.py", line 154, in setup_environment
    self.setup_distributed()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/pytorch/strategies/ddp.py", line 206, in setup_distributed
    _init_dist_connection(self.cluster_environment, self._process_group_backend, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightning/fabric/utilities/distributed.py", line 298, in _init_dist_connection
    torch.distributed.init_process_group(torch_distributed_backend, rank=global_rank, world_size=world_size, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/distributed/c10d_logger.py", line 86, in wrapper    func_return = func(*args, **kwargs)                  ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/distributed/distributed_c10d.py", line 1184, in init_process_group
    default_pg, _ = _new_process_group_helper(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torch/distributed/distributed_c10d.py", line 1298, in _new_process_group_helper
    backend_class = ProcessGroupGloo(backend_prefix_store, group_rank, group_size, timeout=timeout)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: [enforce fail at /Users/runner/work/pytorch/pytorch/pytorch/third_party/gloo/gloo/transport/uv/device.cc:153] rp != nullptr. Unable to find address for: Mac-1756811454320.local

@github-actions github-actions bot added the ci Continuous Integration label Sep 2, 2025
@Borda Borda merged commit 5071a04 into Lightning-AI:master Sep 2, 2025
121 checks passed
Borda pushed a commit that referenced this pull request Sep 3, 2025
* add to deepspeed strategies
* add testing
* changelog
* GLOO_SOCKET_IFNAME

---------

Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Jirka B <[email protected]>

(cherry picked from commit 5071a04)
lantiga pushed a commit that referenced this pull request Sep 5, 2025
* add to deepspeed strategies
* add testing
* changelog
* GLOO_SOCKET_IFNAME

---------

Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Jirka B <[email protected]>

(cherry picked from commit 5071a04)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration fabric lightning.fabric.Fabric feature Is an improvement or enhancement pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for DeepSpeed's exclude_frozen_parameters argument in DeepSpeedStrategy
2 participants