Nodes/ComfyUI-COF/🧬 COF Identity Weights · Apply LoRA
ComfyUI Node

🧬 COF Identity Weights · Apply LoRA

The character's LoRA, at the weight its author recommended

By yannsouetre·Created 17 days ago·Updated a day ago· 1
🧬 COF Identity Weights · Apply LoRA
  • model
  • clip
  • cof
  • model
  • clip
  • trigger_words
◄strength-1.00►

What it does, in one sentence

It pulls the LoRA that's packed inside the .cof file out to disk, applies it to your model and clip, and hands you the trigger words so you don't have to remember them.

That's the whole pitch, and it's actually a good one. Character LoRAs are the reliable answer to consistency - a small adapter trained on 15–25 images, baked into the weights rather than bolted on at inference - and the two things people fumble with a character LoRA are the strength and the trigger. This node takes both from the file's own spec: recommended_weight if you leave strength at its default, and the trigger words as a STRING output.

How it works

The node asks the reader for the preset's identity weights of kind lora, lycoris and dora. For each one it reads the accompanying spec JSON: which asset is the actual .safetensors, what base model it was trained on, the recommended weight, the trigger words.

Then it extracts. The file is pulled out of the zip into ComfyUI/temp/cof/<file-stem>/ - under a temp path, so re-runs are cheap but you shouldn't treat that location as a library - and loaded with ComfyUI's own load_torch_file(..., safe_load=True). A .safetensors with a corrupt header is refused rather than half-loaded. The LoRA is applied with load_lora_for_models(model, clip, sd, strength, strength) - note that the same number hits both the unet and the text encoder, which is normal for LoraLoader but does mean high values will scramble your prompt adherence, not just your image.

strength is a FLOAT from -1 to 2, step 0.05, default -1, and -1 is a sentinel, not a negative weight: it means "use the weight recommended in the file". Anything from 0 upward overrides it. So if the character looks overbaked, the fix isn't to crank this node - set something like 0.65 and see, or leave it at -1 and trust the author's number first.

It also prints what it's doing, including the base model name of each weight. Watch that line. Base-model mismatch is absolute in LoRA land: an SDXL character LoRA on a Flux checkpoint does not degrade gracefully, it does nothing useful at all.

One more behaviour worth knowing: if the file marks the character as a real person with no consent record, the node prints a warning to console and carries on - it warns rather than blocks. The pack's stated position is that you're responsible for that use. That's the right call for a tool, and also a reminder that info from the loader is worth reading before you generate 400 images of someone.

Inputs and outputs

Required: model (MODEL), clip (CLIP), cof, strength.

  • model / clip - the patched pair, wire into your sampler and your text encoder respectively. Classic chain position: CheckpointLoaderSimple → COFApplyLoRA → KSampler with the clip side going to CLIPTextEncode.
  • trigger_words - the file's trigger words, comma-joined. Concatenate into your positive prompt. The loader's prompt output already includes them, so if you're using that, don't add them twice - a doubled trigger token is one of the more confusing ways to make a character look wrong.

If the preset has no identity weights at all, the node passes model and clip through untouched and returns an empty string. It doesn't error. Which is considerate, and also means a typo'd preset silently gives you the base model.

Install

Nothing special: no pip install, no requirements file, dependencies declared empty in pyproject.toml. The LoRA itself arrives inside the .cof, which is the point.

cd ComfyUI/custom_nodes
git clone https://github.com/yannsouetre/ComfyUI-COF

.cof files in ComfyUI/models/cof/ or ComfyUI/input/cof/, restart, press R for new files. The pack ships workflows/cof_txt2img_api.json, which is this node wired between a checkpoint and a KSampler - set your checkpoint first, and if the character's LoRA was trained on a different architecture than your checkpoint, expect nothing.

Common issues

Output looks nothing like the character. In order of likelihood: your checkpoint's architecture doesn't match the weight's base model (read the console line the node prints); the trigger words aren't in the prompt; or the preset is one the LoRA was never trained for - a preset that changes age or style drastically can fall outside what a character LoRA learned.

Overcooked, waxy, prompt ignored. Drop strength to 0.6–0.8. Remember the same value goes to the text encoder, so a strength that flatters the image can still flatten your prompt.

"asset … is a link: download it yourself". Some .cof files reference weights by URI instead of embedding them. Nothing the node can do - fetch that file and put it in your models/loras and use a normal LoraLoader instead.

A permission error on the temp folder. The extract target is ComfyUI/temp/cof/; if that path isn't writable by the ComfyUI process, extraction fails before the LoRA ever loads.

CategoryCOF

Inputs (4)

NameTypeDefaultDescription
modelMODEL—
clipCLIP—
cofCOF—
strengthFLOAT-1.00-1–2-1 = the weight recommended in the file

Outputs (3)

NameTypeDescription
modelMODEL—
clipCLIP—
trigger_wordsSTRING—