Image-Text-to-Text
Transformers
Safetensors
minimax_m3_vl
multimodal
Mixture of Experts
mxfp4
compressed-tensors
quantized
vllm
conversational
custom_code
Instructions to use nwzjk/MiniMax-M3-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nwzjk/MiniMax-M3-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="nwzjk/MiniMax-M3-MXFP4", trust_remote_code=True) 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("nwzjk/MiniMax-M3-MXFP4", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("nwzjk/MiniMax-M3-MXFP4", trust_remote_code=True) 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nwzjk/MiniMax-M3-MXFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nwzjk/MiniMax-M3-MXFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nwzjk/MiniMax-M3-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/nwzjk/MiniMax-M3-MXFP4
- SGLang
How to use nwzjk/MiniMax-M3-MXFP4 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 "nwzjk/MiniMax-M3-MXFP4" \ --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": "nwzjk/MiniMax-M3-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "nwzjk/MiniMax-M3-MXFP4" \ --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": "nwzjk/MiniMax-M3-MXFP4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use nwzjk/MiniMax-M3-MXFP4 with Docker Model Runner:
docker model run hf.co/nwzjk/MiniMax-M3-MXFP4
| """End-to-end reasoning parser tests against a running vLLM server. | |
| Tests all three thinking modes (enabled / disabled / adaptive) across | |
| streaming and non-streaming chat completions. | |
| Usage: | |
| python /tmp/test_reasoning_endpoints.py | |
| """ | |
| import json | |
| import sys | |
| import time | |
| import urllib.request | |
| from typing import Any | |
| ENDPOINT = "http://localhost:8000/v1/chat/completions" | |
| MODEL = "coder" | |
| PROMPT = "用一句话介绍你自己" # short, deterministic enough for a smoke test | |
| def post(payload: dict[str, Any], stream: bool) -> dict[str, Any] | list[dict[str, Any]]: | |
| """Send one request. If stream=True, return list of SSE chunks.""" | |
| body = json.dumps({**payload, "stream": stream}).encode() | |
| req = urllib.request.Request( | |
| ENDPOINT, | |
| data=body, | |
| headers={"Content-Type": "application/json"}, | |
| ) | |
| with urllib.request.urlopen(req, timeout=120) as resp: | |
| if not stream: | |
| return json.loads(resp.read()) | |
| chunks: list[dict[str, Any]] = [] | |
| for raw in resp: | |
| line = raw.decode().strip() | |
| if not line.startswith("data:"): | |
| continue | |
| data = line[len("data:"):].strip() | |
| if data == "[DONE]": | |
| break | |
| chunks.append(json.loads(data)) | |
| return chunks | |
| def check_non_stream(label: str, payload: dict[str, Any]) -> bool: | |
| print(f"\n--- {label} (non-stream) ---") | |
| payload = {**payload, "stream": False, "max_tokens": 200, "temperature": 0.0} | |
| t0 = time.time() | |
| res = post(payload, stream=False) | |
| elapsed = time.time() - t0 | |
| choice = res["choices"][0] | |
| msg = choice["message"] | |
| reasoning = msg.get("reasoning") or "" | |
| content = msg.get("content") or "" | |
| print(f" finish_reason={choice.get('finish_reason')!r}") | |
| print(f" reasoning: {reasoning!r}") | |
| print(f" content: {content!r}") | |
| print(f" latency: {elapsed:.2f}s") | |
| issues: list[str] = [] | |
| mode = payload.get("chat_template_kwargs", {}).get("thinking_mode", "adaptive") | |
| if mode == "enabled": | |
| # Reasoning should be present and start with <think>-ish text; | |
| # content should NOT contain raw <think> or </mm:think> tags. | |
| if not reasoning: | |
| issues.append("enabled mode: empty reasoning") | |
| if "<mm:think>" in content or "</mm:think>" in content: | |
| issues.append(f"enabled mode: raw marker leaked into content: {content!r}") | |
| elif mode == "disabled": | |
| # Reasoning should be empty, content should be the direct answer | |
| # (no <mm:think> prefix). | |
| if reasoning: | |
| issues.append(f"disabled mode: leaked reasoning: {reasoning!r}") | |
| if not content: | |
| issues.append("disabled mode: empty content") | |
| if content.startswith("<mm:think>"): | |
| issues.append(f"disabled mode: content starts with <think>: {content!r}") | |
| else: # adaptive | |
| # Either path is fine; just ensure raw markers don't leak into content. | |
| if "<mm:think>" in content or "</mm:think>" in content: | |
| issues.append(f"adaptive mode: raw marker leaked into content: {content!r}") | |
| if issues: | |
| for i in issues: | |
| print(f" [ISSUE] {i}") | |
| return False | |
| print(" [OK]") | |
| return True | |
| def check_stream(label: str, payload: dict[str, Any]) -> bool: | |
| print(f"\n--- {label} (stream) ---") | |
| payload = {**payload, "stream": True, "max_tokens": 200, "temperature": 0.0} | |
| t0 = time.time() | |
| chunks = post(payload, stream=True) | |
| elapsed = time.time() - t0 | |
| # Reassemble reasoning + content from deltas. | |
| reasoning_parts: list[str] = [] | |
| content_parts: list[str] = [] | |
| finish_reason = None | |
| saw_reasoning_delta = False | |
| saw_content_delta = False | |
| for c in chunks: | |
| ch = c.get("choices", [{}])[0] | |
| delta = ch.get("delta", {}) | |
| if "reasoning" in delta and delta["reasoning"] is not None: | |
| reasoning_parts.append(delta["reasoning"]) | |
| saw_reasoning_delta = True | |
| if "content" in delta and delta["content"] is not None: | |
| content_parts.append(delta["content"]) | |
| saw_content_delta = True | |
| if ch.get("finish_reason"): | |
| finish_reason = ch["finish_reason"] | |
| reasoning = "".join(reasoning_parts) | |
| content = "".join(content_parts) | |
| print(f" chunks: {len(chunks)}, finish_reason={finish_reason!r}") | |
| print(f" reasoning ({len(reasoning)} chars): {reasoning!r}") | |
| print(f" content ({len(content)} chars): {content!r}") | |
| print(f" saw reasoning_delta={saw_reasoning_delta}, content_delta={saw_content_delta}") | |
| print(f" latency: {elapsed:.2f}s") | |
| issues: list[str] = [] | |
| mode = payload.get("chat_template_kwargs", {}).get("thinking_mode", "adaptive") | |
| if mode == "enabled": | |
| if not reasoning: | |
| issues.append("enabled mode: empty reasoning across all deltas") | |
| if "<mm:think>" in content or "</mm:think>" in content: | |
| issues.append(f"enabled mode: raw marker leaked into streamed content: {content!r}") | |
| elif mode == "disabled": | |
| if reasoning: | |
| issues.append(f"disabled mode: reasoning streamed: {reasoning!r}") | |
| if not content: | |
| issues.append("disabled mode: empty streamed content") | |
| if content.startswith("<mm:think>"): | |
| issues.append(f"disabled mode: streamed content starts with <think>: {content!r}") | |
| else: | |
| if "<mm:think>" in content or "</mm:think>" in content: | |
| issues.append(f"adaptive mode: raw marker leaked into streamed content: {content!r}") | |
| if issues: | |
| for i in issues: | |
| print(f" [ISSUE] {i}") | |
| return False | |
| print(" [OK]") | |
| return True | |
| def main() -> None: | |
| base_payload = { | |
| "model": MODEL, | |
| "messages": [{"role": "user", "content": PROMPT}], | |
| } | |
| results: list[bool] = [] | |
| for mode in ["enabled", "disabled", "adaptive"]: | |
| payload = {**base_payload, "chat_template_kwargs": {"thinking_mode": mode}} | |
| results.append(check_non_stream(f"thinking_mode={mode}", payload)) | |
| results.append(check_stream(f"thinking_mode={mode}", payload)) | |
| passed = sum(results) | |
| print(f"\n=== {passed}/{len(results)} endpoint checks passed ===") | |
| sys.exit(0 if passed == len(results) else 1) | |
| if __name__ == "__main__": | |
| main() | |