diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Should I do 'accelerator.prepare()' again after 'accelerator.unwrap_model()' ?

Open DtYXs opened this issue 3 years ago • 3 comments

For multi-gpu training: model = accelerator.prepare(model) I want to save ckpt during training. Then I do this: model = accelerator.unwrap_model(model) pipeline = Pipeline(model=model) pipeline.save_pretrained(...) And I want to continue training. Should I do model = accelerator.prepare(model) again after saving?

DtYXs avatar Dec 29 '22 07:12 DtYXs

cc @patil-suraj @pcuenca

patrickvonplaten avatar Jan 05 '23 21:01 patrickvonplaten

@DtYXs checkpointing is now added to all scripts, for example, #1668.

And to answer your question, you should not assign unwrapped model to model; instead, we could directly pass accelerator.unwrap_model(model) to pipeline or use a different variable name.

patil-suraj avatar Jan 23 '23 10:01 patil-suraj

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.

github-actions[bot] avatar Feb 16 '23 15:02 github-actions[bot]