Lightning-AI / Lightning-AI/pytorch-lightning
BUG when Trainer.test() with deepspeed stage 3
Nobody has claimed this yet.
- 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.

> 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
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
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