Skip to content

Files

Latest commit

87faf3d · Dec 15, 2024

History

History
66 lines (57 loc) · 2.45 KB

README.md

File metadata and controls

66 lines (57 loc) · 2.45 KB

Models

Checkpoints

Any checkpoint format supported by ComfyUI will work, including .ckpt, .pt, .bin, .pth and .safetensors.

List all checkpoints:

from comfy_script.runtime import load
load()
from comfy_script.runtime.nodes import Checkpoints

print(list(Checkpoints))
# [<Checkpoints.Anything_V3_0: 'Anything-V3.0.ckpt'>, <Checkpoints.Realistic_Vision_V5_1_fp16_no_ema: 'Realistic_Vision_V5.1_fp16-no-ema.safetensors'>, ..., <Checkpoints.wd_illusion_fp16: 'wd-illusion-fp16.safetensors'>]
def CivitAICheckpointLoader(
    ckpt_air: str = '{model_id}@{model_version}',
    ckpt_name: CivitAICheckpointLoader.ckpt_name = 'none',
    download_chunks: int | None = 4,
    download_path: CivitAICheckpointLoader.download_path | None = r'models\checkpoints'
) -> tuple[Model, Clip, Vae]

Examples:

model, clip, vae = CivitAICheckpointLoader('101055@128078')
model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055?modelVersionId=128078')
model, clip, vae = CivitAICheckpointLoader('https://civitai.com/models/101055/sd-xl?modelVersionId=128078')

Saving checkpoints

The CheckpointSave node can be used to save a checkpoint.

For example:

with Workflow():
    model, clip, vae = CheckpointLoaderSimple('v1-5-pruned-emaonly.ckpt')
    CheckpointSave(model, clip, vae, 'checkpoints/new-model')

The checkpoint will be saved to the output directory, e.g. D:\ComfyUI\output\checkpoints\new-model_00001_.safetensors.

LoRA

def CivitAILoraLoader(
    model: Model,
    clip: Clip,
    lora_air: str = '{model_id}@{model_version}',
    lora_name: CivitAILoraLoader.lora_name = 'none',
    strength_model: float = 1.0,
    strength_clip: float = 1.0,
    download_chunks: int | None = 4,
    download_path: CivitAILoraLoader.download_path | None = r'models\loras'
) -> tuple[Model, Clip]

Examples:

model, clip = CivitAILoraLoader(model, clip, '350450@391994', strength_clip=1, strength_model=1)
model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450?modelVersionId=391994', strength_clip=1, strength_model=1)
model, clip = CivitAILoraLoader(model, clip, 'https://civitai.com/models/350450/sdxl-lightning-lora-2step?modelVersionId=391994', strength_clip=1, strength_model=1)

Flux

See Flux Examples.