nifleisch commited on
Commit
ee4a685
·
verified ·
1 Parent(s): 7f81b36

Install diffusers from GitHub and use the new repo name

Browse files
Files changed (2) hide show
  1. README.md +38 -20
  2. modular_model_index.json +10 -10
README.md CHANGED
@@ -67,11 +67,11 @@ tags:
67
  **P-H3-Image** is an image model for text-to-image generation and image editing, based on
68
  [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3). It renders 8-megapixel images in 8 steps without
69
  classifier-free guidance, edits with up to 8 input images, and comes with a prompt upsampler that turns a one-line
70
- request into the full prompt p-h3-image renders best. It is strongest at photorealism, film and editorial looks, and
71
  graphic styles with short quoted text.
72
 
73
  This repository holds the [diffusers](https://github.com/huggingface/diffusers) pipeline. For ComfyUI, with int8 and
74
- 4-bit files that run in 21 GB of VRAM, see [PrunaAI/p-h3-image-comfy](https://huggingface.co/PrunaAI/p-h3-image-comfy).
75
 
76
  | | |
77
  |---|---|
@@ -85,17 +85,18 @@ This repository holds the [diffusers](https://github.com/huggingface/diffusers)
85
  ## Quickstart
86
 
87
  Runs text-to-image and editing with the same pipeline. At 8 MP in bf16 it needs a GPU with about 101 GB of memory,
88
- such as one H200 or B200.
89
 
90
  ```bash
91
- pip install -U diffusers transformers accelerate torch pillow
 
92
  ```
93
 
94
  ```python
95
  import torch
96
  from diffusers import ModularPipeline
97
 
98
- pipe = ModularPipeline.from_pretrained("PrunaAI/p-h3-image")
99
  pipe.load_components(dtype=torch.bfloat16)
100
  pipe.to("cuda")
101
 
@@ -134,7 +135,7 @@ composed = pipe(
134
  <img src="assets/resolutions.png" width="100%">
135
  </p>
136
 
137
- p-h3-image works best at **8 MP**. Images at 2 and 4 MP can be good too, but artifacts become more frequent, especially
138
  in faces, hands and small details. For text-to-image, use one of the 8 MP sizes below. The default is 2912 × 2912.
139
 
140
  Edits work best at 4 or 8 MP. Without `height` and `width`, the edit is generated at the size of Picture 1, scaled up to
@@ -176,7 +177,7 @@ resolutions because the noise changes with the image size.*
176
 
177
  ## Prompting
178
 
179
- p-h3-image is sensitive to prompting and renders full, specific prompts much better than short requests. The pipeline
180
  therefore runs a prompt upsampler, based on Qwen3.5-9B, on every request. It writes a detailed prompt for the aspect
181
  ratio of `height` and `width`, or, for an edit, a brief of what to keep and what to change. The prompt it wrote comes
182
  back as the `prompt` output.
@@ -189,10 +190,10 @@ print(out["prompt"])
189
  To render a prompt as written, remove the step from the blocks.
190
 
191
  ```python
192
- blocks = ModularPipeline.from_pretrained("PrunaAI/p-h3-image").blocks
193
  blocks.sub_blocks.pop("prompt_upsampler")
194
 
195
- pipe = blocks.init_pipeline("PrunaAI/p-h3-image")
196
  pipe.load_components(dtype=torch.bfloat16)
197
  pipe.to("cuda")
198
  image = pipe(prompt=prompt, height=3360, width=2496, output="images")[0] # rendered as written
@@ -208,7 +209,7 @@ When you write prompts by hand, four things matter most.
208
  3. **Spell out every word.** Text without its exact words turns into pseudo-text. Put each piece of text in quotes,
209
  keep each string short, say where it sits, and end with "no other text". If you want no text, don't mention signs
210
  or labels at all.
211
- 4. **Leave out hype words.** Stunning, epic, cinematic, vibrant, hyper-detailed, 8k or masterpiece push p-h3-image
212
  toward a glossy, oversaturated, airbrushed look.
213
 
214
  <p align="center">
@@ -231,7 +232,7 @@ text.
231
  ## Editing
232
 
233
  Pass one image to edit it, or a list of up to 8. Picture 1 is the image to edit, and the others are references the
234
- request can name as Picture 2, Picture 3 and so on. The upsampler writes the edit prompt in the form p-h3-image edits
235
  best from, so a short request such as "make the pickup truck red" is enough.
236
 
237
  <p align="center">
@@ -239,17 +240,17 @@ best from, so a short request such as "make the pickup truck red" is enough.
239
  </p>
240
 
241
  *The same short request given as typed (middle) and written as an edit prompt that names what to keep (right), the form
242
- the upsampler writes. As typed, p-h3-image often redraws the whole scene. As an edit prompt, only the requested part
243
  changes.*
244
 
245
- p-h3-image combines many references at once. Given up to 8 pictures and a one-line request, the upsampler names each
246
- picture and what to take from it, and p-h3-image composes them into one scene.
247
 
248
  <p align="center">
249
  <img src="assets/multi_image.jpg" width="100%">
250
  </p>
251
 
252
- *Top, eight public-domain portraits and the dinner party p-h3-image composed from them, from a one-sentence request.
253
  Bottom, eight scientists at a poker table, seven presidents wading through the swamp with an astronaut, and characters
254
  from our own renders in the same swamp.*
255
 
@@ -264,9 +265,26 @@ Edit <Picture 1>. <The change, described as the finished result>. Keep <everythi
264
  - **Describe the result, not the action.** Say how the edited part looks in the finished image, and give new things a
265
  size next to something already there, such as "about the size of the cat's head".
266
  - **Say what stays.** List what must not change, such as faces, poses, the background and the light. Without this
267
- list, p-h3-image tends to redraw the whole image.
268
  - **Quote new text exactly.** Put new text in quotes and name the text around it that must stay.
269
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  ## Performance
271
 
272
  One NVIDIA B200, bf16, batch size 1, 8 MP, no compilation or offloading.
@@ -278,7 +296,7 @@ One NVIDIA B200, bf16, batch size 1, 8 MP, no compilation or offloading.
278
 
279
  The 8 steps run over the checkpoint's own sampling grid. Pass `sigmas` to use another one. There is no guider,
280
  `negative_prompt` or `guidance_scale`. For GPUs with less memory, use the int8 or w4a8 files in
281
- [PrunaAI/p-h3-image-comfy](https://huggingface.co/PrunaAI/p-h3-image-comfy).
282
 
283
  ## Limitations
284
 
@@ -289,17 +307,17 @@ The 8 steps run over the checkpoint's own sampling grid. Pass `sigmas` to use an
289
  longer passages sometimes get single letters wrong. Short quoted strings render well.
290
  - **Lower resolutions show more artifacts.** At 2 and 4 MP, faces, hands and small details break more often than at
291
  8 MP.
292
- - **Single images only.** p-h3-image does not generate video or audio.
293
 
294
  ## License
295
 
296
- p-h3-image is based on MiniMax-H3 and released under the [MiniMax H3 Community License](LICENSE). Please read it before
297
  use. Among other terms, it excludes the European Union, the United Kingdom, the Republic of Korea and the United States
298
  unless you have a separate license from MiniMax, and products built on it must show "Powered by MiniMax H3". The text
299
  encoder's Qwen3-VL-4B parts and the prompt upsampler, based on Qwen3.5-9B, are under the
300
  [Apache License 2.0](LICENSE-APACHE). See [NOTICE](NOTICE) for details.
301
 
302
- p-h3-image would not exist without [MiniMax](https://huggingface.co/MiniMaxAI), who released H3 with open weights, and
303
  the [Qwen team](https://huggingface.co/Qwen).
304
 
305
  ## What's next?
 
67
  **P-H3-Image** is an image model for text-to-image generation and image editing, based on
68
  [MiniMax-H3](https://huggingface.co/MiniMaxAI/MiniMax-H3). It renders 8-megapixel images in 8 steps without
69
  classifier-free guidance, edits with up to 8 input images, and comes with a prompt upsampler that turns a one-line
70
+ request into the full prompt P-H3-Image renders best. It is strongest at photorealism, film and editorial looks, and
71
  graphic styles with short quoted text.
72
 
73
  This repository holds the [diffusers](https://github.com/huggingface/diffusers) pipeline. For ComfyUI, with int8 and
74
+ 4-bit files that run in 21 GB of VRAM, see [PrunaAI/P-H3-Image-Comfy](https://huggingface.co/PrunaAI/P-H3-Image-Comfy).
75
 
76
  | | |
77
  |---|---|
 
85
  ## Quickstart
86
 
87
  Runs text-to-image and editing with the same pipeline. At 8 MP in bf16 it needs a GPU with about 101 GB of memory,
88
+ such as one H200 or B200, or 80 GB with [offloading](#less-gpu-memory).
89
 
90
  ```bash
91
+ pip install git+https://github.com/huggingface/diffusers
92
+ pip install -U transformers accelerate torch pillow
93
  ```
94
 
95
  ```python
96
  import torch
97
  from diffusers import ModularPipeline
98
 
99
+ pipe = ModularPipeline.from_pretrained("PrunaAI/P-H3-Image")
100
  pipe.load_components(dtype=torch.bfloat16)
101
  pipe.to("cuda")
102
 
 
135
  <img src="assets/resolutions.png" width="100%">
136
  </p>
137
 
138
+ P-H3-Image works best at **8 MP**. Images at 2 and 4 MP can be good too, but artifacts become more frequent, especially
139
  in faces, hands and small details. For text-to-image, use one of the 8 MP sizes below. The default is 2912 × 2912.
140
 
141
  Edits work best at 4 or 8 MP. Without `height` and `width`, the edit is generated at the size of Picture 1, scaled up to
 
177
 
178
  ## Prompting
179
 
180
+ P-H3-Image is sensitive to prompting and renders full, specific prompts much better than short requests. The pipeline
181
  therefore runs a prompt upsampler, based on Qwen3.5-9B, on every request. It writes a detailed prompt for the aspect
182
  ratio of `height` and `width`, or, for an edit, a brief of what to keep and what to change. The prompt it wrote comes
183
  back as the `prompt` output.
 
190
  To render a prompt as written, remove the step from the blocks.
191
 
192
  ```python
193
+ blocks = ModularPipeline.from_pretrained("PrunaAI/P-H3-Image").blocks
194
  blocks.sub_blocks.pop("prompt_upsampler")
195
 
196
+ pipe = blocks.init_pipeline("PrunaAI/P-H3-Image")
197
  pipe.load_components(dtype=torch.bfloat16)
198
  pipe.to("cuda")
199
  image = pipe(prompt=prompt, height=3360, width=2496, output="images")[0] # rendered as written
 
209
  3. **Spell out every word.** Text without its exact words turns into pseudo-text. Put each piece of text in quotes,
210
  keep each string short, say where it sits, and end with "no other text". If you want no text, don't mention signs
211
  or labels at all.
212
+ 4. **Leave out hype words.** Stunning, epic, cinematic, vibrant, hyper-detailed, 8k or masterpiece push P-H3-Image
213
  toward a glossy, oversaturated, airbrushed look.
214
 
215
  <p align="center">
 
232
  ## Editing
233
 
234
  Pass one image to edit it, or a list of up to 8. Picture 1 is the image to edit, and the others are references the
235
+ request can name as Picture 2, Picture 3 and so on. The upsampler writes the edit prompt in the form P-H3-Image edits
236
  best from, so a short request such as "make the pickup truck red" is enough.
237
 
238
  <p align="center">
 
240
  </p>
241
 
242
  *The same short request given as typed (middle) and written as an edit prompt that names what to keep (right), the form
243
+ the upsampler writes. As typed, P-H3-Image often redraws the whole scene. As an edit prompt, only the requested part
244
  changes.*
245
 
246
+ P-H3-Image combines many references at once. Given up to 8 pictures and a one-line request, the upsampler names each
247
+ picture and what to take from it, and P-H3-Image composes them into one scene.
248
 
249
  <p align="center">
250
  <img src="assets/multi_image.jpg" width="100%">
251
  </p>
252
 
253
+ *Top, eight public-domain portraits and the dinner party P-H3-Image composed from them, from a one-sentence request.
254
  Bottom, eight scientists at a poker table, seven presidents wading through the swamp with an astronaut, and characters
255
  from our own renders in the same swamp.*
256
 
 
265
  - **Describe the result, not the action.** Say how the edited part looks in the finished image, and give new things a
266
  size next to something already there, such as "about the size of the cat's head".
267
  - **Say what stays.** List what must not change, such as faces, poses, the background and the light. Without this
268
+ list, P-H3-Image tends to redraw the whole image.
269
  - **Quote new text exactly.** Put new text in quotes and name the text around it that must stay.
270
 
271
+ ## Less GPU memory
272
+
273
+ With auto offloading, diffusers moves each component onto the GPU when a step needs it, so the pipeline runs on one
274
+ 80 GB GPU such as an H100, peaking at about 76 GB at 8 MP.
275
+
276
+ ```python
277
+ import torch
278
+ from diffusers import ComponentsManager, ModularPipeline
279
+
280
+ manager = ComponentsManager()
281
+ manager.enable_auto_cpu_offload(device="cuda")
282
+
283
+ pipe = ModularPipeline.from_pretrained("PrunaAI/P-H3-Image", components_manager=manager)
284
+ pipe.load_components(dtype=torch.bfloat16)
285
+ image = pipe(prompt=prompt, height=3360, width=2496, output="images")[0]
286
+ ```
287
+
288
  ## Performance
289
 
290
  One NVIDIA B200, bf16, batch size 1, 8 MP, no compilation or offloading.
 
296
 
297
  The 8 steps run over the checkpoint's own sampling grid. Pass `sigmas` to use another one. There is no guider,
298
  `negative_prompt` or `guidance_scale`. For GPUs with less memory, use the int8 or w4a8 files in
299
+ [PrunaAI/P-H3-Image-Comfy](https://huggingface.co/PrunaAI/P-H3-Image-Comfy).
300
 
301
  ## Limitations
302
 
 
307
  longer passages sometimes get single letters wrong. Short quoted strings render well.
308
  - **Lower resolutions show more artifacts.** At 2 and 4 MP, faces, hands and small details break more often than at
309
  8 MP.
310
+ - **Single images only.** P-H3-Image does not generate video or audio.
311
 
312
  ## License
313
 
314
+ P-H3-Image is based on MiniMax-H3 and released under the [MiniMax H3 Community License](LICENSE). Please read it before
315
  use. Among other terms, it excludes the European Union, the United Kingdom, the Republic of Korea and the United States
316
  unless you have a separate license from MiniMax, and products built on it must show "Powered by MiniMax H3". The text
317
  encoder's Qwen3-VL-4B parts and the prompt upsampler, based on Qwen3.5-9B, are under the
318
  [Apache License 2.0](LICENSE-APACHE). See [NOTICE](NOTICE) for details.
319
 
320
+ P-H3-Image would not exist without [MiniMax](https://huggingface.co/MiniMaxAI), who released H3 with open weights, and
321
  the [Qwen team](https://huggingface.co/Qwen).
322
 
323
  ## What's next?
modular_model_index.json CHANGED
@@ -25,7 +25,7 @@
25
  "transformers",
26
  "Qwen3VLForConditionalGeneration"
27
  ],
28
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
29
  "subfolder": "text_encoder",
30
  "variant": null,
31
  "revision": null
@@ -39,7 +39,7 @@
39
  "diffusers",
40
  "PH3ImageTextConnector"
41
  ],
42
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
43
  "subfolder": "text_connector",
44
  "variant": null,
45
  "revision": null
@@ -53,7 +53,7 @@
53
  "transformers",
54
  "Qwen2TokenizerFast"
55
  ],
56
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
57
  "subfolder": "tokenizer",
58
  "variant": null,
59
  "revision": null
@@ -67,7 +67,7 @@
67
  "transformers",
68
  "Qwen3VLProcessor"
69
  ],
70
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
71
  "subfolder": "processor",
72
  "variant": null,
73
  "revision": null
@@ -81,7 +81,7 @@
81
  "diffusers",
82
  "AutoencoderKLPH3Image"
83
  ],
84
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
85
  "subfolder": "vae",
86
  "variant": null,
87
  "revision": null
@@ -95,7 +95,7 @@
95
  "diffusers",
96
  "MiniMaxH3Transformer3DModel"
97
  ],
98
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
99
  "subfolder": "transformer",
100
  "variant": null,
101
  "revision": null
@@ -109,7 +109,7 @@
109
  "diffusers",
110
  "MiniMaxH3Scheduler"
111
  ],
112
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
113
  "subfolder": "scheduler",
114
  "variant": null,
115
  "revision": null
@@ -123,7 +123,7 @@
123
  "diffusers",
124
  "MiniMaxH3Scheduler"
125
  ],
126
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
127
  "subfolder": "audio_scheduler",
128
  "variant": null,
129
  "revision": null
@@ -133,7 +133,7 @@
133
  "transformers",
134
  "Qwen3_5ForConditionalGeneration",
135
  {
136
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
137
  "revision": null,
138
  "subfolder": "prompt_upsampler",
139
  "type_hint": [
@@ -147,7 +147,7 @@
147
  "transformers",
148
  "AutoProcessor",
149
  {
150
- "pretrained_model_name_or_path": "PrunaAI/p-h3-image",
151
  "revision": null,
152
  "subfolder": "prompt_upsampler_processor",
153
  "type_hint": [
 
25
  "transformers",
26
  "Qwen3VLForConditionalGeneration"
27
  ],
28
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
29
  "subfolder": "text_encoder",
30
  "variant": null,
31
  "revision": null
 
39
  "diffusers",
40
  "PH3ImageTextConnector"
41
  ],
42
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
43
  "subfolder": "text_connector",
44
  "variant": null,
45
  "revision": null
 
53
  "transformers",
54
  "Qwen2TokenizerFast"
55
  ],
56
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
57
  "subfolder": "tokenizer",
58
  "variant": null,
59
  "revision": null
 
67
  "transformers",
68
  "Qwen3VLProcessor"
69
  ],
70
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
71
  "subfolder": "processor",
72
  "variant": null,
73
  "revision": null
 
81
  "diffusers",
82
  "AutoencoderKLPH3Image"
83
  ],
84
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
85
  "subfolder": "vae",
86
  "variant": null,
87
  "revision": null
 
95
  "diffusers",
96
  "MiniMaxH3Transformer3DModel"
97
  ],
98
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
99
  "subfolder": "transformer",
100
  "variant": null,
101
  "revision": null
 
109
  "diffusers",
110
  "MiniMaxH3Scheduler"
111
  ],
112
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
113
  "subfolder": "scheduler",
114
  "variant": null,
115
  "revision": null
 
123
  "diffusers",
124
  "MiniMaxH3Scheduler"
125
  ],
126
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
127
  "subfolder": "audio_scheduler",
128
  "variant": null,
129
  "revision": null
 
133
  "transformers",
134
  "Qwen3_5ForConditionalGeneration",
135
  {
136
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
137
  "revision": null,
138
  "subfolder": "prompt_upsampler",
139
  "type_hint": [
 
147
  "transformers",
148
  "AutoProcessor",
149
  {
150
+ "pretrained_model_name_or_path": "PrunaAI/P-H3-Image",
151
  "revision": null,
152
  "subfolder": "prompt_upsampler_processor",
153
  "type_hint": [