[diffusion] model: support Ideogram4 NVFP4 (#27379)
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Ideogram 4
|
||||
metatags:
|
||||
description: "Deploy Ideogram 4 with SGLang Diffusion for high-aesthetic text-to-image generation."
|
||||
---
|
||||
|
||||
## 1. Model introduction
|
||||
|
||||
[Ideogram 4](https://huggingface.co/ideogram-ai/ideogram-4-nf4) is Ideogram's text-to-image diffusion model. SGLang Diffusion supports the official NF4 checkpoint, the official FP8 checkpoint, and the Comfy-Org NVFP4 transformer checkpoint.
|
||||
|
||||
Compared with previous open-source image models, Ideogram 4 provides a significant aesthetic lift, with stronger composition, more polished visual style, and better typography-aware generation.
|
||||
|
||||
| Variant | Hugging Face model ID | Notes |
|
||||
| --- | --- | --- |
|
||||
| NF4 | `ideogram-ai/ideogram-4-nf4` | Official bitsandbytes NF4 checkpoint. Use this path first for low-memory deployment. |
|
||||
| FP8 | `ideogram-ai/ideogram-4-fp8` | Official FP8 checkpoint. |
|
||||
| NVFP4 | `Comfy-Org/Ideogram-4` | Comfy-Org NVFP4 transformer weights. SGLang loads non-transformer components from `ideogram-ai/ideogram-4-fp8`. |
|
||||
|
||||
## 2. Prerequisites
|
||||
|
||||
- NVIDIA CUDA GPU.
|
||||
- SGLang installed with diffusion dependencies.
|
||||
- `bitsandbytes>=0.46.1` for the NF4 checkpoint.
|
||||
- `HF_TOKEN` with access to the Ideogram 4 gated repositories.
|
||||
|
||||
## 3. Serve the model
|
||||
|
||||
NF4:
|
||||
|
||||
```bash Command
|
||||
HF_TOKEN=$HF_TOKEN sglang serve \
|
||||
--model-path ideogram-ai/ideogram-4-nf4 \
|
||||
--num-gpus 1 \
|
||||
--performance-mode auto \
|
||||
--port 30010
|
||||
```
|
||||
|
||||
FP8:
|
||||
|
||||
```bash Command
|
||||
HF_TOKEN=$HF_TOKEN sglang serve \
|
||||
--model-path ideogram-ai/ideogram-4-fp8 \
|
||||
--num-gpus 1 \
|
||||
--performance-mode auto \
|
||||
--port 30010
|
||||
```
|
||||
|
||||
Comfy-Org NVFP4:
|
||||
|
||||
```bash Command
|
||||
HF_TOKEN=$HF_TOKEN sglang serve \
|
||||
--model-path Comfy-Org/Ideogram-4 \
|
||||
--num-gpus 1 \
|
||||
--performance-mode auto \
|
||||
--port 30010
|
||||
```
|
||||
|
||||
Use B200 or another Blackwell GPU for NVFP4.
|
||||
|
||||
## 4. Generate an image
|
||||
|
||||
```python Example
|
||||
import base64
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(api_key="EMPTY", base_url="http://localhost:30010/v1")
|
||||
|
||||
response = client.images.generate(
|
||||
model="ideogram-ai/ideogram-4-nf4",
|
||||
prompt="A cinematic poster of a quiet bookstore at dusk with elegant hand-lettered signage",
|
||||
size="1024x1024",
|
||||
n=1,
|
||||
response_format="b64_json",
|
||||
extra_body={"preset": "V4_QUALITY_48", "seed": 0},
|
||||
)
|
||||
|
||||
image_bytes = base64.b64decode(response.data[0].b64_json)
|
||||
with open("ideogram4.png", "wb") as f:
|
||||
f.write(image_bytes)
|
||||
```
|
||||
|
||||
Ideogram 4 presets are `V4_DEFAULT_20`, `V4_QUALITY_48`, and `V4_TURBO_12`. The preset controls both `num_inference_steps` and guidance, so do not set those fields directly.
|
||||
@@ -23,6 +23,12 @@ Offline models generate each image or video request as a bounded denoising job.
|
||||
href="/cookbook/diffusion/FLUX/FLUX"
|
||||
img="/cards/logos/flux.png"
|
||||
/>
|
||||
<Card
|
||||
title="Ideogram 4"
|
||||
mode="card"
|
||||
href="/cookbook/diffusion/Ideogram/Ideogram4"
|
||||
img="/cards/logos/ideogram.png"
|
||||
/>
|
||||
<Card
|
||||
title="Wan"
|
||||
mode="card"
|
||||
|
||||
Reference in New Issue
Block a user