Spaces:
Running
Running
4-step distill: download BF16, convert to Q5_K_M GGUF at build time
Browse files- Dockerfile +8 -3
- README.md +5 -3
- app.py +5 -5
Dockerfile
CHANGED
|
@@ -39,9 +39,14 @@ RUN chmod +x /app/sd-cli
|
|
| 39 |
|
| 40 |
RUN mkdir -p /app/models
|
| 41 |
|
| 42 |
-
# Download Z-Anime distill
|
| 43 |
-
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/z-anime-
|
| 44 |
-
"https://huggingface.co/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# Download Qwen3-4B text encoder Q8_0 GGUF (~4.28GB)
|
| 47 |
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/qwen3_4b_q8_0.gguf \
|
|
|
|
| 39 |
|
| 40 |
RUN mkdir -p /app/models
|
| 41 |
|
| 42 |
+
# Download Z-Anime distill 4-step BF16 (~12.3GB), convert to Q5_K_M GGUF, delete source
|
| 43 |
+
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/z-anime-distill-4step-bf16.safetensors \
|
| 44 |
+
"https://huggingface.co/SeeSee21/Z-Anime/resolve/main/diffusion_models/z-anime-distill-4step-bf16.safetensors" \
|
| 45 |
+
&& /app/sd-cli -M convert \
|
| 46 |
+
-m /app/models/z-anime-distill-4step-bf16.safetensors \
|
| 47 |
+
-o /app/models/z-anime-distill-4step-Q5_K_M.gguf \
|
| 48 |
+
--type q5_k_m \
|
| 49 |
+
&& rm /app/models/z-anime-distill-4step-bf16.safetensors
|
| 50 |
|
| 51 |
# Download Qwen3-4B text encoder Q8_0 GGUF (~4.28GB)
|
| 52 |
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/qwen3_4b_q8_0.gguf \
|
README.md
CHANGED
|
@@ -20,19 +20,21 @@ startup_duration_timeout: 1h
|
|
| 20 |
|
| 21 |
# Z-Anime Image Generation (CPU)
|
| 22 |
|
| 23 |
-
Generate anime images with [Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime) (S3-DiT, distill
|
| 24 |
|
| 25 |
## Models
|
| 26 |
|
| 27 |
| Component | File | Size |
|
| 28 |
|-----------|------|------|
|
| 29 |
-
| Diffusion (DiT) | Z-Anime-
|
| 30 |
| Text Encoder | Qwen3-4B Q8_0 GGUF | 4.28 GB |
|
| 31 |
| VAE | ae.safetensors | 168 MB |
|
| 32 |
|
|
|
|
|
|
|
| 33 |
## Settings
|
| 34 |
|
| 35 |
-
- **Steps:**
|
| 36 |
- **CFG:** 1.0
|
| 37 |
- **Sampler:** euler_ancestral
|
| 38 |
- **Resolution:** 512x512 (recommended on CPU)
|
|
|
|
| 20 |
|
| 21 |
# Z-Anime Image Generation (CPU)
|
| 22 |
|
| 23 |
+
Generate anime images with [Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime) (S3-DiT, distill 4-step) via [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp). Runs on free CPU Spaces.
|
| 24 |
|
| 25 |
## Models
|
| 26 |
|
| 27 |
| Component | File | Size |
|
| 28 |
|-----------|------|------|
|
| 29 |
+
| Diffusion (DiT) | Z-Anime distill-4step Q5_K_M GGUF | ~4.5 GB |
|
| 30 |
| Text Encoder | Qwen3-4B Q8_0 GGUF | 4.28 GB |
|
| 31 |
| VAE | ae.safetensors | 168 MB |
|
| 32 |
|
| 33 |
+
GGUF converted at build time from [Z-Anime BF16](https://huggingface.co/SeeSee21/Z-Anime/blob/main/diffusion_models/z-anime-distill-4step-bf16.safetensors).
|
| 34 |
+
|
| 35 |
## Settings
|
| 36 |
|
| 37 |
+
- **Steps:** 4 (distilled)
|
| 38 |
- **CFG:** 1.0
|
| 39 |
- **Sampler:** euler_ancestral
|
| 40 |
- **Resolution:** 512x512 (recommended on CPU)
|
app.py
CHANGED
|
@@ -7,12 +7,12 @@ import gradio as gr
|
|
| 7 |
# ---------------------------------------------------------------------------
|
| 8 |
# Model paths (downloaded at build time)
|
| 9 |
# ---------------------------------------------------------------------------
|
| 10 |
-
DIFFUSION = "/app/models/z-anime-
|
| 11 |
LLM = "/app/models/qwen3_4b_q8_0.gguf"
|
| 12 |
VAE = "/app/models/ae.safetensors"
|
| 13 |
|
| 14 |
RESOLUTIONS = ["512x512", "768x512", "512x768"]
|
| 15 |
-
STEPS =
|
| 16 |
CFG = 1.0
|
| 17 |
TIMEOUT = 10800
|
| 18 |
|
|
@@ -108,8 +108,8 @@ def generate(prompt, negative_prompt, resolution, seed):
|
|
| 108 |
# ---------------------------------------------------------------------------
|
| 109 |
with gr.Blocks(title="Z-Anime (CPU)") as demo:
|
| 110 |
gr.Markdown(
|
| 111 |
-
"**[Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime)** S3-DiT
|
| 112 |
-
"(distill
|
| 113 |
"Free CPU inference"
|
| 114 |
)
|
| 115 |
with gr.Row():
|
|
@@ -122,7 +122,7 @@ with gr.Blocks(title="Z-Anime (CPU)") as demo:
|
|
| 122 |
res_input = gr.Dropdown(choices=RESOLUTIONS, value="512x512",
|
| 123 |
label="Resolution")
|
| 124 |
seed_input = gr.Number(value=-1, label="Seed (-1=random)", precision=0)
|
| 125 |
-
gen_btn = gr.Button("Generate (
|
| 126 |
with gr.Column():
|
| 127 |
output_img = gr.Image(type="pil", label="Output")
|
| 128 |
status_box = gr.Textbox(label="Status", interactive=False)
|
|
|
|
| 7 |
# ---------------------------------------------------------------------------
|
| 8 |
# Model paths (downloaded at build time)
|
| 9 |
# ---------------------------------------------------------------------------
|
| 10 |
+
DIFFUSION = "/app/models/z-anime-distill-4step-Q5_K_M.gguf"
|
| 11 |
LLM = "/app/models/qwen3_4b_q8_0.gguf"
|
| 12 |
VAE = "/app/models/ae.safetensors"
|
| 13 |
|
| 14 |
RESOLUTIONS = ["512x512", "768x512", "512x768"]
|
| 15 |
+
STEPS = 4
|
| 16 |
CFG = 1.0
|
| 17 |
TIMEOUT = 10800
|
| 18 |
|
|
|
|
| 108 |
# ---------------------------------------------------------------------------
|
| 109 |
with gr.Blocks(title="Z-Anime (CPU)") as demo:
|
| 110 |
gr.Markdown(
|
| 111 |
+
"**[Z-Anime 6B](https://huggingface.co/SeeSee21/Z-Anime)** S3-DiT Q5_K_M GGUF "
|
| 112 |
+
"(distill 4-step) via [sd.cpp](https://github.com/leejet/stable-diffusion.cpp) | "
|
| 113 |
"Free CPU inference"
|
| 114 |
)
|
| 115 |
with gr.Row():
|
|
|
|
| 122 |
res_input = gr.Dropdown(choices=RESOLUTIONS, value="512x512",
|
| 123 |
label="Resolution")
|
| 124 |
seed_input = gr.Number(value=-1, label="Seed (-1=random)", precision=0)
|
| 125 |
+
gen_btn = gr.Button("Generate (4 steps, CFG 1)", variant="primary", size="lg")
|
| 126 |
with gr.Column():
|
| 127 |
output_img = gr.Image(type="pil", label="Output")
|
| 128 |
status_box = gr.Textbox(label="Status", interactive=False)
|