Disty0 commited on
Commit
638069f
·
verified ·
1 Parent(s): 36c72a2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -0
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
+ ```