Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,14 @@ model_file = hf_hub_download(
|
|
| 29 |
"xinsir/controlnet-union-sdxl-1.0",
|
| 30 |
filename="diffusion_pytorch_model_promax.safetensors",
|
| 31 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
state_dict = load_state_dict(model_file)
|
| 33 |
-
loaded_keys = list(state_dict.keys())
|
| 34 |
model, _, _, _, _ = ControlNetModel_Union._load_pretrained_model(
|
| 35 |
controlnet_model, state_dict, loaded_keys, model_file, "xinsir/controlnet-union-sdxl-1.0"
|
| 36 |
)
|
|
|
|
| 29 |
"xinsir/controlnet-union-sdxl-1.0",
|
| 30 |
filename="diffusion_pytorch_model_promax.safetensors",
|
| 31 |
)
|
| 32 |
+
|
| 33 |
+
# Create patched version that includes the loaded_keys parameter
|
| 34 |
+
def patched_load_pretrained(self, pretrained_model_name_or_path, **kwargs):
|
| 35 |
+
if 'loaded_keys' not in kwargs:
|
| 36 |
+
kwargs['loaded_keys'] = set()
|
| 37 |
+
return original_load_pretrained(self, pretrained_model_name_or_path, **kwargs)
|
| 38 |
+
|
| 39 |
state_dict = load_state_dict(model_file)
|
|
|
|
| 40 |
model, _, _, _, _ = ControlNetModel_Union._load_pretrained_model(
|
| 41 |
controlnet_model, state_dict, loaded_keys, model_file, "xinsir/controlnet-union-sdxl-1.0"
|
| 42 |
)
|