(models, input_dir)
| 840 | i -= 1 |
| 841 | |
| 842 | def load_model_hook(models, input_dir): |
| 843 | while len(models) > 0: |
| 844 | # pop models so that they are not loaded again |
| 845 | model = models.pop() |
| 846 | |
| 847 | # load diffusers style into model |
| 848 | load_model = ControlNetModel.from_pretrained(input_dir, subfolder="controlnet") |
| 849 | model.register_to_config(**load_model.config) |
| 850 | |
| 851 | model.load_state_dict(load_model.state_dict()) |
| 852 | del load_model |
| 853 | |
| 854 | accelerator.register_save_state_pre_hook(save_model_hook) |
| 855 | accelerator.register_load_state_pre_hook(load_model_hook) |
nothing calls this directly
no test coverage detected