deepspeedai / deepspeedai/DeepSpeedExamples
How to save the intermediate model?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.8k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 1
Description
The current implement only saves the model after all the epochs finishes.
DeepSpeedExamples/applications/DeepSpeed-Chat/training/step3_rlhf_finetuning/main.py
if args.output_dir is not None:
print_rank_0("saving model ...", args.global_rank)
rlhf_engine.actor = convert_lora_to_linear_layer(rlhf_engine.actor)
rlhf_engine.critic = convert_lora_to_linear_layer(rlhf_engine.critic)
if args.enable_ema:
rlhf_engine.actor_ema = convert_lora_to_linear_layer(
rlhf_engine.actor_ema)
if torch.distributed.get_rank() == 0:
save_hf_format(rlhf_engine.actor,
tokenizer,
args,
sub_folder="actor")
save_hf_format(rlhf_engine.critic,
tokenizer,
args,
sub_folder="critic")
if args.enable_ema:
save_hf_format(rlhf_engine.actor_ema,
tokenizer,
args,
sub_folder="actor_ema")
if args.actor_zero_stage == 3:
save_zero_three_model(rlhf_engine.actor,
global_rank=args.global_rank,
save_dir=os.path.join(
args.output_dir, "actor"),
zero_stage=args.actor_zero_stage)
if args.enable_ema:
save_zero_three_model(rlhf_engine.actor_ema,
global_rank=args.global_rank,
save_dir=os.path.join(
args.output_dir, "actor_ema"),
zero_stage=args.actor_zero_stage)
if args.critic_zero_stage == 3:
save_zero_three_model(rlhf_engine.critic,
global_rank=args.global_rank,
save_dir=os.path.join(
args.output_dir, "critic"),
zero_stage=args.critic_zero_stage)
How can we save the model weigths during some intermediate epochs?
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 applications/DeepSpeed-Chat/training/step3_rlhf_finetuning/main.py at the cited lines 477-517, then trace the training loop and its epoch boundaries. Determine where intermediate model weights should be saved alongside the existing final save path; done means actor, critic, and any enabled EMA weights are saved during training without disrupting the current final save.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100