deepspeedai / deepspeedai/DeepSpeed

Model saved from deepspeed and accelerate cannot be loaded or incomeplete

Open
#7,490 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I train/fine-tune the Mistral-24B small model (mistralai/Mistral-Small-24B-Instruct-2501) using deepspeed and accelerate
and I saved the model using following commands:

if accelerator.is_main_process:
      model =accelerator.unwrap_model(trainer.model)
      model.save_pretrained(model_path)
      tokenizer.save_pretrained(model_path)

However when I try to load the model using
AutoModelForCausalLM.from_pretrained(model_path)
I got weight mismatch size error.

This is how the folder look like can

folder/
         chat_template.jinja
         config.json
         generate_config.json
         model.safetensors
         special_tokens_map.json
         tokenizer_config.json
         tokenizer.json

Can anyone tell me what is going on here and how to solve the problem.

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 by reproducing the save flow using DeepSpeed and Accelerate, including accelerator.unwrap_model(trainer.model), model.save_pretrained(model_path), and AutoModelForCausalLM.from_pretrained(model_path). Compare the saved folder contents and reported weight-mismatch sizes to determine whether the model can be loaded completely; done means the saved Mistral-Small-24B-Instruct-2501 model loads successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
distributed-systems, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.