Model saved using deepspeed and accelerate cannot be loaded or incomeplete
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.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Hey @manitadayon If you're running your training using several GPUS, this looks like an issue with saving only the shards from one of your GPUs. I believe if you use the following syntax you should be able to save the model completely and your issue should disappear!
if accelerator.is_main_process:
model = ...
accelerator.save_model(trainer.model, model_path)
tokenizer.save_pretrained(model_path)