Lightning-AI / Lightning-AI/lit-llama

How to use deepspeed zero-3-offload strategy correctly? (Parameters Duplication Issue)

Open
#84 12 comments 0 reactions 0 assignees View on GitHub

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)`:

![Selection_282](https://user-images.githubusercontent.com/62070113/229383309-f8129e35-8c92-4738-9152-6082188000a3.png)

According to my understanding, the parameters should be distributed on different devices, right?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.