Text-to-Image
Diffusers
Safetensors
English
Chinese
QwenImage21Pipeline
bitsandbytes
int8
image-generation
image-editing
rgba
8-bit precision
Instructions to use ixim/Image21-INT8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use ixim/Image21-INT8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("ixim/Image21-INT8", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
File size: 5,871 Bytes
1435032 ba48d54 1435032 ba48d54 1435032 ba48d54 1435032 ba48d54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """Render the release editing comparisons, without investigation history."""
import json
from pathlib import Path
from scripts.model_card import original_url
def render_audit(evaluation, platform):
root = Path(evaluation)
zh = platform == 'modelscope'
def tr(en, cn):
return cn if zh else en
def picture(label, path):
url = original_url(platform, path)
return f'[]({url})'
path = root/'editing/summary.json'
if not path.exists():
return ''
data = json.loads(path.read_text(encoding='utf-8'))
lines = [tr('### 2048px image editing comparisons', '### 2048px 改图对比'), '',
tr('Four paired editing examples are shown with their shared input, generated by BF16 in this evaluation. Outputs use 2048×2048, '
'40 steps, seed 42, CFG=1, KV cache and model CPU offload. Both precisions enable default '
'VAE tiling (256px minimum tiles, 192px strides). The 1024px input PNGs are resized inside '
'the pipeline with output_resolution=2048. All images link to the full original PNG.',
'下列四组改图展示共同输入及成对输出;输入均为本次测评的 BF16 生成图。输出统一为 2048×2048、40 步、种子 42、CFG=1,'
'启用 KV 缓存与按模型 CPU 卸载;两种精度均开启默认 VAE 分块(最小块 256px、步幅 192px)。'
'流水线按 output_resolution=2048 处理 1024px 输入 PNG。点击任意样图可打开完整原图。'), '',
tr('The sweater example at 1024px changes the requested color but fails to preserve image texture. '
'At 2048px with tiling, both precisions better preserve the soft light and skin texture. '
'RGB input, KV-cache-off and 1024px tiling checks did not visibly resolve that failure; '
'an untiled 2048px call was stopped during memory-constrained decoding and is excluded. '
'These few checks do not establish a root cause or universal editing reliability.',
'1024px 毛衣改色虽完成颜色变化,但未保持原图质感;2048px 配合分块时,两种精度均较好保留柔和光线与皮肤纹理。'
'RGB 输入、关闭 KV 缓存及 1024px 分块尝试未明显改善该失败;一次未分块的 2048px 调用因解码显存受限终止,不计入结果。'
'这些有限尝试尚不能确定根因或证明所有改图任务均可靠。'), '']
for item in data['cases']:
label = item['zh' if zh else 'en']
lines.extend([f'#### {label}', '', '**Prompt:** ' + item['prompt'], '',
tr('| Shared input | BF16 | INT8 |', '| 共同输入 | BF16 | INT8 |'), '|---|---|---|',
'| ' + ' | '.join(picture(label+' '+name, item[key]) for name, key in
[('input', 'input'), ('BF16', 'bf16'), ('INT8', 'int8')]) + ' |', '',
item['observation_zh' if zh else 'observation_en'], ''])
lines.extend([tr('#### Editing measurements (three-case timed set)', '#### 改图测量(三用例计时组)'), '',
tr('The clothing-color, cup-material and bird-background cases each have one timed call per precision '
'after one full-settings warmup. The older-woman sweater example is a separate cold, instrumented '
'call and is shown for visual comparison only; its latency is not pooled here. '
'These timings must not be compared directly with the 1024px mean.',
'女性毛衣改色、杯子材质、翠鸟背景三个用例各在一次完整设置预热后计时,每种精度各调用一次。'
'老年女性毛衣样例来自单独的、含记录开销的冷启动调用,仅作图像展示,耗时不混入本表。'
'本表耗时不宜与 1024px 均值直接比较。'), '',
tr('| Case | BF16 s | INT8 s | BF16 allocated peak GiB | INT8 allocated peak GiB |',
'| 用例 | BF16 秒 | INT8 秒 | BF16 分配峰值 GiB | INT8 分配峰值 GiB |'), '|---|---:|---:|---:|---:|'])
for row in data['measurements']:
lines.append(f"| {row['case_id']} | {row['bf16_seconds']:.2f} | {row['int8_seconds']:.2f} | "
f"{row['bf16_peak_gib']:.2f} | {row['int8_peak_gib']:.2f} |")
lines.extend(['', tr('Every measured output from the three declared cases is included above. '
'Visual observations are subjective and are not identity, material-recognition or instruction-following scores.',
'三个预先声明用例的全部计时输出均在上文展示。视觉观察为主观描述,不属于身份、材质识别或指令遵循的量化评分。'), '',
tr('Raw records and reproduction: ', '原始记录与复现:') +
'[BF16](evaluation/editing/bf16/records.jsonl), [INT8](evaluation/editing/int8/records.jsonl), '
'[summary](evaluation/editing/summary.json), [process isolation](evaluation/editing/process-isolation.jsonl), '
'[cases](benchmarks/editing.json), [measured case-file bytes](evaluation/editing/measured-cases.zip), [runner](scripts/benchmark_edits.py).', '',
tr('Editing example using the pipeline loaded above:', '使用上文已加载的流水线编辑:'), '',
'```python', 'from PIL import Image', 'pipe.vae.enable_tiling()', 'image = pipe(',
' prompt="Change only the blue sweater to a red sweater. Preserve the same person, face, pose, lighting and background.",',
' image=Image.open("input.png"),', ' width=2048, height=2048, output_resolution=2048,',
' num_inference_steps=40, true_cfg_scale=1.0, use_kv_cache=True,',
' generator=torch.Generator("cpu").manual_seed(42),', ').images[0]', 'image.save("edit.png")', '```', ''])
return '\n'.join(lines)
|