mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-17 03:48:36 +08:00
Remove module level lora CACHE and a long module docstring.
Some checks failed
Build package / Build Test (3.10) (push) Has been cancelled
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
Some checks failed
Build package / Build Test (3.10) (push) Has been cancelled
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Build package / Build Test (3.11) (push) Has been cancelled
Build package / Build Test (3.12) (push) Has been cancelled
Build package / Build Test (3.13) (push) Has been cancelled
Build package / Build Test (3.14) (push) Has been cancelled
This commit is contained in:
parent
9d5ae9e731
commit
5bdfd5e7fb
@ -1,18 +1,3 @@
|
|||||||
"""LoRA stacking loaders built on io.DynamicGroup.
|
|
||||||
|
|
||||||
Two nodes that let you stack any number of LoRAs in a single node, each row
|
|
||||||
carrying only a LoRA name and a strength:
|
|
||||||
|
|
||||||
LoadLoraModel
|
|
||||||
Applies a stack of LoRAs to a diffusion MODEL.
|
|
||||||
|
|
||||||
LoadLoraTextEncoder
|
|
||||||
Applies a stack of LoRAs to a CLIP text encoder.
|
|
||||||
|
|
||||||
Both are modelled on DynamicGroupLoraStyleTest in nodes_dynamic_group_test.py,
|
|
||||||
but operate on real models and real LoRA files.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
@ -22,18 +7,10 @@ import comfy.utils
|
|||||||
import folder_paths
|
import folder_paths
|
||||||
from comfy_api.latest import ComfyExtension, io
|
from comfy_api.latest import ComfyExtension, io
|
||||||
|
|
||||||
# Module-level cache so repeated executions don't re-read the same file from disk.
|
|
||||||
_LORA_CACHE: dict[str, tuple] = {}
|
|
||||||
|
|
||||||
|
|
||||||
def _load_lora_file(lora_name: str):
|
def _load_lora_file(lora_name: str):
|
||||||
lora_path = folder_paths.get_full_path_or_raise("loras", lora_name)
|
lora_path = folder_paths.get_full_path_or_raise("loras", lora_name)
|
||||||
cached = _LORA_CACHE.get(lora_path)
|
return comfy.utils.load_torch_file(lora_path, safe_load=True, return_metadata=True)
|
||||||
if cached is not None:
|
|
||||||
return cached
|
|
||||||
lora, metadata = comfy.utils.load_torch_file(lora_path, safe_load=True, return_metadata=True)
|
|
||||||
_LORA_CACHE[lora_path] = (lora, metadata)
|
|
||||||
return lora, metadata
|
|
||||||
|
|
||||||
|
|
||||||
def _lora_template() -> list[io.Input]:
|
def _lora_template() -> list[io.Input]:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user