simpletuner/z-image
Run simpletuner/z-image with an API
Use one of our client libraries to get started quickly. Clicking on a library will take you to the Playground tab where you can tweak different inputs, see the results, and copy the corresponding code to use in your own project.
Input schema
The fields you can use to run this model with an API. If you don't give a value for a field its default value will be used.
| Field | Type | Default value | Description |
|---|---|---|---|
| train_data |
string
|
Zip or tar of training images. Matching .txt captions are preserved; missing captions use the trigger and filename.
|
|
| hf_dataset |
string
|
Hugging Face dataset repo ID to use when no archive is provided (e.g., user/dataset).
|
|
| model |
None
|
Z-Image-Turbo
|
Training assistant version for Z-Image Turbo. v1 preserves the original recipe.
|
| resolution |
None
|
1024
|
Training and validation scales; multi-scale sampling preserves aspect ratios.
|
| use_synthetic_regularisation |
boolean
|
False
|
Mix synthetic images into half of training updates. Available at 512 and 1024 resolutions.
|
| hf_caption_column |
string
|
caption
|
Caption column when using hf_dataset.
|
| hf_instance_prompt |
string
|
Use this caption for every Hugging Face image instead of a caption column. Include your trigger.
|
|
| hf_revision |
string
|
Optional Hugging Face dataset commit or revision.
|
|
| validation_prompt |
string
|
a detailed photograph, natural lighting
|
Validation prompt; include the concept or trigger you are teaching.
|
| enable_crop |
boolean
|
False
|
Enable cropping when preparing samples.
|
| crop_style |
None
|
center
|
Crop location style when cropping is enabled.
|
| crop_aspect |
None
|
preserve
|
Aspect handling for crops: square (1:1) or preserve source aspect.
|
| trigger_word |
string
|
TOK
|
Subject token used in generated fallback captions and instance prompts.
|
| caption_strategy |
None
|
textfile
|
Captions for uploaded images: matching text files with filename fallbacks, filenames, or one instance prompt.
|
| train_batch_size |
integer
|
2
Min: 1 Max: 4 |
Training batch size (1-4).
|
| checkpoints_total_limit |
integer
|
5
Min: 1 Max: 5 |
Maximum checkpoints to retain (max 5).
|
| checkpoint_step_interval |
integer
|
250
Min: 1 |
Save checkpoints and generate validation images every N optimizer updates.
|
| max_train_steps |
integer
|
4000
|
Total optimizer updates. Regularisation updates count toward this limit.
|
| learning_rate |
number
|
Min: 0.00000001 Max: 0.01 |
Learning rate. Leave blank for the model recipe.
|
| lora_rank |
integer
|
Min: 1 Max: 256 |
Adapter rank; alpha matches rank. Leave blank for rank 64.
|
| lora_dropout |
number
|
0
Max: 0.999 |
Adapter dropout probability.
|
| seed |
integer
|
42
|
Training and validation seed.
|
| attention_mechanism |
None
|
kohaku-fa-auto
|
Automatic centered Kohaku attention, or native Diffusers attention.
|
| gradient_checkpointing_interval |
integer
|
Min: 1 Max: 64 |
Blocks per checkpointed segment. Leave blank for the model recipe.
|
| gradient_checkpointing_segment_stride |
integer
|
Min: 1 Max: 64 |
Start a checkpointed segment every N blocks. Leave blank for contiguous segments.
|
| regional_compile |
boolean
|
True
|
Compile repeated transformer blocks.
|
| dataloader_prefetch |
boolean
|
True
|
Prepare the next training batches in the background.
|
| push_checkpoints_to_hub |
boolean
|
True
|
Upload retained intermediate checkpoints as well as final weights when hub_model_id is set.
|
| pixel_area |
integer
|
Min: 256 Max: 2048 |
Legacy single-resolution override. Prefer resolution for new jobs.
|
| num_train_epochs |
integer
|
Min: 1 |
Legacy epoch limit, used with max_train_steps=0.
|
| checkpoint_epoch_interval |
integer
|
Min: 1 |
Optional epoch-based checkpoint interval.
|
| s3_bucket |
string
|
|
S3-compatible bucket for publishing checkpoints.
|
| s3_region |
string
|
S3 region (optional).
|
|
| s3_endpoint_url |
string
|
Custom S3 endpoint URL (for non-AWS providers).
|
|
| s3_base_path |
string
|
Prefix inside the bucket (defaults to cog/zimage/{job_id}).
|
|
| s3_public_base_url |
string
|
Public base URL to build shareable links (optional).
|
|
| s3_access_key |
string
|
S3 access key (leave blank to use IAM/instance roles).
|
|
| s3_secret_key |
string
|
S3 secret key (leave blank to use IAM/instance roles).
|
|
| hub_model_id |
string
|
Hugging Face model repo for the final LoRA and validation images (e.g., user/model).
|
|
| hf_token |
string
|
Hugging Face token for downloads and write access when publishing to hub_model_id.
|
|
| return_logs |
boolean
|
True
|
Print the tail of debug.log.
|
{
"type": "object",
"title": "Input",
"properties": {
"seed": {
"type": "integer",
"title": "Seed",
"default": 42,
"minimum": 0,
"x-order": 21,
"description": "Training and validation seed."
},
"model": {
"enum": [
"Z-Image-Turbo",
"Z-Image-Turbo-v2"
],
"type": "string",
"title": "model",
"description": "Training assistant version for Z-Image Turbo. v1 preserves the original recipe.",
"default": "Z-Image-Turbo",
"x-order": 2
},
"hf_token": {
"type": "string",
"title": "Hf Token",
"format": "password",
"x-order": 39,
"nullable": true,
"writeOnly": true,
"description": "Hugging Face token for downloads and write access when publishing to hub_model_id.",
"x-cog-secret": true
},
"lora_rank": {
"type": "integer",
"title": "Lora Rank",
"maximum": 256,
"minimum": 1,
"x-order": 19,
"nullable": true,
"description": "Adapter rank; alpha matches rank. Leave blank for rank 64."
},
"s3_bucket": {
"type": "string",
"title": "S3 Bucket",
"default": "",
"x-order": 31,
"description": "S3-compatible bucket for publishing checkpoints."
},
"s3_region": {
"type": "string",
"title": "S3 Region",
"x-order": 32,
"nullable": true,
"description": "S3 region (optional)."
},
"crop_style": {
"enum": [
"center",
"random"
],
"type": "string",
"title": "crop_style",
"description": "Crop location style when cropping is enabled.",
"default": "center",
"x-order": 10
},
"hf_dataset": {
"type": "string",
"title": "Hf Dataset",
"x-order": 1,
"nullable": true,
"description": "Hugging Face dataset repo ID to use when no archive is provided (e.g., user/dataset)."
},
"pixel_area": {
"type": "integer",
"title": "Pixel Area",
"maximum": 2048,
"minimum": 256,
"x-order": 28,
"nullable": true,
"description": "Legacy single-resolution override. Prefer resolution for new jobs."
},
"resolution": {
"enum": [
"512+1024",
"256",
"512",
"768",
"1024",
"1536",
"2048"
],
"type": "string",
"title": "resolution",
"description": "Training and validation scales; multi-scale sampling preserves aspect ratios.",
"default": "1024",
"x-order": 3
},
"train_data": {
"type": "string",
"title": "Train Data",
"format": "uri",
"x-order": 0,
"nullable": true,
"description": "Zip or tar of training images. Matching .txt captions are preserved; missing captions use the trigger and filename."
},
"crop_aspect": {
"enum": [
"square",
"preserve"
],
"type": "string",
"title": "crop_aspect",
"description": "Aspect handling for crops: square (1:1) or preserve source aspect.",
"default": "preserve",
"x-order": 11
},
"enable_crop": {
"type": "boolean",
"title": "Enable Crop",
"default": false,
"x-order": 9,
"description": "Enable cropping when preparing samples."
},
"hf_revision": {
"type": "string",
"title": "Hf Revision",
"x-order": 7,
"nullable": true,
"description": "Optional Hugging Face dataset commit or revision."
},
"return_logs": {
"type": "boolean",
"title": "Return Logs",
"default": true,
"x-order": 40,
"description": "Print the tail of debug.log."
},
"hub_model_id": {
"type": "string",
"title": "Hub Model Id",
"x-order": 38,
"nullable": true,
"description": "Hugging Face model repo for the final LoRA and validation images (e.g., user/model)."
},
"lora_dropout": {
"type": "number",
"title": "Lora Dropout",
"default": 0,
"maximum": 0.999,
"minimum": 0,
"x-order": 20,
"description": "Adapter dropout probability."
},
"s3_base_path": {
"type": "string",
"title": "S3 Base Path",
"x-order": 34,
"nullable": true,
"description": "Prefix inside the bucket (defaults to cog/zimage/{job_id})."
},
"trigger_word": {
"type": "string",
"title": "Trigger Word",
"default": "TOK",
"x-order": 12,
"description": "Subject token used in generated fallback captions and instance prompts."
},
"learning_rate": {
"type": "number",
"title": "Learning Rate",
"maximum": 0.01,
"minimum": 1e-08,
"x-order": 18,
"nullable": true,
"description": "Learning rate. Leave blank for the model recipe."
},
"s3_access_key": {
"type": "string",
"title": "S3 Access Key",
"format": "password",
"x-order": 36,
"nullable": true,
"writeOnly": true,
"description": "S3 access key (leave blank to use IAM/instance roles).",
"x-cog-secret": true
},
"s3_secret_key": {
"type": "string",
"title": "S3 Secret Key",
"format": "password",
"x-order": 37,
"nullable": true,
"writeOnly": true,
"description": "S3 secret key (leave blank to use IAM/instance roles).",
"x-cog-secret": true
},
"max_train_steps": {
"type": "integer",
"title": "Max Train Steps",
"default": 4000,
"minimum": 0,
"x-order": 17,
"description": "Total optimizer updates. Regularisation updates count toward this limit."
},
"s3_endpoint_url": {
"type": "string",
"title": "S3 Endpoint Url",
"x-order": 33,
"nullable": true,
"description": "Custom S3 endpoint URL (for non-AWS providers)."
},
"caption_strategy": {
"enum": [
"textfile",
"filename",
"instanceprompt"
],
"type": "string",
"title": "caption_strategy",
"description": "Captions for uploaded images: matching text files with filename fallbacks, filenames, or one instance prompt.",
"default": "textfile",
"x-order": 13
},
"num_train_epochs": {
"type": "integer",
"title": "Num Train Epochs",
"minimum": 1,
"x-order": 29,
"nullable": true,
"description": "Legacy epoch limit, used with max_train_steps=0."
},
"regional_compile": {
"type": "boolean",
"title": "Regional Compile",
"default": true,
"x-order": 25,
"description": "Compile repeated transformer blocks."
},
"train_batch_size": {
"type": "integer",
"title": "Train Batch Size",
"default": 2,
"maximum": 4,
"minimum": 1,
"x-order": 14,
"description": "Training batch size (1-4)."
},
"hf_caption_column": {
"type": "string",
"title": "Hf Caption Column",
"default": "caption",
"x-order": 5,
"description": "Caption column when using hf_dataset."
},
"validation_prompt": {
"type": "string",
"title": "Validation Prompt",
"default": "a detailed photograph, natural lighting",
"x-order": 8,
"description": "Validation prompt; include the concept or trigger you are teaching."
},
"hf_instance_prompt": {
"type": "string",
"title": "Hf Instance Prompt",
"x-order": 6,
"nullable": true,
"description": "Use this caption for every Hugging Face image instead of a caption column. Include your trigger."
},
"s3_public_base_url": {
"type": "string",
"title": "S3 Public Base Url",
"x-order": 35,
"nullable": true,
"description": "Public base URL to build shareable links (optional)."
},
"attention_mechanism": {
"enum": [
"kohaku-fa-auto",
"diffusers"
],
"type": "string",
"title": "attention_mechanism",
"description": "Automatic centered Kohaku attention, or native Diffusers attention.",
"default": "kohaku-fa-auto",
"x-order": 22
},
"dataloader_prefetch": {
"type": "boolean",
"title": "Dataloader Prefetch",
"default": true,
"x-order": 26,
"description": "Prepare the next training batches in the background."
},
"checkpoints_total_limit": {
"type": "integer",
"title": "Checkpoints Total Limit",
"default": 5,
"maximum": 5,
"minimum": 1,
"x-order": 15,
"description": "Maximum checkpoints to retain (max 5)."
},
"push_checkpoints_to_hub": {
"type": "boolean",
"title": "Push Checkpoints To Hub",
"default": true,
"x-order": 27,
"description": "Upload retained intermediate checkpoints as well as final weights when hub_model_id is set."
},
"checkpoint_step_interval": {
"type": "integer",
"title": "Checkpoint Step Interval",
"default": 250,
"minimum": 1,
"x-order": 16,
"description": "Save checkpoints and generate validation images every N optimizer updates."
},
"checkpoint_epoch_interval": {
"type": "integer",
"title": "Checkpoint Epoch Interval",
"minimum": 1,
"x-order": 30,
"nullable": true,
"description": "Optional epoch-based checkpoint interval."
},
"use_synthetic_regularisation": {
"type": "boolean",
"title": "Use Synthetic Regularisation",
"default": false,
"x-order": 4,
"description": "Mix synthetic images into half of training updates. Available at 512 and 1024 resolutions."
},
"gradient_checkpointing_interval": {
"type": "integer",
"title": "Gradient Checkpointing Interval",
"maximum": 64,
"minimum": 1,
"x-order": 23,
"nullable": true,
"description": "Blocks per checkpointed segment. Leave blank for the model recipe."
},
"gradient_checkpointing_segment_stride": {
"type": "integer",
"title": "Gradient Checkpointing Segment Stride",
"maximum": 64,
"minimum": 1,
"x-order": 24,
"nullable": true,
"description": "Start a checkpointed segment every N blocks. Leave blank for contiguous segments."
}
}
}
Output schema
The shape of the response you’ll get when you run this model with an API.
{
"type": "string",
"title": "Output",
"format": "uri"
}