Run this model with HF Jobs
Run neuralvfx/Z-Image-SAM-ControlNet on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/neuralvfx/Z-Image-SAM-ControlNet. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/neuralvfx/Z-Image-SAM-ControlNet on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use neuralvfx/Z-Image-SAM-ControlNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use neuralvfx/Z-Image-SAM-ControlNet with Diffusers:
pip install -U diffusers transformers accelerate
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline controlnet = ControlNetModel.from_pretrained("neuralvfx/Z-Image-SAM-ControlNet") pipe = StableDiffusionControlNetPipeline.from_pretrained( "Tongyi-MAI/Z-Image", controlnet=controlnet ) - Notebooks
- Google Colab
- Kaggle
Upload z-image-control.json
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198{ "id": "dc824ad9-4bce-4551-a997-e6a87f72ec9a", "revision": 0, "last_node_id": 38, "last_link_id": 57, "nodes": [ { "id": 11, "type": "ZImageFunControlnet", "pos": [ 415.9837148867862, 1217.8433748087343 ], "size": [ 270, 158 ], "flags": {}, "order": 16, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 8 }, { "name": "model_patch", "type": "MODEL_PATCH", "link": 7 }, { "name": "vae", "type": "VAE", "link": 24 }, { "name": "image", "shape": 7, "type": "IMAGE", "link": 54 }, { "name": "inpaint_image", "shape": 7, "type": "IMAGE", "link": null }, { "name": "mask", "shape": 7, "type": "MASK", "link": null } ], "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [ 9 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "ZImageFunControlnet" }, "widgets_values": [ 1 ] }, { "id": 19, "type": "CLIPTextEncode", "pos": [ 565.6117354916819, 747.6673540762121 ], "size": [ 384.6283512791799, 88 ], "flags": {}, "order": 8, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 25 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [ 18 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "CLIPTextEncode" }, "widgets_values": [ "低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲。" ] }, { "id": 33, "type": "LoadImage", "pos": [ -1355.3384764264254, 1634.722401270745 ], "size": [ 282.798828125, 314.0000000000001 ], "flags": {}, "order": 0, "mode": 0, "inputs": [], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 47 ] }, { "name": "MASK", "type": "MASK", "links": null } ], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "LoadImage" }, "widgets_values": [ "young-male-posing-isolated-against-blank-studio-wall_273609-12356.avif", "image" ] }, { "id": 34, "type": "DownloadAndLoadSAM2Model", "pos": [ -1208.9003871602697, 1419.68542801308 ], "size": [ 270, 130 ], "flags": {}, "order": 1, "mode": 0, "inputs": [], "outputs": [ { "name": "sam2_model", "type": "SAM2MODEL", "links": [ 46 ] } ], "properties": { "cnr_id": "comfyui-segment-anything-2", "ver": "1.0.2", "Node name for S&R": "DownloadAndLoadSAM2Model" }, "widgets_values": [ "sam2_hiera_base_plus.safetensors", "automaskgenerator", "cuda", "fp16" ] }, { "id": 32, "type": "Sam2AutoSegmentation", "pos": [ -937.8594354550089, 1667.6839001409319 ], "size": [ 348.740234375, 410 ], "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "sam2_model", "type": "SAM2MODEL", "link": 46 }, { "name": "image", "type": "IMAGE", "link": 47 } ], "outputs": [ { "name": "mask", "type": "MASK", "links": null }, { "name": "segmented_image", "type": "IMAGE", "links": [ 45, 48, 49 ] }, { "name": "bbox", "type": "BBOX", "links": null } ], "properties": { "cnr_id": "comfyui-segment-anything-2", "ver": "1.0.2", "Node name for S&R": "Sam2AutoSegmentation" }, "widgets_values": [ 32, 64, 0.8, 0.95, 1, 0, 0, 0.7, 0.7, 0.34, 1, 0, false, true ] }, { "id": 36, "type": "GetImageSize", "pos": [ -107.27320618163911, 1829.9817741838676 ], "size": [ 140, 124 ], "flags": {}, "order": 11, "mode": 0, "inputs": [ { "name": "image", "type": "IMAGE", "link": 49 } ], "outputs": [ { "name": "width", "type": "INT", "links": [ 50 ] }, { "name": "height", "type": "INT", "links": [ 51 ] }, { "name": "batch_size", "type": "INT", "links": null } ], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "GetImageSize" }, "widgets_values": [] }, { "id": 35, "type": "ResizeAndPadImage", "pos": [ 400.5717843126228, 1809.780667825355 ], "size": [ 270, 130 ], "flags": {}, "order": 14, "mode": 0, "inputs": [ { "name": "image", "type": "IMAGE", "link": 48 }, { "name": "target_width", "type": "INT", "widget": { "name": "target_width" }, "link": 52 }, { "name": "target_height", "type": "INT", "widget": { "name": "target_height" }, "link": 53 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 54 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "ResizeAndPadImage" }, "widgets_values": [ 512, 512, "white", "area" ] }, { "id": 30, "type": "SaveImage", "pos": [ 1792.9983147271168, 1031.4138758775948 ], "size": [ 963.738329965309, 1146.7897439905723 ], "flags": {}, "order": 19, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 43 } ], "outputs": [], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "SaveImage" }, "widgets_values": [ "beach_sgmm_uniform" ] }, { "id": 16, "type": "KSampler", "pos": [ 1200, 1090 ], "size": [ 270, 474 ], "flags": {}, "order": 17, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 9 }, { "name": "positive", "type": "CONDITIONING", "link": 13 }, { "name": "negative", "type": "CONDITIONING", "link": 18 }, { "name": "latent_image", "type": "LATENT", "link": 40 } ], "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [ 19 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "KSampler" }, "widgets_values": [ 45, "fixed", 50, 4, "euler", "normal", 1 ] }, { "id": 20, "type": "VAEDecode", "pos": [ 1550, 1060 ], "size": [ 140, 46 ], "flags": {}, "order": 18, "mode": 0, "inputs": [ { "name": "samples", "type": "LATENT", "link": 19 }, { "name": "vae", "type": "VAE", "link": 23 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [ 43 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "VAEDecode" }, "widgets_values": [] }, { "id": 15, "type": "LoadImage", "pos": [ -984.5641159802153, 2265.0444908564186 ], "size": [ 282.798828125, 314 ], "flags": {}, "order": 2, "mode": 0, "inputs": [], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "links": [] }, { "name": "MASK", "type": "MASK", "links": null } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "LoadImage" }, "widgets_values": [ "z-image.png", "image" ] }, { "id": 31, "type": "PreviewImage", "pos": [ -165.21154651992745, 2208.8313046316466 ], "size": [ 324.69567229615086, 300.83144858776404 ], "flags": {}, "order": 10, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 45 } ], "outputs": [], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "PreviewImage" }, "widgets_values": [] }, { "id": 23, "type": "CLIPLoader", "pos": [ 239.1186565991756, 657.1514402079171 ], "size": [ 270, 106 ], "flags": {}, "order": 3, "mode": 0, "inputs": [], "outputs": [ { "name": "CLIP", "type": "CLIP", "links": [ 25, 26 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "CLIPLoader" }, "widgets_values": [ "qwen_3_4b.safetensors", "stable_diffusion", "default" ] }, { "id": 13, "type": "ModelPatchLoader", "pos": [ 65.16434800585203, 1282.1995134775584 ], "size": [ 270, 58 ], "flags": {}, "order": 4, "mode": 0, "inputs": [], "outputs": [ { "name": "MODEL_PATCH", "type": "MODEL_PATCH", "links": [ 7 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "ModelPatchLoader" }, "widgets_values": [ "z-image-sam-controlnet.safetensors" ] }, { "id": 22, "type": "VAELoader", "pos": [ 64.33552623336276, 1397.8641386088798 ], "size": [ 270, 58 ], "flags": {}, "order": 5, "mode": 0, "inputs": [], "outputs": [ { "name": "VAE", "type": "VAE", "links": [ 23, 24 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "VAELoader" }, "widgets_values": [ "ae.safetensors" ] }, { "id": 14, "type": "CheckpointLoaderSimple", "pos": [ 62.28036667683965, 1120.527418531949 ], "size": [ 270, 98 ], "flags": {}, "order": 6, "mode": 0, "inputs": [], "outputs": [ { "name": "MODEL", "type": "MODEL", "links": [ 8 ] }, { "name": "CLIP", "type": "CLIP", "links": [] }, { "name": "VAE", "type": "VAE", "links": [] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "CheckpointLoaderSimple" }, "widgets_values": [ "z_image_bf16.safetensors" ] }, { "id": 18, "type": "CLIPTextEncode", "pos": [ 569.9770363494711, 583.803168311876 ], "size": [ 384.6283512791799, 88 ], "flags": {}, "order": 9, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 26 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "links": [ 13 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "CLIPTextEncode" }, "widgets_values": [ "a man with frizzy hair smling" ] }, { "id": 37, "type": "ComfyMathExpression", "pos": [ 94.60175085035121, 1739.0769607013224 ], "size": [ 210, 128 ], "flags": {}, "order": 12, "mode": 0, "inputs": [ { "label": "a", "name": "values.a", "type": "FLOAT,INT", "link": 50 }, { "label": "b", "name": "values.b", "shape": 7, "type": "FLOAT,INT", "link": null } ], "outputs": [ { "name": "FLOAT", "type": "FLOAT", "links": null }, { "name": "INT", "type": "INT", "links": [ 52, 55 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "ComfyMathExpression" }, "widgets_values": [ "a/16*16" ] }, { "id": 38, "type": "ComfyMathExpression", "pos": [ 95.47662250911469, 1889.2426788167184 ], "size": [ 210, 128 ], "flags": {}, "order": 13, "mode": 0, "inputs": [ { "label": "a", "name": "values.a", "type": "FLOAT,INT", "link": 51 }, { "label": "b", "name": "values.b", "shape": 7, "type": "FLOAT,INT", "link": null } ], "outputs": [ { "name": "FLOAT", "type": "FLOAT", "links": null }, { "name": "INT", "type": "INT", "links": [ 53, 57 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.18.2", "Node name for S&R": "ComfyMathExpression" }, "widgets_values": [ "a/16*16" ] }, { "id": 24, "type": "EmptySD3LatentImage", "pos": [ 860, 1290 ], "size": [ 270, 106 ], "flags": {}, "order": 15, "mode": 0, "inputs": [ { "name": "width", "type": "INT", "widget": { "name": "width" }, "link": 55 }, { "name": "height", "type": "INT", "widget": { "name": "height" }, "link": 57 } ], "outputs": [ { "name": "LATENT", "type": "LATENT", "links": [ 40 ] } ], "properties": { "cnr_id": "comfy-core", "ver": "0.11.0", "Node name for S&R": "EmptySD3LatentImage" }, "widgets_values": [ 1024, 1024, 1 ] } ], "links": [ [ 7, 13, 0, 11, 1, "MODEL_PATCH" ], [ 8, 14, 0, 11, 0, "MODEL" ], [ 9, 11, 0, 16, 0, "MODEL" ], [ 13, 18, 0, 16, 1, "CONDITIONING" ], [ 18, 19, 0, 16, 2, "CONDITIONING" ], [ 19, 16, 0, 20, 0, "LATENT" ], [ 23, 22, 0, 20, 1, "VAE" ], [ 24, 22, 0, 11, 2, "VAE" ], [ 25, 23, 0, 19, 0, "CLIP" ], [ 26, 23, 0, 18, 0, "CLIP" ], [ 40, 24, 0, 16, 3, "LATENT" ], [ 43, 20, 0, 30, 0, "IMAGE" ], [ 45, 32, 1, 31, 0, "IMAGE" ], [ 46, 34, 0, 32, 0, "SAM2MODEL" ], [ 47, 33, 0, 32, 1, "IMAGE" ], [ 48, 32, 1, 35, 0, "IMAGE" ], [ 49, 32, 1, 36, 0, "IMAGE" ], [ 50, 36, 0, 37, 0, "INT" ], [ 51, 36, 1, 38, 0, "INT" ], [ 52, 37, 1, 35, 1, "INT" ], [ 53, 38, 1, 35, 2, "INT" ], [ 54, 35, 0, 11, 3, "IMAGE" ], [ 55, 37, 1, 24, 0, "INT" ], [ 57, 38, 1, 24, 1, "INT" ] ], "groups": [ { "id": 1, "title": "Or just load a pre-segmented image ( option B )", "bounding": [ -1021.4742734497142, 2177.2007229832575, 643.4710093716204, 417.4186510216455 ], "color": "#3f789e", "font_size": 24, "flags": {} }, { "id": 2, "title": "Generate SAM Input From Photo ( option A )", "bounding": [ -1365.3384764264254, 1346.08542801308, 978.4169452831359, 741.5984721278527 ], "color": "#3f789e", "font_size": 24, "flags": {} }, { "id": 3, "title": "Convert To Width/Height Divisible by 16", "bounding": [ -117.27320618163911, 1665.4769607013225, 797.844990494262, 341.765718115396 ], "color": "#3f789e", "font_size": 24, "flags": {} }, { "id": 4, "title": "Load Models + ControlNet", "bounding": [ 52.28036667683968, 1046.9274185319491, 643.7033482099464, 418.9367200769311 ], "color": "#3f789e", "font_size": 24, "flags": {} }, { "id": 5, "title": "Prompt", "bounding": [ 224.8466693385037, 510.203168311877, 739.7587182901469, 335.464185764336 ], "color": "#3f789e", "font_size": 24, "flags": {} }, { "id": 6, "title": "Run ControlNet", "bounding": [ 850, 986.4, 850, 587.6 ], "color": "#3f789e", "font_size": 24, "flags": {} } ], "config": {}, "extra": { "workflowRendererVersion": "LG", "ds": { "scale": 0.21705230211937868, "offset": [ 3411.5599940756647, 562.9595312745586 ] }, "frontendVersion": "1.41.21", "VHS_latentpreview": false, "VHS_latentpreviewrate": 0, "VHS_MetadataImage": true, "VHS_KeepIntermediate": true }, "version": 0.4}comfy-ui-patch/z-image-control.jsonAdded+1198