deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Add an option to decide whether to store the checkpoint and rng_state.

Open
#4,403 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Recently I've been using deepspeed and transformers simultaneously, and when I set the save_strategy to epoch (or step), it will store the checkpoint (xx.pt), and rng_state automatically. Also, when I set stage3_gather_fp16_weights_on_model_save=true , it will store the pytorch_model.bin. These satisfy our needs in most of the situations.

However, if we train a LLM like llama, the size of the checkpoint on one single GPU can reach 7.5G. So it will be nearly 60G if we use 8 GPUs to train. It has such a high demand for disk space especially when a whole team is using the same server.

I read the source code in trainer.train function in transformers and found that when enabling deepspeed, it automatically stores checkpoint and rng_state, but as I mentioned above, can we choose not to store them and just leave the .bin file? I think we may need a parameter option to decide this.

One solution is that we can divide the save_strategy into smaller parts like save_checkpoint_strategy and save_rng_state_strategy, and when we set them to no, they will not be stored. I think this could be done by changing some if-else code logic in the source code.

Best wishes.

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

Start with the trainer.train entry point in Transformers and trace the DeepSpeed save handling it invokes. Follow where the checkpoint, rng_state, and pytorch_model.bin files are written, along with the existing save controls. Done means users can choose whether checkpoint and RNG-state files are stored without preventing the requested model file from being saved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.