Skip to content

Eff. Loader SDXL

Documentation

  • Class name: Eff. Loader SDXL
  • Category: Efficiency Nodes/Loaders
  • Output node: False

The Eff. Loader SDXL node is designed to efficiently load and prepare models and data for the SDXL (Super Diffusion XL) process. It handles the initialization and configuration of base and refiner models, clip skipping, aesthetic scoring, and various other parameters to optimize the loading process for enhanced performance and efficiency in generative tasks.

Input types

Required

  • base_ckpt_name
    • Specifies the checkpoint name for the base model, crucial for initializing the model with pre-trained weights.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: str
  • base_clip_skip
    • Determines the number of clip layers to skip in the base model, affecting the model's performance and output quality.
    • Comfy dtype: INT
    • Python dtype: int
  • refiner_ckpt_name
    • Defines the checkpoint name for the refiner model, enabling the enhancement of generated outputs through refinement.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: str
  • refiner_clip_skip
    • Indicates the number of clip layers to skip in the refiner model, optimizing the refinement process.
    • Comfy dtype: INT
    • Python dtype: int
  • positive_ascore
    • The aesthetic score for positive feedback, used to guide the model towards generating more appealing outputs.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • negative_ascore
    • The aesthetic score for negative feedback, helping to steer the model away from less desirable outputs.
    • Comfy dtype: FLOAT
    • Python dtype: float
  • vae_name
    • The name of the VAE used in the process, essential for the model's data encoding and decoding.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: str
  • positive
    • Positive input data or conditions, used to direct the model towards specific generative goals.
    • Comfy dtype: STRING
    • Python dtype: str
  • negative
    • Negative input data or conditions, used to avoid certain patterns or themes in the generated outputs.
    • Comfy dtype: STRING
    • Python dtype: str
  • token_normalization
    • Controls the normalization of tokens, impacting the model's interpretation and processing of input data.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: bool
  • weight_interpretation
    • Adjusts how the model interprets the weighting of different inputs, affecting the balance between positive and negative feedback.
    • Comfy dtype: COMBO[STRING]
    • Python dtype: bool
  • empty_latent_width
    • Specifies the width of the empty latent space, configuring the dimensions for model initialization.
    • Comfy dtype: INT
    • Python dtype: int
  • empty_latent_height
    • Defines the height of the empty latent space, setting up the spatial dimensions for the generative process.
    • Comfy dtype: INT
    • Python dtype: int
  • batch_size
    • The number of samples to process in a single batch, influencing the efficiency and speed of the loading operation.
    • Comfy dtype: INT
    • Python dtype: int

Optional

  • lora_stack
    • Optional LoRA stack configuration, enhancing model performance with LoRA (Low-Rank Adaptation) techniques.
    • Comfy dtype: LORA_STACK
    • Python dtype: str
  • cnet_stack
    • Optional ControlNet stack configuration, further refining the model's output through controlled network adjustments.
    • Comfy dtype: CONTROL_NET_STACK
    • Python dtype: str

Output types

  • SDXL_TUPLE
    • Comfy dtype: SDXL_TUPLE
    • A tuple containing the base and refiner models, clips, and encoded positive and negative feedback, ready for the SDXL process.
    • Python dtype: tuple
  • LATENT
    • Comfy dtype: LATENT
    • The latent space samples generated by the VAE, essential for the generative process.
    • Python dtype: dict
  • VAE
    • Comfy dtype: VAE
    • The VAE model used in the process, crucial for encoding and decoding data.
    • Python dtype: object
  • DEPENDENCIES
    • Comfy dtype: DEPENDENCIES
    • A collection of dependencies required for the operation, including model names, clip information, and configuration parameters.
    • Python dtype: tuple

Usage tips

Source code

class TSC_EfficientLoaderSDXL(TSC_EfficientLoader):

    @classmethod
    def INPUT_TYPES(cls):
        return {"required": { "base_ckpt_name": (folder_paths.get_filename_list("checkpoints"),),
                              "base_clip_skip": ("INT", {"default": -2, "min": -24, "max": -1, "step": 1}),
                              "refiner_ckpt_name": (["None"] + folder_paths.get_filename_list("checkpoints"),),
                              "refiner_clip_skip": ("INT", {"default": -2, "min": -24, "max": -1, "step": 1}),
                              "positive_ascore": ("FLOAT", {"default": 6.0, "min": 0.0, "max": 1000.0, "step": 0.01}),
                              "negative_ascore": ("FLOAT", {"default": 2.0, "min": 0.0, "max": 1000.0, "step": 0.01}),
                              "vae_name": (["Baked VAE"] + folder_paths.get_filename_list("vae"),),
                              "positive": ("STRING", {"default": "CLIP_POSITIVE", "multiline": True}),
                              "negative": ("STRING", {"default": "CLIP_NEGATIVE", "multiline": True}),
                              "token_normalization": (["none", "mean", "length", "length+mean"],),
                              "weight_interpretation": (["comfy", "A1111", "compel", "comfy++", "down_weight"],),
                              "empty_latent_width": ("INT", {"default": 1024, "min": 64, "max": MAX_RESOLUTION, "step": 64}),
                              "empty_latent_height": ("INT", {"default": 1024, "min": 64, "max": MAX_RESOLUTION, "step": 64}),
                              "batch_size": ("INT", {"default": 1, "min": 1, "max": 64})},
                "optional": {"lora_stack": ("LORA_STACK", ), "cnet_stack": ("CONTROL_NET_STACK",),},
                "hidden": { "prompt": "PROMPT", "my_unique_id": "UNIQUE_ID",},
                }

    RETURN_TYPES = ("SDXL_TUPLE", "LATENT", "VAE", "DEPENDENCIES",)
    RETURN_NAMES = ("SDXL_TUPLE", "LATENT", "VAE", "DEPENDENCIES", )
    FUNCTION = "efficientloaderSDXL"
    CATEGORY = "Efficiency Nodes/Loaders"

    def efficientloaderSDXL(self, base_ckpt_name, base_clip_skip, refiner_ckpt_name, refiner_clip_skip, positive_ascore,
                            negative_ascore, vae_name, positive, negative, token_normalization, weight_interpretation,
                            empty_latent_width, empty_latent_height, batch_size, lora_stack=None, cnet_stack=None,
                            prompt=None, my_unique_id=None):
        clip_skip = (base_clip_skip, refiner_clip_skip)
        lora_name = "None"
        lora_model_strength = lora_clip_strength = 0
        return super().efficientloader(base_ckpt_name, vae_name, clip_skip, lora_name, lora_model_strength, lora_clip_strength,
                        positive, negative, token_normalization, weight_interpretation, empty_latent_width, empty_latent_height,
                        batch_size, lora_stack=lora_stack, cnet_stack=cnet_stack, refiner_name=refiner_ckpt_name,
                        ascore=(positive_ascore, negative_ascore), prompt=prompt, my_unique_id=my_unique_id, loader_type="sdxl")