Files
2026-04-30 15:00:27 +02:00

57 lines
2.1 KiB
Python

import folder_paths
from nodes import LoraLoader
class LoraRangeLoaderModelOnly(LoraLoader):
@classmethod
def INPUT_TYPES(cls):
loras = folder_paths.get_filename_list("loras")
return {
"required": {
"model": ("MODEL", {"tooltip": "The diffusion model the LoRA will be applied to."}),
"first": (loras, {"tooltip": "First LoRA in the allowed filename range."}),
"last": (loras, {"tooltip": "Last LoRA in the allowed filename range."}),
"current": (loras, {"tooltip": "The LoRA that will be loaded for the current run."}),
"mode": (
["fixed", "increment", "decrement", "random"],
{"default": "fixed", "tooltip": "How current should change after a run is queued."},
),
"strength_model": (
"FLOAT",
{
"default": 1.0,
"min": -100.0,
"max": 100.0,
"step": 0.01,
"tooltip": "How strongly to modify the diffusion model. This value can be negative.",
},
),
}
}
RETURN_TYPES = ("MODEL",)
OUTPUT_TOOLTIPS = ("The modified diffusion model.",)
FUNCTION = "load_lora_model_only"
CATEGORY = "loaders"
DESCRIPTION = "Loads the current LoRA like Load LoRA (Model Only) and lets the frontend advance through a filename range after each queued run."
SEARCH_ALIASES = ["lora range", "lora sweep", "load lora range", "checkpoint training lora"]
def load_lora_model_only(self, model, first, last, current, mode, strength_model):
del first
del last
del mode
return (self.load_lora(model, None, current, strength_model, 0)[0],)
NODE_CLASS_MAPPINGS = {
"LoraRangeLoaderModelOnly": LoraRangeLoaderModelOnly,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"LoraRangeLoaderModelOnly": "Load LoRA Range (Model Only)",
}
WEB_DIRECTORY = "./web"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]