(models, weights, output_dir)
| 149 | if version.parse(accelerate.__version__) >= version.parse("0.16.0"): |
| 150 | # create custom saving & loading hooks so that `accelerator.save_state(...)` serializes in a nice format |
| 151 | def save_model_hook(models, weights, output_dir): |
| 152 | for i, model in enumerate(models): |
| 153 | model.save_pretrained(os.path.join(output_dir, "vae")) |
| 154 | # make sure to pop weight so that corresponding model is not saved again |
| 155 | weights.pop() |
| 156 | |
| 157 | accelerator.register_save_state_pre_hook(save_model_hook) |
| 158 |
nothing calls this directly
no test coverage detected