CMK FaceProcess Prepare -Pipe-
The face module's own model, prompt and SAM — built once
- MODEL
- PROCESS
- IMAGE
- LOG
- FACE
- LOG
- diagnostic
CMK FaceProcess Prepare -Pipe- is the head of the pack's face module: it takes your model pipe, your process context and an image, and produces a FACE pipe containing everything a face pass needs. It's the twin of the detailer prepare node, with a different downstream job.
Why there's a prepare step at all
Because a face pass shouldn't inherit whatever the main sampler happened to be doing. Face restoration and face re-detailer passes want their own prompt (you rarely want "wide shot, dramatic lighting" applied to a 300-pixel face crop), their own LoRA sometimes, and their own sampling settings. CMK's answer is to make that a frozen context object rather than a pile of wires you re-plumb every time.
The contract, as the node's own documentation states it: MODEL is read-only and never mutated, IMAGE is the authoritative image being processed, and PROCESS is read only for shared context - the prompt and LoRA offers from the sampler, and the seed.
Inputs
MODEL (CMK_MODEL_PIPE), PROCESS (CMK_RESULT_PROCESS) and IMAGE are the three required wires.
Then the context settings:
sam_model_name- fromComfyUI/models/sams. With nothing installed it shows the single entryNo SAM model installed, which is at least honest.sam_device_mode-AUTO,Prefer GPU,CPU. Default is CPU, which is the right call when your GPU is already near the edge during sampling; it's slower but it doesn't evict anything.face_global_enable- the module-wide switch, defaultFalse.use_prompt_lora_from_sampler(on),use_lora_from_1st_pass(off),use_1st_pass_sampling(on) - the inheritance triad. On means "reuse the main recipe"; flip them when the face pass needs its own.lora_name(defaultNone),strength_model,strength_clip- an optional module-local LoRA.prompt_pos/prompt_neg- the face pass's own prompts; these get encoded into conditioning inside this node, which is why the pipe can carry a complete basic-pipe later.steps(30),cfg(7),sampler(euler),scheduler(simple),stop_at_clip_layer(-2),pag_scale(2.5),sampling(v_prediction),zsnr(on) - the sampling setup, mostly advanced in the UI.- FreeU:
freeu_enabledis on by default, withfreeu_b11.3,freeu_b21.4,freeu_s10.9,freeu_s20.2. Flag that one - people spend a while wondering why their face pass doesn't look like a vanilla render when FreeU is quietly on.
Optional LOG lets you chain the module's reporting upstream. Outputs are FACE (CMK_FACE_PIPE), LOG and a diagnostic.
What happens downstream
The FACE pipe carries the prepared model, CLIP, VAE and encoded positive/negative conditioning - effectively a basic pipe plus the face-specific settings - which is exactly what the face module's detailer path needs, since the re-render step is a crop, resize, VAE encode, sample with a noise mask, decode and paste. It also carries the detection and selection state so the execute node doesn't have to re-derive it.
That's the reason the prepare exists as its own node rather than as widgets on the execute node: the expensive, once-per-run setup - model load, LoRA application, prompt encoding, SAM load - happens here, once, and every face branch downstream reads the same frozen result.
Install
Manager: search CMK Flow, install the CMKFlow entry, restart. Manually, from the folder containing main.py:
git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py
Wait for CMK dependency check: OK - after a manual clone nothing runs pip for you, and this node imports enough of the pack that a partial install shows up as an import error on startup rather than at run time. requirements.txt is a real commitment: ultralytics, onnxruntime, insightface, segment-anything, imageio-ffmpeg, opencv-python, nudenet==3.4.2, all into your shared environment.
Models aren't in the package: SAM under models/sams, face detectors under models/ultralytics/bbox (or segm), restore networks under models/facerestore_models. Audit what the bundled workflows expect with:
python3 custom_nodes/cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/shared/models"
Enable Vue Nodes / Nodes 2.0 - CMK's dynamic widgets need it.
Issues worth knowing
Everything is optional from ComfyUI's validation standpoint and the frontend rebuilds the visible widget list per mode, so a hidden widget can't be reported as missing. That's good design, and it also means an unwired mode-specific input fails at run time with a clearer message rather than at queue time. If a face pass dies on a missing input, read the message - it names the parameter.
face_global_enable defaults to off. If the face module does nothing and reports nothing alarming, look there first; the boundary node upstream will have logged a disabled passthrough.
And if the SAM dropdown is empty, mask refinement isn't available yet. Detection still works - the detectors are YOLO - but the polygon masks won't be there.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| MODEL | CMK_MODEL_PIPE | — | |
| PROCESS | CMK_RESULT_PROCESS | — | |
| IMAGE | IMAGE | — | |
| sam_model_name | COMBO | 1 options: No SAM model installed | |
| sam_device_mode | COMBO | CPU | 3 options: AUTO, Prefer GPU, CPU |
| face_global_enable | BOOLEAN | false | — |
| use_prompt_lora_from_sampler | BOOLEAN | true | — |
| use_lora_from_1st_pass | BOOLEAN | false | — |
| use_1st_pass_sampling | BOOLEAN | true | — |
| lora_name | COMBO | None | 1 options: None |
| strength_model | FLOAT | 1.00-20–20 | — |
| strength_clip | FLOAT | 1.00-20–20 | — |
| prompt_pos | STRING | — | |
| prompt_neg | STRING | — | |
| steps | INT | 301–10000 | — |
| cfg | FLOAT | 7.00–100 | — |
| sampler | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | simple | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 |
| stop_at_clip_layer | INT | -2-24–-1 | — |
| pag_scale | FLOAT | 2.500–20 | — |
| sampling | COMBO | v_prediction | 3 options: eps, v_prediction, lcm |
| zsnr | BOOLEAN | true | — |
| freeu_enabled | BOOLEAN | true | — |
| freeu_b1 | FLOAT | 1.300–10 | — |
| freeu_b2 | FLOAT | 1.400–10 | — |
| freeu_s1 | FLOAT | 0.900–10 | — |
| freeu_s2 | FLOAT | 0.200–10 | — |
| LOGopt | CMK_LOG_PIPE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| FACE | CMK_FACE_PIPE | — |
| LOG | CMK_LOG_PIPE | — |
| diagnostic | CMK_DIAGNOSTIC | — |