checkpointing not saving model weights if calling accelerator.prepare_model
instead of accelerator.prepare
#555
Labels
bug
Something isn't working
System Info
Information
Tasks
no_trainer
script in theexamples
folder of thetransformers
repo (such asrun_no_trainer_glue.py
)Reproduction
if we separately prepare the model (i.e.
model = accelerator.prepare_model(model)
) instead of preparing all at once (model, optimizer, train_dataloader, eval_dataloader, lr_scheduler = accelerator.prepare(model, optimizer, train_dataloader, eval_dataloader, lr_scheduler)
), accelerator won't save model weights using theaccelerator.save_states
possible problem: accelerator internally use
_prepare_one
in theprepare(self, *args)
method to append the model toself._models
, but theprepare_model(self, model)
does not append the model, see here. However,accelerator.save_states
depends onself._models
to save model weightsExpected behavior
The text was updated successfully, but these errors were encountered: