HyperLoRA ID Cond
The face, cleaned and isolated — how HyperLoRA builds its ID condition
- hyper_lora
- images
- face_attr
- ID_COND
- IMAGE
HyperLoRA generates a face LoRA from a reference photo, and this is the node that decides what the model actually sees. HyperLoRAIDCond takes your images plus the FACE_ATTR detection data, cuts the face out, strips the background, and produces the ID_COND - the CLIP image tokens and ArcFace embedding that the hyper-network turns into LoRA weights. It also hands you a preview IMAGE so you can see exactly what it fed the model, which is where most quality debugging actually happens.
What it does, step by step
Given a detected face it does a three-part cleanup:
- Background removal - using the 106-point face landmarks it builds a polygon mask, crops the face region, and pastes it onto a neutral gray background. That's the
remove_backgroundtoggle (default on), and it exists so clothing, furniture, and scenery don't leak into the identity signal. The ID LoRA is supposed to be just the face. - Crop to the face bbox - a tight square around the head, derived from the landmarks.
- Optional grayscale - converts the crop to L for the CLIP path. Mostly a style-experiment knob; leave it off.
The output ID_COND is a bundle of the CLIP-processed pixels and the ArcFace embedding (pulled from the InsightFace recognizer). Whichever encoders are active in your loader config determine which parts get filled in - with clip + arcface you get both, which is what the released models expect.
Inputs and outputs
hyper_lora- the loaded bundle.images- your reference photos.face_attr- fromHyperLoRAFaceAttr(or baked intoUniGenerateIDLoRA).grayscale/remove_background- discussed above; defaults are the right ones.
Outputs are two: the ID_COND (feeds HyperLoRAGenerateIDLoRA) and a preview IMAGE - the cropped 512×512 face it built. Check that preview. If it's showing half a head, a confused crop, or a background that survived the mask, fix the source image before blaming the LoRA generation.
Installing
Standard pack install: ComfyUI Manager → search "ComfyUI-HyperLoRA", or git clone https://github.com/bytedance/ComfyUI-HyperLoRA into custom_nodes, then pip install -r requirements.txt (diffusers, insightface, onnxruntime, opencv-python, transformers), restart. This node needs the CLIP ViT processor/model under models/hyper_lora/ and the antelopev2 InsightFace pack under models/insightface/models/ - the folder layout in the README is exact, and empty folders show up as "Not found!" in the loader dropdowns.
Gotchas
The failure you'll meet first is "No face detected!", which this node inherits from the FaceAttr step upstream - it can't build an ID cond without a face. The subtler one is a *mis-*detected face: the crop logic assumes the landmarks are right, and strong head tilt, sunglasses, or harsh shadows produce a crop that's useless even though detection "succeeded." Feed it frontal, well-lit head-and-shoulders shots and you'll dodge 90% of it.
A note on the bigger picture: because HyperLoRA's v1 weights distill the base LoRA into the ID LoRA, this face-only condition is effectively the whole identity pipeline for the released models. If you want editability rather than raw likeness, there's a second HyperLoRA variant (sdxl_hyper_id_lora_v1_edit) - swap it in the loader; the conditioning nodes don't care.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| hyper_lora | HYPER_LORA | — | |
| images | IMAGE | — | |
| face_attr | FACE_ATTR | — | |
| grayscale | BOOLEAN | false | — |
| remove_background | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| ID_COND | ID_COND | — |
| IMAGE | IMAGE | — |