Text Generation
Transformers
Safetensors
MiniMax H3
English
qwen3_5
image-text-to-text
prompt-expansion
text-to-image
fp4
sglang
conversational
8-bit precision
modelopt
Instructions to use MiniMaxAI/MiniMax-H3-Image-PE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-H3-Image-PE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MiniMaxAI/MiniMax-H3-Image-PE") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MiniMaxAI/MiniMax-H3-Image-PE") model = AutoModelForMultimodalLM.from_pretrained("MiniMaxAI/MiniMax-H3-Image-PE", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MiniMaxAI/MiniMax-H3-Image-PE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-H3-Image-PE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-H3-Image-PE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MiniMaxAI/MiniMax-H3-Image-PE
- SGLang
How to use MiniMaxAI/MiniMax-H3-Image-PE with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MiniMaxAI/MiniMax-H3-Image-PE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-H3-Image-PE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MiniMaxAI/MiniMax-H3-Image-PE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MiniMaxAI/MiniMax-H3-Image-PE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MiniMaxAI/MiniMax-H3-Image-PE with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-H3-Image-PE
Unify image editing terminology and auto aspect-ratio guidance
#3
by Ryan1122 - opened
- README.md +11 -74
- assets/minimax-h3-image.jpg +2 -2
README.md
CHANGED
|
@@ -12,8 +12,6 @@ tags:
|
|
| 12 |
- minimax-h3
|
| 13 |
- fp4
|
| 14 |
- sglang
|
| 15 |
-
base_model:
|
| 16 |
-
- Qwen/Qwen3.8-27B
|
| 17 |
---
|
| 18 |
|
| 19 |
<div align="center">
|
|
@@ -39,12 +37,12 @@ base_model:
|
|
| 39 |
|
| 40 |
Use MiniMax-H3-Image directly via API.
|
| 41 |
|
| 42 |
-
- Global: [platform.minimax.io](
|
| 43 |
|
| 44 |
API docs:
|
| 45 |
-
- Text-to-image: [EN-docs](
|
| 46 |
-
- Image editing: [EN-docs](
|
| 47 |
-
- Prompt expansion: [EN-docs](
|
| 48 |
|
| 49 |
## Introduction
|
| 50 |
|
|
@@ -57,8 +55,13 @@ This repository covers two workflows:
|
|
| 57 |
|
| 58 |
| Workflow | Input | Released assets |
|
| 59 |
| --- | --- | --- |
|
| 60 |
-
| **Text-to-image (T2I) PE** | A text instruction | MiniMax-H3-Image-PE weights (fine-tuned from
|
| 61 |
-
| **Image editing PE** | An editing instruction and reference images | A task prompt and message-assembly example for a vision-language model of your choice
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
The examples below explain how to use MiniMax-H3-Image-PE and the image editing task prompt.
|
| 64 |
|
|
@@ -252,74 +255,8 @@ language you request. `target_aspect_ratio` is a positive-integer `W:H` string.
|
|
| 252 |
If you select an explicit ratio, the model preserves it exactly. If you select
|
| 253 |
`adaptive`, the model determines a numeric ratio for the intended edited image.
|
| 254 |
|
| 255 |
-
## Use with Diffusers
|
| 256 |
-
|
| 257 |
-
MiniMax-H3-Image-PE can also run locally in Transformers through the
|
| 258 |
-
[`diffusers/minimax-h3-image-pe-blocks`](https://huggingface.co/diffusers/minimax-h3-image-pe-blocks)
|
| 259 |
-
Modular Diffusers blocks. The blocks use the released prompts and request
|
| 260 |
-
parameters for T2I PE and Image editing PE, and XGrammar constrains the answer
|
| 261 |
-
to the JSON schema.
|
| 262 |
-
|
| 263 |
-
### Load MiniMax-H3-Image-PE
|
| 264 |
-
|
| 265 |
-
```bash
|
| 266 |
-
pip install -U diffusers transformers xgrammar bitsandbytes kernels flash-linear-attention
|
| 267 |
-
```
|
| 268 |
-
|
| 269 |
-
```python
|
| 270 |
-
import torch
|
| 271 |
-
from diffusers import ModularPipeline
|
| 272 |
-
|
| 273 |
-
pe = ModularPipeline.from_pretrained("diffusers/minimax-h3-image-pe-blocks", trust_remote_code=True)
|
| 274 |
-
pe.load_components(dtype=torch.bfloat16, device_map="cuda")
|
| 275 |
-
```
|
| 276 |
-
|
| 277 |
-
The FP4 weights stay in 4-bit and use about 19 GiB of GPU memory. GPUs with
|
| 278 |
-
native FP4 support run the NVFP4 weights directly; other GPUs use bitsandbytes
|
| 279 |
-
FP4.
|
| 280 |
-
|
| 281 |
-
### Expand a prompt
|
| 282 |
-
|
| 283 |
-
Pass a request to run T2I PE:
|
| 284 |
-
|
| 285 |
-
```python
|
| 286 |
-
state = pe(prompt="An orange tabby cat sleeping on a sunlit windowsill.")
|
| 287 |
-
print(state.get("prompt"), state.get("aspect_ratio"))
|
| 288 |
-
```
|
| 289 |
-
|
| 290 |
-
Pass reference images to run Image editing PE. Refer to the images in their
|
| 291 |
-
supplied order:
|
| 292 |
-
|
| 293 |
-
```python
|
| 294 |
-
state = pe(
|
| 295 |
-
prompt="Replace the bag in the first image with the bag in the second image.",
|
| 296 |
-
image=["source.png", "bag.png"],
|
| 297 |
-
aspect_ratio="adaptive",
|
| 298 |
-
)
|
| 299 |
-
print(state.get("prompt"), state.get("aspect_ratio"))
|
| 300 |
-
```
|
| 301 |
-
|
| 302 |
-
### Inputs and outputs
|
| 303 |
-
|
| 304 |
-
| Name | Description |
|
| 305 |
-
| --- | --- |
|
| 306 |
-
| `prompt` | Input: the request or editing instruction. Output: the expanded caption. |
|
| 307 |
-
| `image` | One or more reference images (PIL images, paths or URLs). Selects Image editing PE. |
|
| 308 |
-
| `aspect_ratio` | Input, Image editing PE only: `adaptive` or an explicit `W:H` ratio. Output: the target ratio. |
|
| 309 |
-
| `enable_thinking` | Reasoning before the answer, `True` by default as in the released request. |
|
| 310 |
-
| `max_new_tokens` | Token budget, including thinking and the final answer. |
|
| 311 |
-
| `seed` | Seed for a reproducible expansion. |
|
| 312 |
-
| `reasoning` | Output: the model's reasoning. |
|
| 313 |
-
|
| 314 |
-
Activations run in bf16, so outputs are not identical to the SGLang deployment
|
| 315 |
-
above.
|
| 316 |
-
|
| 317 |
## License
|
| 318 |
|
| 319 |
- MiniMax-H3-Image-PE is part of MiniMax-H3-Image and is released under the [MiniMax-H3-Image Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE).
|
| 320 |
- MiniMax-H3-Image-PE is derived from [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B), which is licensed under the Apache 2.0 License.
|
| 321 |
- The separate written authorization described in Section IV of the license is requested through [platform.minimax.io/license](https://platform.minimax.io/license).
|
| 322 |
-
|
| 323 |
-
## Contact Us
|
| 324 |
-
|
| 325 |
-
Contact us at [model@minimax.io](mailto:model@minimax.io).
|
|
|
|
| 12 |
- minimax-h3
|
| 13 |
- fp4
|
| 14 |
- sglang
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
<div align="center">
|
|
|
|
| 37 |
|
| 38 |
Use MiniMax-H3-Image directly via API.
|
| 39 |
|
| 40 |
+
- Global: [platform.minimax.io]() | CN: [platform.minimax.cn]()
|
| 41 |
|
| 42 |
API docs:
|
| 43 |
+
- Text-to-image: [EN-docs](), [CN-docs]()
|
| 44 |
+
- Image editing: [EN-docs](), [CN-docs]()
|
| 45 |
+
- Prompt expansion: [EN-docs](), [CN-docs]()
|
| 46 |
|
| 47 |
## Introduction
|
| 48 |
|
|
|
|
| 55 |
|
| 56 |
| Workflow | Input | Released assets |
|
| 57 |
| --- | --- | --- |
|
| 58 |
+
| **Text-to-image (T2I) PE** | A text instruction | MiniMax-H3-Image-PE weights (fine-tuned from Qwen3.8-27B, FP4), task and system prompts, and a client example |
|
| 59 |
+
| **Image editing PE** | An editing instruction and reference images | A task prompt and message-assembly example for a vision-language model of your choice |
|
| 60 |
+
|
| 61 |
+
T2I PE expands the scene, composition and visual details of a generation request.
|
| 62 |
+
Image editing PE describes the intended changes while preserving relevant content from the
|
| 63 |
+
reference images. **Image editing PE is still under development; this release provides its
|
| 64 |
+
prompt only.**
|
| 65 |
|
| 66 |
The examples below explain how to use MiniMax-H3-Image-PE and the image editing task prompt.
|
| 67 |
|
|
|
|
| 255 |
If you select an explicit ratio, the model preserves it exactly. If you select
|
| 256 |
`adaptive`, the model determines a numeric ratio for the intended edited image.
|
| 257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
## License
|
| 259 |
|
| 260 |
- MiniMax-H3-Image-PE is part of MiniMax-H3-Image and is released under the [MiniMax-H3-Image Community License Agreement](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image/blob/main/LICENSE).
|
| 261 |
- MiniMax-H3-Image-PE is derived from [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B), which is licensed under the Apache 2.0 License.
|
| 262 |
- The separate written authorization described in Section IV of the license is requested through [platform.minimax.io/license](https://platform.minimax.io/license).
|
|
|
|
|
|
|
|
|
|
|
|
assets/minimax-h3-image.jpg
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|