CoolFace
Modelpublic

bghira/z-image-turbo-Domokun-scheduled-sampling

sourceHugging Faceotherupdated 8mo agoView on Hugging Face
0likes63downloads
Model Card

bghira/z-image-turbo-Domokun-scheduled-sampling

This is a PEFT LoRA derived from TONGYI-MAI/Z-Image-Turbo.

The main validation prompt used during training was:

๐ŸŸซ running through a field with flowers all around him.

Validation settings

  • โ€”CFG: 1.0
  • โ€”CFG Rescale: 0.0
  • โ€”Steps: 8
  • โ€”Sampler: FlowMatchEulerDiscreteScheduler
  • โ€”Seed: 42
  • โ€”Resolution: 1024x1024

Note: The validation settings are not necessarily the same as the training settings.

You can find some example images in the following gallery:

<Gallery />

The text encoder was not trained. You may reuse the base model text encoder for inference.

Training settings

  • โ€”Training epochs: 370
  • โ€”Training steps: 10000
  • โ€”Learning rate: 0.0006
  • โ€”Learning rate schedule: constant
  • โ€”Warmup steps: 0
  • โ€”Max grad value: 0.01
  • โ€”Effective batch size: 1
  • โ€”Micro-batch size: 1
  • โ€”Gradient accumulation steps: 1
  • โ€”Number of GPUs: 1
  • โ€”Gradient checkpointing: True
  • โ€”Prediction type: flow_matching[]
  • โ€”Optimizer: adamw_bf16
  • โ€”Trainable parameter precision: Pure BF16
  • โ€”Base model precision: no_change
  • โ€”Caption dropout probability: 0.0%
  • โ€”LoRA Rank: 8
  • โ€”LoRA Alpha: None
  • โ€”LoRA Dropout: 0.1
  • โ€”LoRA initialisation style: default
  • โ€”LoRA mode: Standard

Datasets

dreambooth-512

  • โ€”Repeats: 0
  • โ€”Total number of images: 27
  • โ€”Total number of aspect buckets: 1
  • โ€”Resolution: 512 px
  • โ€”Cropped: True
  • โ€”Crop style: random
  • โ€”Crop aspect: square
  • โ€”Used for regularisation data: No

Inference

python
import torch
from diffusers import DiffusionPipeline

model_id = 'TONGYI-MAI/Z-Image-Turbo'
adapter_id = 'bghira/bghira/z-image-turbo-Domokun-scheduled-sampling'
pipeline = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) # loading directly in bf16
pipeline.load_lora_weights(adapter_id)

prompt = "๐ŸŸซ running through a field with flowers all around him."
negative_prompt = 'ugly, cropped, blurry, low-quality, mediocre average'

## Optional: quantise the model to save on vram.
## Note: The model was not quantised during training, so it is not necessary to quantise it during inference time.
#from optimum.quanto import quantize, freeze, qint8
#quantize(pipeline.transformer, weights=qint8)
#freeze(pipeline.transformer)
    
pipeline.to('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu') # the pipeline is already in its target precision level
model_output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_inference_steps=8,
    generator=torch.Generator(device='cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu').manual_seed(42),
    width=1024,
    height=1024,
    guidance_scale=1.0,
).images[0]

model_output.save("output.png", format="PNG")