Lightning-AI / Lightning-AI/pytorch-lightning

BUG when Trainer.test() with deepspeed stage 3

Open
#14,090 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted repro needed strategy: deepspeed
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

## 🐛 Bug

Hi, I meet some bugs when I combine lightning with deepspeed follow https://pytorch-lightning.readthedocs.io/en/latest/common/trainer.html#trainer-class-api.

I find that:

- Trainer.fit() is compatible well with deepspeed stage 2 and 3 .
- Trainer.test() is compatible with deepspeed stage 2.
- There is some bugs when combine Trainer.test() with deepspeed stage 3:

> When initialize DeepSpeedStrategy with deepspeed config and then test, I will encounter this bug, I have tried to change the config, but this bug is exsited whatever.

![image](https://user-images.githubusercontent.com/75015153/183438575-8a104f41-a773-4d24-bd0e-647171f71b2f.png)

> When initialize DeepSpeedStrategy with lightning args, I will encounter two problems, the generate speed is too slow (I used huggingface transformers and their generate() method) than the deepspeed inference scripts in https://www.deepspeed.ai/tutorials/inference-tutorial/. In addition, I also meet a bug called index of range because of self.__step of deepspeed engine.

> Hope for better compatibility between lightning and deepspeed !

cc @awaelchli @rohitgr7 @akihironitta

Contributor guide

Open the contributing guide

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

The issue provides no repository files or tests to inspect. Start by reproducing Trainer.test() with DeepSpeed stage 3, comparing the reported behavior with stage 2 and the DeepSpeed inference tutorial; done means the test path no longer triggers the reported error or severe generation slowdown.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python, pytorch
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.