Instructions to use Disty0/Ideogram-4-SDNQ-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Disty0/Ideogram-4-SDNQ-FP8 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Disty0/Ideogram-4-SDNQ-FP8", 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
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model_relation: quantized
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
tags:
|
| 5 |
+
- sdnq
|
| 6 |
+
- ideogram
|
| 7 |
+
- ideogram_4
|
| 8 |
+
- 8-bit
|
| 9 |
+
base_model:
|
| 10 |
+
- ideogram-ai/ideogram-4-fp8
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
This model is a direct conversion of [Ideogram-4 FP8](https://huggingface.co/ideogram-ai/ideogram-4-fp8) to [SDNQ](https://github.com/Disty0/sdnq) Diffusers format with identical weights from the original FP8 model.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
```py
|
| 17 |
+
import os
|
| 18 |
+
import json
|
| 19 |
+
import requests
|
| 20 |
+
|
| 21 |
+
import torch
|
| 22 |
+
import diffusers
|
| 23 |
+
from sdnq import SDNQConfig # import sdnq to register it into diffusers and transformers
|
| 24 |
+
|
| 25 |
+
pipe = diffusers.Ideogram4Pipeline.from_pretrained("Disty0/Ideogram-4-SDNQ-FP8", torch_dtype=torch.bfloat16)
|
| 26 |
+
pipe.enable_model_cpu_offload()
|
| 27 |
+
|
| 28 |
+
# Expand the prompt into a structured JSON caption with Ideogram's free hosted magic-prompt API.
|
| 29 |
+
# Get a key at https://developer.ideogram.ai/ (set IDEOGRAM_API_KEY).
|
| 30 |
+
resp = requests.post(
|
| 31 |
+
"https://api.ideogram.ai/v1/ideogram-v4/magic-prompt",
|
| 32 |
+
headers={"Api-Key": "your_ideogram_api_key"},
|
| 33 |
+
json={"text_prompt": "a ginger cat wearing a tiny wizard hat reading a spellbook", "aspect_ratio": "1x1"},
|
| 34 |
+
).json()
|
| 35 |
+
caption = json.dumps(resp["json_prompt"]) # or: token="hf_xxxxxxxxx", token is needed as the repo is gated
|
| 36 |
+
|
| 37 |
+
# Pass the caption straight to the pipeline (no prompt_upsampling — it's already upsampled).
|
| 38 |
+
image = pipe(
|
| 39 |
+
caption,
|
| 40 |
+
height=1024, # model supports up to 2048
|
| 41 |
+
width=1024, # model supports up to 2048
|
| 42 |
+
generator=torch.manual_seed(0),
|
| 43 |
+
).images[0]
|
| 44 |
+
image.save("ideogram4-sdnq-fp8.png")
|
| 45 |
+
```
|