AnimeMix v10 LCM — OpenVINO INT4

將 sca255/animemixv10_lcm(SD 1.5 LCM 動漫模型)轉換為 OpenVINO INT4 權重, 並以 純 CPU 實測 1024×1024 出圖。

optimum-intel 匯出 → NNCF weight-only INT4 量化 → FP16 3.2 GB → INT4 0.90 GB(↓ ~72%)。

本 repo 收錄 40 組 prompt × 80 張實測圖(每組含 1024px 主測與 512px 對照), 是目前這批 OpenVINO INT4 repo 中測試樣本最多的一個。


目錄


快速資訊

項目 內容
基座模型 sca255/animemixv10_lcm(SD 1.5 LCM 動漫蒸餾)
Pipeline StableDiffusionPipeline(SD 1.x 目錄結構)
Scheduler LCMScheduler
量化格式 UNet / text_encoder → INT4;VAE → INT8
模型大小 FP16 3.2 GB → INT4 0.90 GB(↓ ~72%)
推論裝置 CPU(OpenVINO CPU plugin,無需 GPU)
推薦參數 num_inference_steps=8、guidance_scale=1.5
測試樣本 40 組 prompt(seed 42–81)、80 張圖、含逐 step 耗時
轉換工具 optimum 2.3.0 / optimum-intel 2.2.0 / OpenVINO 2026.4.0 / NNCF 3.4.0

特色

  • **體積 ↓ 72%**:FP16 3.2 GB → INT4 0.90 GB,是同批中體積最小的 SD 模型。
  • 8 step 出圖:LCM 蒸餾模型,guidance_scale=1.5 即可出圖,無需拉高 CFG。
  • 40 組 prompt 完整實測:涵蓋標準提示詞、藝術風格、以及 2024 熱門角色 × 經典畫風交叉實驗。
  • 80 張實測圖:每組 prompt 都有 1024px 主測圖與 512px 對照圖。
  • 純 CPU 可用:不依賴 GPU / CUDA。
  • diffusers 目錄結構:可直接 from_pretrained()。

安裝

pip install diffusers==0.37.1 transformers==4.57.6 tokenizers==0.22.0 huggingface-hub==0.35.1 optimum==2.3.0 optimum-intel==2.2.0 openvino==2026.4.0 nncf==3.4.0 torch pillow psutil

僅推論時不需要 nncf;nncf 為重新量化所需。

快速開始

import torch
from optimum.intel import OVDiffusionPipeline

pipe = OVDiffusionPipeline.from_pretrained("HelloSun/animemixv10_lcm-OpenVINO-INT4", compile=True)

image = pipe(
    prompt="1girl, red hanfu, intricate embroidery, golden phoenix headdress, "
             "soft night lighting, tiered pagoda background, lantern lights, "
             "anime style, masterpiece, best quality, ultra detailed",
    height=1024, width=1024,
    num_inference_steps=8, guidance_scale=1.5,
    generator=torch.Generator().manual_seed(42),
).images[0]

image.save("out.png")

完整可執行範例:inference_int4.py 批次生成 + benchmark:generate5.py

推論參數建議

參數 建議值 說明
num_inference_steps 8 LCM 蒸餾步數。請勿增加,8 步已足夠且是此模型的設計值。
guidance_scale 1.5 LCM 模型的標準 CFG 值,調高反而容易劣化。
height / width 1024 實測解析度。SD 1.5 原生為 512,本 repo 實測 1024 以便與 SDXL 系列比較。
compile=True 開啟 編譯模型以取得較佳效能(代價為編譯時間)。

範例結果

全部為 8 steps / guidance 1.5 / 1024×1024 / CPU,seed 固定,可完全重現。

每組另附 512px 對照圖(examples/*_512.png)。

分組說明:01–05 為標準提示詞(seed 42–46)、06–10 為藝術風格提示詞(seed 47–51)、

11–40 為「2024 熱門角色 × 經典畫風」交叉實驗(seed 52–81)。

01_hanfu — seed 42 — 33.7 s

1girl, red hanfu, intricate embroidery, golden phoenix headdress, soft night lighting, tiered pagoda background, lantern lights, anime style, masterpiece, best quality, ultra detailed

01_hanfu

02_astronaut — seed 43 — 32.6 s

1girl astronaut in lush jungle, cold color palette, detailed foliage, cinematic lighting, anime style, masterpiece, best quality, 8k

02_astronaut

03_taipei — seed 44 — 32.3 s

1girl in cyberpunk Taipei at night, heavy rain, neon signs 'TAIPEI' and '台北', wet asphalt reflections, crowded night market, anime style, masterpiece, best quality

03_taipei

04_shiba — seed 45 — 34.1 s

cute shiba inu wearing tiny astronaut helmet, sunflower field under starry sky, dreamy illustration, vibrant colors, anime style, masterpiece, best quality

04_shiba

05_ink — seed 46 — 33.0 s

traditional chinese ink wash landscape, misty mountains, small pagoda on cliff, cranes flying, minimalist, elegant, anime style, masterpiece, best quality

05_ink

06_ghibli_style — seed 47 — 34.5 s

studio ghibli style, 1girl in floating castle, magical clouds, whimsical atmosphere, detailed background, masterpiece, best quality

06_ghibli_style

07_makoto_shinkai — seed 48 — 34.5 s

makoto shinkai style, 1girl under comet sky, breathtaking lighting, detailed clouds, emotional atmosphere, anime style, masterpiece, 8k

07_makoto_shinkai

08_flat_vector — seed 49 — 37.4 s

flat vector illustration, 1girl in modern city, clean geometric shapes, bold colors, minimalist, commercial anime art style, behance trending

08_flat_vector

09_retro_80s — seed 50 — 41.1 s

1980s retro anime, 1girl with neon city background, VHS aesthetic, synthwave colors, cel shaded, nostalgic anime style, masterpiece

09_retro_80s

10_impasto_thick — seed 51 — 33.1 s

thick impasto anime concept art, 1girl with heavy brushstrokes, expressive texture, dramatic lighting, artstation masterpiece, detailed anime style

10_impasto_thick

11_frieren_jojo — seed 52 — 35.0 s

frieren, jojo bizarre adventure style, muscular definition, dramatic poses, thick outlines, speed lines, araki hirohiko artstyle, white hair, elf ears, anime style, masterpiece, best quality, ultra detailed

11_frieren_jojo

12_makima_ghibli — seed 53 — 33.3 s

makima, studio ghibli style, hayao miyazaki, soft watercolor background, whimsical atmosphere, detailed nature, orange hair, red eyes, anime style, masterpiece, best quality

12_makima_ghibli

13_anya_shinkai — seed 54 — 33.2 s

anya forger, makoto shinkai style, comet sky, breathtaking lighting, lens flare, emotional atmosphere, pink hair, green eyes, anime style, masterpiece, 8k

13_anya_shinkai

14_nezuko_clamp — seed 55 — 33.1 s

nezuko kamado, clamp style, xxxholic, tsubasa, elongated limbs, intricate patterns, baroque details, beautiful eyes, bamboo muzzle, anime style, masterpiece

14_nezuko_clamp

15_demiurge_kaguya — seed 56 — 33.6 s

demiurge overlord, kaguya-sama love is war style, a-1 pictures, sharp chin, dramatic lighting, psychological intensity, green glasses, anime style, masterpiece

15_demiurge_kaguya

16_raise_jjk — seed 57 — 33.5 s

raise overlord, jujutsu kaisen style, maplestar, cursed energy effects, domain expansion background, dynamic action, heterochromia, anime style, masterpiece

16_raise_jjk

17_yuni_spyxfamily — seed 58 — 33.4 s

yuni, spy x family style, wit studio, clean lines, cold war aesthetic, 1960s fashion, detailed mechanical, blonde hair, anime style, masterpiece

17_yuni_spyxfamily

18_marin_saiki — seed 59 — 33.8 s

marin kitagawa, saiki k style, gag manga aesthetics, exaggerated expressions, chibi inserts, fourth wall breaks, pink highlights, anime style, masterpiece

18_marin_saiki

19_fern_sotc — seed 60 — 34.0 s

fern, shadow of the colossus style, vast landscapes, ancient ruins, dramatic scale, muted colors, atmospheric, purple hair, anime style, masterpiece

19_fern_sotc

20_ultima_deathnote — seed 61 — 33.5 s

ultima, death note style, ohba obata, high contrast, dramatic shadows, shinigami eyes, gothic atmosphere, white hair, anime style, masterpiece

20_ultima_deathnote

21_yui_haruhi — seed 62 — 33.2 s

yui yuigahama, haruhi suzumiya style, kyoto animation, vibrant school life, energetic poses, detailed backgrounds, short brown hair, anime style, masterpiece

21_yui_haruhi

22_denji_gundam — seed 63 — 33.1 s

denji chainsaw man, gundam unicorn style, mechanical detail, psycho-frame glow, space background, mecha musume, chainsaw head, anime style, masterpiece

22_denji_gundam

23_reze_utena — seed 64 — 32.5 s

reze, revolutionary girl utena style, surreal symbolism, roses, duels, theatrical lighting, ikuhara kunihiko, bomb collar, anime style, masterpiece

23_reze_utena

24_asuna_sao — seed 65 — 32.7 s

asuna yuuki, sao alicization style, a-1 pictures, virtual world aesthetics, glowing particles, fantasy armor, rapier, anime style, masterpiece

24_asuna_sao

25_2b_macross — seed 66 — 33.3 s

2b nier automata, macross style, itano circus, missile trails, transforming mecha, idol concert lighting, blindfold, anime style, masterpiece

25_2b_macross

26_hutao_genshin — seed 67 — 32.5 s

hutao genshin impact, hoyoverse official style, cel shaded, elemental effects, detailed costume, chinese fantasy, ghost motif, anime style, masterpiece

26_hutao_genshin

27_yae_monogatari — seed 68 — 33.3 s

yae miko, monogatari series style, shaft, abstract backgrounds, text overlays, avant-garde framing, dialogue cards, fox ears, anime style, masterpiece

27_yae_monogatari

28_nilou_yugioh — seed 69 — 33.1 s

nilou, yugioh style, kazuki takahashi, sharp angular features, dramatic card game lighting, egyptian motifs, hydro vision, anime style, masterpiece

28_nilou_yugioh

29_claudia_ragnarok — seed 70 — 32.3 s

claudia, record of ragnarok style, muscular definition, divine aura, mythological scale, intense combat poses, valkyrie armor, anime style, masterpiece

29_claudia_ragnarok

30_ellie_tlou — seed 71 — 32.6 s

ellie last of us, hbo series style, photorealistic, post-apocalyptic, fungal details, emotional close-up, guitar, anime style, masterpiece

30_ellie_tlou

31_makima_bluebox — seed 72 — 33.1 s

makima, blue box style, sports anime, badminton court, dynamic motion blur, sweat detail, youthful energy, control devil, anime style, masterpiece

31_makima_bluebox

32_yurei_tezuka — seed 73 — 36.2 s

yurei, tezuka osamu style, astro boy, round designs, expressive eyes, philosophical themes, retro manga, ghost girl, anime style, masterpiece

32_yurei_tezuka

33_masha_gits — seed 74 — 36.0 s

masha, ghost in the shell shirow masamune, cyberpunk detail, mechanical bodies, philosophical cybernetics, major kusanagi vibes, anime style, masterpiece

33_masha_gits

34_jasmine_spycls — seed 75 — 36.2 s

jasmine, spy classroom style, fantasy espionage, magical gadgets, academy setting, vibrant colors, spy training, anime style, masterpiece

34_jasmine_spycls

35_frederica_rezero — seed 76 — 33.3 s

frederica, re zero style, white fox, isekai fantasy, elaborate costumes, emotional depth, snow backgrounds, beast maid, anime style, masterpiece

35_frederica_rezero

36_vivi_bebop — seed 77 — 35.5 s

vivi, cowboy bebop style, watanabe shinichiro, jazz noir, spaceship interior, cigarette smoke, bounty hunter, green hair, anime style, masterpiece

36_vivi_bebop

37_yuri_kotoura — seed 78 — 33.0 s

yuri, kotoura-san style, mind reading, comedic timing, school romance, supernatural elements, soft colors, purple hair, anime style, masterpiece

37_yuri_kotoura

38_emilia_konosuba — seed 79 — 34.0 s

emilia re zero, konosuba style, comedy fantasy, chibi reactions, explosion magic, party dynamics, half elf, anime style, masterpiece

38_emilia_konosuba

39_rosalie_zetsuen — seed 80 — 34.0 s

rosalie, zetsuen no tempest style, bones studio, shakespearean tragedy, magic circles, feudal japan, kusaribe clan, anime style, masterpiece

39_rosalie_zetsuen

40_chisato_lycoris — seed 81 — 32.3 s

chisato nishikigi, lycoris recoil style, a-1 pictures, cafe lyco-reco, dual wield, non-lethal combat, slice of life, red hair, anime style, masterpiece

40_chisato_lycoris

效能實測摘要

完整逐 step 數據見 REPORT.md 與 examples/benchmark.json。

測試環境

項目 內容
CPU Intel(R) Xeon(R) Platinum 8559C
拓撲 2 sockets × 48 cores × 2 threads/core = 192 vCPU(96 實體核心)
RAM 2.0 TiB
虛擬化 KVM(完整虛擬化)
OpenVINO CPU only,2026.4.0(build 2026.4.0-22959-99c81491cc3-releases/2026/4)
設定 num_inference_steps=8、guidance_scale=1.5、1024×1024 + 512×512 對照

總結

指標 主測組 對照組
解析度 1024×1024 512×512
平均總耗時 33.87 s / 張 5.51 s / 張
平均單步耗時 4.00 s 0.63 s
最快 / 最慢 32.27 s / 41.10 s 4.93 s / 7.32 s
對照組倍數 — 6.15×
  • 對照組為同一 prompt/seed 的 512×512 重新推理(非縮圖)。
  • 文字編碼與 VAE decode 的時間已包含在總耗時內。

逐張結果(1024×1024 / 8 steps)

# Prompt Seed 總耗時 (s) 平均單步 (s) 512px 總耗時 (s) 512px 單步 (s)
01_hanfu 42 33.68 3.971 5.47 0.623
02_astronaut 43 32.57 3.868 5.26 0.605
03_taipei 44 32.34 3.829 5.31 0.610
04_shiba 45 34.15 4.028 5.55 0.632
05_ink 46 32.98 3.908 5.86 0.672
06_ghibli_style 47 34.45 4.086 5.56 0.635
07_makoto_shinkai 48 34.54 4.070 6.60 0.753
08_flat_vector 49 37.36 4.383 7.32 0.837
09_retro_80s 50 41.10 4.848 5.36 0.609
10_impasto_thick 51 33.10 3.925 5.24 0.603
11_frieren_jojo 52 34.96 4.090 5.68 0.624
12_makima_ghibli 53 33.33 3.940 5.08 0.583
13_anya_shinkai 54 33.18 3.927 5.07 0.582
14_nezuko_clamp 55 33.15 3.921 5.25 0.605
15_demiurge_kaguya 56 33.57 3.947 5.45 0.620
16_raise_jjk 57 33.51 3.961 5.32 0.593
17_yuni_spyxfamily 58 33.43 3.954 5.50 0.625
18_marin_saiki 59 33.79 3.983 5.68 0.647
19_fern_sotc 60 33.98 4.000 5.80 0.665
20_ultima_deathnote 61 33.52 3.960 5.88 0.674
21_yui_haruhi 62 33.18 3.934 5.36 0.617
22_denji_gundam 63 33.14 3.923 5.04 0.568
23_reze_utena 64 32.47 3.844 5.09 0.584
24_asuna_sao 65 32.67 3.862 5.46 0.622
25_2b_macross 66 33.30 3.960 5.13 0.581
26_hutao_genshin 67 32.51 3.860 5.29 0.600
27_yae_monogatari 68 33.28 3.939 5.63 0.650
28_nilou_yugioh 69 33.15 3.913 5.06 0.573
29_claudia_ragnarok 70 32.27 3.819 5.22 0.601
30_ellie_tlou 71 32.56 3.855 4.93 0.565
31_makima_bluebox 72 33.15 3.894 5.62 0.631
32_yurei_tezuka 73 36.25 4.274 5.71 0.650
33_masha_gits 74 36.05 4.270 5.88 0.663
34_jasmine_spycls 75 36.22 4.274 5.75 0.665
35_frederica_rezero 76 33.28 3.946 5.00 0.573
36_vivi_bebop 77 35.55 4.202 5.90 0.683
37_yuri_kotoura 78 32.96 3.915 5.39 0.612
38_emilia_konosuba 79 33.95 4.012 5.83 0.678
39_rosalie_zetsuen 80 34.04 4.032 5.18 0.589
40_chisato_lycoris 81 32.28 3.821 5.72 0.649
平均 33.87 4.004 5.51 0.629

模型大小

以下為 repo 內 openvino_model.bin 的實際位元組數(Git LFS 記錄值)。

元件 位元組 大小 精度
unet 731,379,912 0.73 GB INT4
text_encoder 83,735,339 0.08 GB INT4
vae_decoder 49,629,030 0.05 GB INT8
vae_encoder 34,267,324 0.03 GB INT8
合計 899,011,605 0.90 GB

FP16 匯出模型約 3.2 GB(unet 2.8 GB + text_encoder 236 MB + vae_decoder 187 MB + vae_encoder 129 MB)——取自原始轉換紀錄;此組分項相加約 3.35 GB,與 3.2 GB 的總數略有出入,請以本表的實測值為準。

SD 1.5 沒有 text_encoder_2,因此只有一個 text encoder 被量化。

檔案結構

.
├── README.md                  # 本文件
├── REPORT.md                  # 完整轉換 + 實測報告
├── model_index.json           # diffusers pipeline 索引
├── openvino_config.json       # OpenVINO 量化設定
├── inference_int4.py          # 單張推論範例
├── generate5.py               # 批次生成 + benchmark(內建 10 組 prompt)
├── quantize_int4.py           # FP16 OV → INT4 OV 量化腳本
├── unet/                      # INT4 UNet
├── text_encoder/              # INT4 CLIP text encoder
├── tokenizer/                 # CLIP tokenizer
├── vae_encoder/               # INT8 VAE encoder
├── vae_decoder/               # INT8 VAE decoder
├── feature_extractor/         # SD 1.x safety checker 前處理設定
├── scheduler/                 # LCMScheduler 設定
└── examples/                  # 80 張實測圖 + benchmark.json + prompts.txt
    ├── *_1024.png             # 主測組(40 張)
    ├── *_512.png              # 對照組(40 張)
    ├── benchmark.json         # 逐 step 耗時 + 系統資訊
    └── prompts.txt            # 40 組 prompt 與 seed

從零復現

# 1. 匯出 FP16 OpenVINO 模型
optimum-cli export openvino \
  -m sca255/animemixv10_lcm \
  --task text-to-image \
  --library diffusers \
  --weight-format fp16 \
  ./animemixv10_lcm-ov-fp16

# 2. NNCF weight-only INT4 量化
python quantize_int4.py --fp16-dir ./animemixv10_lcm-ov-fp16 \
                          --int4-dir  ./animemixv10_lcm-ov-int4

# 3. 單張推論
python inference_int4.py

# 4. 批次生成 + benchmark(腳本內建 10 組 prompt)
python generate5.py --outdir examples

量化設定:

from optimum.intel.openvino.configuration import (
    OVConfig, OVWeightQuantizationConfig, OVPipelineQuantizationConfig,
)

int4_config = OVWeightQuantizationConfig(
    bits=4, sym=False, group_size=128,
    group_size_fallback="adjust", ratio=1.0,
)

pipeline_config = OVPipelineQuantizationConfig(
    quantization_configs={
        "unet":         int4_config,
        "text_encoder": int4_config,
    },
    default_config=OVWeightQuantizationConfig(bits=8, sym=True),
)

已知限制

  • 僅為 weight-only 量化:首次載入 + 編譯約 8.7 s。
  • CPU 專用:本 repo 為 OpenVINO IR 格式,GPU 使用請改用原模型。
  • 8-step 蒸餾模型:num_inference_steps > 8 不會變好。
  • generate5.py 只內建 10 組 prompt:benchmark.json 中的 40 組結果有 30 組(id 11–40)無法由此腳本重現,需自行以相同設定生成。
  • 1–2 s 的固定 overhead:每張總耗時比逐 step 加總多約 1.8–1.9 s,為文字編碼與 VAE decode。
  • 實測解析度 1024px:SD 1.5 原生為 512px,在 512px 下出圖會更快(實測約 5.5 s / 張)。

授權與出處

  • 來源模型:sca255/animemixv10_lcm

  • 授權:openrail++(沿用來源模型授權)

  • 轉換:僅做格式轉換與權重量化,模型權重來自來源模型

使用本模型時請一併遵守來源模型的授權條款與 OpenRAIL++ 使用政策。


Made with OpenVINO + optimum-intel + NNCF

Downloads last month
27
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for HelloSun/animemixv10_lcm-OpenVINO-INT4

Finetuned
(1)
this model