YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Z-Image-Turbo Pixel Art LoRA

A LoRA adapter for Tongyi-MAI/Z-Image-Turbo fine-tuned on pixel art style images.

Model Details

  • Base Model: Tongyi-MAI/Z-Image-Turbo
  • Training Framework: DiffSynth Studio
  • LoRA Rank: 32
  • Target Modules: to_q, to_k, to_v, to_out.0, w1, w2, w3
  • Training Dataset: mks0813/pixel_image_dataset

Usage

Installation

pip install diffsynth

Inference Code

Important: Add , pxlstl suffix to your prompt for best pixel art style results.

import torch
import glob
from diffsynth.pipelines.z_image import ZImagePipeline, ModelConfig

MODEL_ID = "Tongyi-MAI/Z-Image-Turbo"
STYLE_SUFFIX = ", pxlstl"

# Load pipeline
pipe = ZImagePipeline.from_pretrained(
    torch_dtype=torch.bfloat16,
    device="cuda",
    model_configs=[
        ModelConfig(model_id=MODEL_ID, origin_file_pattern="transformer/*.safetensors"),
        ModelConfig(model_id=MODEL_ID, origin_file_pattern="text_encoder/*.safetensors"),
        ModelConfig(model_id=MODEL_ID, origin_file_pattern="vae/diffusion_pytorch_model.safetensors"),
    ],
    tokenizer_config=ModelConfig(model_id=MODEL_ID, origin_file_pattern="tokenizer/"),
)

# Load LoRA
from huggingface_hub import hf_hub_download
lora_path = hf_hub_download(repo_id="mks0813/z-image-turbo-pixel-art-lora", filename="z-image-turbo-pixel-art-lora.safetensors")
pipe.load_lora(pipe.dit, lora_path)

# Generate image
prompt = "A cute pixel art cat" + STYLE_SUFFIX
image = pipe(prompt=prompt, seed=42, rand_device="cuda")
image.save("output.png")

Sample Outputs

Image Prompt
A cat is driving a car in the city
A cozy café on a rainy Paris street at night
A dancer spinning on a rooftop under city lights
A fox sleeping in a sunlit autumn forest
A iconic white-sand beach lined with high-rise hotels and swaying palm trees
A landscape of a meadow with sheep wandering at sunset
A lighthouse standing against crashing waves under a stormy sky
A lion is sleeping under the tree
A lone astronaut walking on a crystal desert planet

Training Details

  • Epochs: 2
  • Learning Rate: 1e-4
  • Gradient Checkpointing: Enabled
  • Dataset Size: 492 images

License

This model follows the license of the base model Tongyi-MAI/Z-Image-Turbo.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support