Lightning-AI / Lightning-AI/lit-llama
How to use deepspeed zero-3-offload strategy correctly? (Parameters Duplication Issue)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.1k
- Forks
- 517
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I wonder how to write the code for using the deepspeed zero-3-offload strategy correctly. Currently, my code looks like:
```
from lightning.fabric.strategies import DeepSpeedStrategy
deep_speed = DeepSpeedStrategy(
stage=3,
offload_optimizer=True,
offload_parameters=True,
)
fabric = L.Fabric(accelerator="gpu", devices=num_devices,strategy=deep_speed)
```
However, it seems the parameters are duplicated for all gpu. I attached the screenshot to show the GPU utilization after `model, optimizer = fabric.setup(model, optimizer)`:

According to my understanding, the parameters should be distributed on different devices, right?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the shown DeepSpeedStrategy configuration and the call to fabric.setup(model, optimizer). Reproduce the reported GPU utilization and inspect how parameters are allocated across devices after setup. Done means the behavior is explained and the documented or corrected configuration prevents unintended parameter duplication.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100