From 97610e89b5d7afd3c4ecc06bd2ac4efdb04b33f3 Mon Sep 17 00:00:00 2001 From: AbstractPhil Date: Fri, 27 Jun 2025 11:55:36 -0700 Subject: [PATCH] functional v1 with multiple tested working nodes and readme --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++-- __init__.py | 11 +++++++++++ node/lycoris_loader.py | 2 +- node/lycoris_merger.py | 0 requirements.txt | 1 + 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 node/lycoris_merger.py create mode 100644 requirements.txt diff --git a/README.md b/README.md index 89e17df..8d1f61a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,40 @@ -# comfyui-lycoris -A properly implemented lycoris loader for comfyui. +# ComfyUI Lycoris Implementation V1 +___ + +* This implementation is built to specifically address the LYCORIS modules not correctly loading into the ComfyUI structure. +* Each node is designed to handle the specific functionality of the LYCORIS modules. +* Precomputation is crucial for the functionality of these nodes, as the additive nature of the sampler system in ComfyUI demands linear and specific rules. +* The nodes are designed to be used in a specific order to ensure that the precomputation is done correctly. + +* Tested: +* * LOHA - Functionally loads and works as expected. +* * Locon - Functionally loads and works as expected. +* * Lokr - Semi tested, but requires further testing. +* * Boft - untested, but likely requires precomputation mixed with runtime computation against the target model. +* * Oft - untested, likely requires precomputation mixed with runtime computation against the target model. +* * glora - untested, unlikely to need runtime computation. +* * blora - untested, uncertain if it requires runtime computation. + +# Usage +___ +* LoadLycorisNode: This node is used to load the LYCORIS modules into the ComfyUI structure. +* * This node is built specifically to handle precomputation of the LYCORIS modules within a cached structure. + +* PrecomputeSaveLycorisNode: This node is built to handle runtime distillation and saving of lycoris into a precomputed form. +* * Warning, they can get very bloated and very large after precomputation. + +* Precomputed lycoris are essentially treated as standard loras. They do not require additional traits and can be loaded at runtime, however their size varies greatly from their current form. + +# Installing +___ +* Until a package is created you can clone the repo and move it into your custom_nodes directory. + +# Limitations +___ +* Tested primarily with SDXL on ComfyUI +* The nodes are designed to work with the LYCORIS modules and may not function correctly with other modules. +* The default LORA fallback may malfunction or malform your lora during precomputation, so it is recommended to use standard lora loader if you get malformed responses from standard loras. + +# Licensing +___ +Apache License 2.0 is included in the repository. \ No newline at end of file diff --git a/__init__.py b/__init__.py index e69de29..cf822e4 100644 --- a/__init__.py +++ b/__init__.py @@ -0,0 +1,11 @@ +from .node.lycoris_loader import ( + LycorisLoaderNode, +) + +NODE_CLASS_MAPPINGS = { + "LycorisLoaderNode": LycorisLoaderNode, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "LycorisLoaderNode": "LyCORIS Loader", +} diff --git a/node/lycoris_loader.py b/node/lycoris_loader.py index 86d6322..40ffa89 100644 --- a/node/lycoris_loader.py +++ b/node/lycoris_loader.py @@ -8,7 +8,7 @@ import comfy.lora_convert import comfy.model_patcher # Import custom implementations -from ..weight_adapter.load_lora import load_lora, model_lora_keys_unet, model_lora_keys_clip +from ..module.load_lora import load_lora, model_lora_keys_unet, model_lora_keys_clip logger = logging.getLogger(__name__) diff --git a/node/lycoris_merger.py b/node/lycoris_merger.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..08ed5ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +torch \ No newline at end of file