age_shift_cli.py
End-to-end CLI for ComfyUI-AgeShift. Talks to a running ComfyUI server, uploads a face image, runs detection, and (optionally) drives PuLID-Flux to generate age-shifted portraits.
Quick start
# Detect age only
uv run python age_shift_cli.py face.jpg --detect-only --ip 10.8.0.12
# Single target age
uv run python age_shift_cli.py face.jpg --target-age 65 --ip 10.8.0.12
# Sequence
uv run python age_shift_cli.py face.jpg \
--target-ages 5,15,25,45,65 \
--gender male --out ./out --ip 10.8.0.12
# Debug — save generated workflow JSON(s) for inspection in UI
uv run python age_shift_cli.py face.jpg --target-age 65 \
--dump-workflow /tmp/agewf.json --ip 10.8.0.12
Argparse reference
| Group | Flag | Default | Notes |
|---|---|---|---|
| server | --ip |
127.0.0.1 |
ComfyUI host |
--port |
8188 |
ComfyUI port | |
--server |
— | overrides --ip:--port |
|
| mode | --detect-only |
False | skip generation |
--target-age |
— | single target | |
--target-ages |
— | csv of targets, e.g. 5,15,25,45,65 |
|
| subject | --subject |
person |
injected into prompt |
--gender |
unspecified |
male / female / non-binary |
|
--style |
photorealistic ... |
base style prompt | |
--extra-positive |
same identity, ... |
identity-preserving anchor | |
| gen | --width / --height |
1024 | Flux native is 1024 |
--steps |
20 | Flux dev: 20–28 is fine | |
--cfg |
1.0 | Flux uses CFG=1 + --guidance |
|
--guidance |
3.5 | Flux distillation guidance | |
--sampler / --scheduler |
euler / simple |
||
--seed |
0 (random per age) | ||
| pulid | --pulid-weight |
0.9 | identity strength |
--pulid-start / --pulid-end |
0.0 / 1.0 | active range | |
| models | --flux-unet |
flux1-dev.safetensors |
filename on server |
--flux-clip-l |
clip_l.safetensors |
||
--flux-t5 |
t5xxl_fp8_e4m3fn.safetensors |
||
--flux-vae |
ae.safetensors |
||
--pulid-weights |
pulid_flux_v0.9.1.safetensors |
||
--insightface-provider |
CUDA |
CPU / ROCM also valid |
|
| detector | --detector-model |
nateraw/vit-age-classifier |
HF ID or local path |
--detector-device |
auto |
||
--detector-dtype |
fp32 |
||
| debug | --out |
./out |
output dir |
--dump-workflow |
— | writes *.detect.json / *.shift_ageN.json |
|
--timeout |
600 | per-workflow seconds |
Troubleshooting
/prompt 400 - node 'AgeDetectorLoader' not found
The node package isn't loaded on the server. Check
http://server:8188/object_info | grep AgeDetect.
/prompt 400 - node 'PulidFluxModelLoader' not found
Install ComfyUI-PuLID-Flux on the server.
Estimated age: 0
Detector hit a corrupt or all-black input. Confirm the source image renders
correctly: curl http://server:8188/view?filename=face.jpg.
Hangs after executing node sampler_node
PuLID weight too aggressive, or InsightFace download in progress. First run
of PuLID downloads ~600 MB of weights — watch the server log.
Output looks like the source age, not the target
- Bump
--guidance 4.5(Flux follows prompt harder). - Drop
--pulid-weight 0.75(less identity dominance). - Steps to 24–28.
- Make sure your style prompt isn't pulling toward "young model".