(cls, model, lora_name, strength_model)
| 497 | |
| 498 | @classmethod |
| 499 | def execute(cls, model, lora_name, strength_model) -> io.NodeOutput: |
| 500 | lora_path = folder_paths.get_full_path_or_raise("loras", lora_name) |
| 501 | |
| 502 | # Load lora and extract metadata |
| 503 | lora, metadata = comfy.utils.load_torch_file( |
| 504 | lora_path, safe_load=True, return_metadata=True |
| 505 | ) |
| 506 | |
| 507 | # Extract latent_downscale_factor from metadata |
| 508 | try: |
| 509 | latent_downscale_factor = float(metadata["reference_downscale_factor"]) |
| 510 | except (KeyError, ValueError, TypeError): |
| 511 | latent_downscale_factor = 1.0 |
| 512 | logging.warning( |
| 513 | "Failed to extract reference_downscale_factor from metadata for %s, using 1.0", |
| 514 | lora_path, |
| 515 | ) |
| 516 | |
| 517 | if strength_model == 0: |
| 518 | return io.NodeOutput(model, latent_downscale_factor) |
| 519 | |
| 520 | model_lora, _ = comfy.sd.load_lora_for_models( |
| 521 | model, None, lora, strength_model, 0 |
| 522 | ) |
| 523 | return io.NodeOutput(model_lora, latent_downscale_factor) |
| 524 | |
| 525 | |
| 526 | def _patchify_audio_latent(latent): |
nothing calls this directly
no outgoing calls
no test coverage detected