New Mecha style for Z-Image-Turbo!
This is a one shot test to allow me (and everyone of course) to test ZIT stuff with New Mecha style. Works best with 8-10 steps.
Trigger: Start your prompt with "NewMecha style illustration." followed by something (this can be altered) like "This is a highly detailed, digital illustration of a...". You can add "anime-like" if you wish for a flatter look or "CGI" if you want more 3D.
This LoRA was trained using ai-toolkit default config (since the on-site training is failing hard on ZIT) and a dataset of 250 pictures generated using New Mecha and captionned using JoyCaption.
Since this is a dataset of Illustrious pictures, the overall result is a bit under what ZIT supposedly can render, but lowering the LoRA weight and adding more stuff is the goal (that's why on-site i put 0.8 as the max weight).
The showcase was done by captionning my usual showcase pictures using JoyCaption too and the ugliest Gradio + Diffusers app ever (to avoid paying Yellow Buzz):
import gradio as gr
import torch
from diffusers import ZImagePipeline
from uuid import uuid4
from PIL.PngImagePlugin import PngInfo
from datetime import datetime, timezone
device = "cuda"
dtype = torch.bfloat16
pipe = ZImagePipeline.from_pretrained(
"Tongyi-MAI/Z-Image-Turbo",
dtype=dtype,
).to(device)
pipe.load_lora_weights(
"./output/new_mecha_zit",
weight_name="new_mecha_zit_000002750.safetensors",
adapter_name="new_mecha",
)
pipe.set_adapters(["new_mecha"], adapter_weights=[0.8])
def generate(prompt, seed, steps):
generator = torch.Generator(device).manual_seed(seed)
image = pipe(
prompt=f"NewMecha style illustration. {prompt}",
num_inference_steps=steps,
guidance_scale=1,
width=832,
height=1216,
generator=generator,
).images[0]
im_path = f"./im-outputs/{uuid4()}.png"
metadata = PngInfo()
timestamp = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
ressources = 'Civitai resources: [{"type":"checkpoint","modelVersionId":2442439,"modelName":"Z Image","modelVersionName":"Turbo"},{"type":"lora","weight":0.8,"modelVersionId":2507250,"modelName":"(ZIT) New Mecha style","modelVersionName":"v1.0"}], Civitai metadata: {}'
metadata.add_text(
"parameters",
f"NewMecha style illustration. {prompt}\nNegative prompt: \nSteps: {steps}, Sampler: Undefined, CFG scale: 1, Seed: {seed}, Size: 832x1216, Clip skip: 2, Created Date: {timestamp}, {ressources}",
)
image.save(im_path, pnginfo=metadata)
return im_path
demo = gr.Interface(
fn=generate,
inputs=[
gr.Textbox(
label="prompt",
value="This is a highly detailed, digital anime-style illustration of a young woman in a black dress.",
lines=6,
),
gr.Number(label="seed", value=42, minimum=1, precision=0),
gr.Number(label="steps", value=8, minimum=1, precision=0),
],
outputs=[gr.Image(height=608)],
flagging_mode="never",
clear_btn=None,
)
demo.launch(server_name="0.0.0.0", server_port=8000)Enjoy and please give me any feedback you feel like regarding this LoRA (that's probably the only one i'll make for ZIT, at least until i can generate locally instead of on a costly GPU instance).
Description
Exclusively posted on Civitai, upload found elsewhere are done without the author permission.






