Views
No views yet
ZImagePipeline.1import torch
2from diffusers import ZImagePipeline, ZImageTransformer2DModel
3
4# Load the custom transformer
5transformer = ZImageTransformer2DModel.from_pretrained(
6 "linoyts/beyond-reality-z-image-diffusers",
7 torch_dtype=torch.bfloat16
8)
9
10# Load the pipeline with custom transformer
11pipe = ZImagePipeline.from_pretrained(
12 "Tongyi-MAI/Z-Image-Turbo",
13 transformer=transformer,
14 torch_dtype=torch.bfloat16,
15)
16pipe.to("cuda")
17
18# Generate an image
19prompt = "A beautiful landscape with mountains and a lake, photorealistic, 8k"
20image = pipe(
21 prompt=prompt,
22 num_inference_steps=8,
23 guidance_scale=0.0, # Z-Image-Turbo uses guidance_scale=0
24 width=1024,
25 height=1024,
26).images[0]
27
28image.save("output.png")model.diffusion_model. prefix from all keysx_embedder to all_x_embedder.2-1final_layer to all_final_layer.2-1attention.qkv into attention.to_q, attention.to_k, attention.to_vattention.out to attention.to_out.0attention.q_norm to attention.norm_qattention.k_norm to attention.norm_k