Files
CavinHuang-comfyui-nodes-docs/docs/CheckpointLoaderSimpleWithNoiseSelect.md

86 lines
3.9 KiB
Markdown

# Load Checkpoint w/ Noise Select 🎭🅐🅓
## Documentation
- Class name: CheckpointLoaderSimpleWithNoiseSelect
- Category: Animate Diff 🎭🅐🅓/extras
- Output node: False
- Repo Ref: https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved.git
此节点专门用于加载模型检查点,重点是噪声选择,允许在生成任务中更细致地控制模型的初始化和行为。它通过结合beta计划调整和可选的噪声缩放因子扩展了标准检查点加载功能,以满足高级自定义需求。
## Input types
### Required
- ckpt_name
- 指定要加载的检查点名称。此参数对于从预定义的可用检查点列表中识别特定模型检查点文件至关重要。
- Comfy dtype: COMBO[STRING]
- Python dtype: str
- beta_schedule
- 决定应用于模型的beta计划。此参数允许调整模型的采样行为,增强模型性能的灵活性。
- Comfy dtype: COMBO[STRING]
- Python dtype: str
### Optional
- use_custom_scale_factor
- 一个布尔标志,指示是否应用自定义噪声缩放因子。设置为true时,它可以微调噪声对模型输出的影响。
- Comfy dtype: BOOLEAN
- Python dtype: bool
- scale_factor
- 定义噪声缩放因子的大小,前提是'use_custom_scale_factor'为true。它允许对应用于模型的噪声水平进行精确控制。
- Comfy dtype: FLOAT
- Python dtype: float
## Output types
- model
- Comfy dtype: MODEL
- 加载的模型,按照指定的beta计划和噪声缩放选项进行配置。
- Python dtype: torch.nn.Module
- clip
- Comfy dtype: CLIP
- 如果适用,加载检查点相关的CLIP模型。
- Python dtype: torch.nn.Module
- vae
- Comfy dtype: VAE
- 如果适用,加载检查点相关的VAE模型。
- Python dtype: torch.nn.Module
## Usage tips
- Infra type: GPU
<!-- - Common nodes:
- [LoraLoader](../../Comfy/Nodes/LoraLoader.md)
- [CLIPTextEncode](../../Comfy/Nodes/CLIPTextEncode.md)
- [ADE_AnimateDiffLoaderWithContext](../../ComfyUI-AnimateDiff-Evolved/Nodes/ADE_AnimateDiffLoaderWithContext.md)
- [BatchPromptSchedule](../../ComfyUI_FizzNodes/Nodes/BatchPromptSchedule.md)
- [CLIPSetLastLayer](../../Comfy/Nodes/CLIPSetLastLayer.md)
- [Lora Loader Stack (rgthree)](../../rgthree-comfy/Nodes/Lora Loader Stack (rgthree).md)
- IPAdapterApply
- [ToBasicPipe](../../ComfyUI-Impact-Pack/Nodes/ToBasicPipe.md) -->
## Source code
```python
class CheckpointLoaderSimpleWithNoiseSelect:
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"ckpt_name": (folder_paths.get_filename_list("checkpoints"), ),
"beta_schedule": (BetaSchedules.ALIAS_LIST, {"default": BetaSchedules.USE_EXISTING}, )
},
"optional": {
"use_custom_scale_factor": ("BOOLEAN", {"default": False}),
"scale_factor": ("FLOAT", {"default": 0.18215, "min": 0.0, "max": 1.0, "step": 0.00001})
}
}
RETURN_TYPES = ("MODEL", "CLIP", "VAE")
FUNCTION = "load_checkpoint"
CATEGORY = "Animate Diff 🎭🅐🅓/extras"
def load_checkpoint(self, ckpt_name, beta_schedule, output_vae=True, output_clip=True, use_custom_scale_factor=False, scale_factor=0.18215):
ckpt_path = folder_paths.get_full_path("checkpoints", ckpt_name)
out = load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
# register chosen beta schedule on model - convert to beta_schedule name recognized by ComfyUI
new_model_sampling = BetaSchedules.to_model_sampling(beta_schedule, out[0])
if new_model_sampling is not None:
out[0].model.model_sampling = new_model_sampling
if use_custom_scale_factor:
out[0].model.latent_format.scale_factor = scale_factor
return out