Instructions to use MiniMaxAI/MiniMax-M3.1-Flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-M3.1-Flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MiniMaxAI/MiniMax-M3.1-Flash", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("MiniMaxAI/MiniMax-M3.1-Flash", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("MiniMaxAI/MiniMax-M3.1-Flash", trust_remote_code=True, 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-M3.1-Flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-M3.1-Flash" # 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-M3.1-Flash", "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/MiniMaxAI/MiniMax-M3.1-Flash
- SGLang
How to use MiniMaxAI/MiniMax-M3.1-Flash 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-M3.1-Flash" \ --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-M3.1-Flash", "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 "MiniMaxAI/MiniMax-M3.1-Flash" \ --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-M3.1-Flash", "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 MiniMaxAI/MiniMax-M3.1-Flash with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-M3.1-Flash
Download docs/FlagOS-Multi-Chip-Support-and-Downloads.md from MiniMaxAI/MiniMax-M3.1-Flash: direct link, hf CLI and curl.
- Browser
- Download file 8.26 kB
-
https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash/resolve/refs%2Fpr%2F7/docs/FlagOS-Multi-Chip-Support-and-Downloads.md
- Command line
-
hf download hf://MiniMaxAI/MiniMax-M3.1-Flash@refs/pr/7/docs/FlagOS-Multi-Chip-Support-and-Downloads.md
-
curl -L -o FlagOS-Multi-Chip-Support-and-Downloads.md https://huggingface.co/MiniMaxAI/MiniMax-M3.1-Flash/resolve/refs%2Fpr%2F7/docs/FlagOS-Multi-Chip-Support-and-Downloads.md
Multi-Chip Deployment with FlagOS
MiniMax-M3.1-Flash supports multi-chip deployment through FlagOS. The FlagOS community provides W8A8 quantized versions for platforms from nine chip vendors. The corresponding model repositories provide access to weights, deployment code, and container image instructions.
About FlagOS
The FlagOS Open Source Community was jointly established by the Beijing Academy of Artificial Intelligence (BAAI), research institutions, chip manufacturers, system vendors, and algorithm and software organizations. It develops a unified, open-source system software stack for diverse AI chips.
FlagOS includes the FlagGems operator library, FlagTree AI compiler, FlagScale parallel training and inference framework, and FlagCX communication library. These projects connect the model, system, and chip layers, helping developers reuse model code and software components while reducing migration and maintenance costs. For inference deployment, vLLM-plugin-FL and SGLang-plugin-FL extend hardware support while preserving the original framework interfaces and usage patterns.
Website: flagos.io | Community: GitHub / GitCode
Multi-Chip Support and Downloads
FlagRelease is the FlagOS team's platform for model migration, adaptation, and release across AI chips. MiniMax-M3.1-Flash is adapted for platforms from nine vendors: T-Head, NVIDIA, MetaX, Hygon, Huawei Ascend, Moore Threads, Iluvatar, Kunlunxin, and Tsingmicro, with W8A8 versions provided across these platforms.
FlagOS converts and requantizes the model's original QAT NVFP4 weights into W8A8 deployment versions, providing a common quantization format across supported chips. The table below lists the model repositories. NVIDIA, Huawei Ascend, Kunlunxin, and T-Head (Zhenwu) use Express versions, named MiniMax-M3.1-Flash-W8A8-<platform>-FlagOS-Express; the other platforms use MiniMax-M3.1-Flash-W8A8-<platform>-FlagOS.
| Chip Vendor / Platform | ModelScope | Hugging Face |
|---|---|---|
| T-Head (Zhenwu) | Model repository | Model repository |
| NVIDIA | Model repository | Model repository |
| MetaX | Model repository | Model repository |
| Hygon | Model repository | Model repository |
| Huawei Ascend | Model repository | Model repository |
| Moore Threads | Model repository | Model repository |
| Iluvatar | Model repository | Model repository |
| Kunlunxin | Model repository | Model repository |
| Tsingmicro | Model repository | Model repository |
Installation and Usage
Option 1: Use a FlagRelease Image (Recommended)
FlagRelease provides deployment environments for the supported platforms:
- Select your target chip platform from the table above and open the corresponding model repository.
- Follow the model card to prepare the host drivers and runtime, download the model weights, pull and start the container image, and configure device mappings and model directory mounts.
- Start the inference service or run the examples inside the container using the commands in the model card. Refer to that card for accelerator count, memory requirements, parallelism, model paths, framework versions, and startup parameters.
Option 2: Install from Source
MiniMax-M3.1-Flash supports deployment through vLLM-plugin-FL and SGLang-plugin-FL. Refer to the corresponding model card for framework versions, plugin branches, and model-specific dependencies.
Official developer guides:
The following example installs the base components used for the T-Head platform in this adaptation: vLLM v0.24.0, vllm-plugin-FL v0.3.0, and FlagGems v5.4.0. First prepare the chip drivers, runtime, compatible PyTorch build, and build dependencies as described in the model card. Apply any model-specific patches and additional configuration required by that card.
# 1. Install vLLM v0.24.0 (T-Head example)
git clone --branch v0.24.0 https://github.com/vllm-project/vllm.git
cd vllm
VLLM_TARGET_DEVICE=empty python -m pip install -v --no-build-isolation --no-deps .
cd ..
# 2. Install vllm-plugin-FL v0.3.0
git clone --branch v0.3.0 https://github.com/flagos-ai/vllm-plugin-FL.git
cd vllm-plugin-FL
python -m pip install --no-build-isolation -e .
cd ..
# 3. Install FlagGems v5.4.0
python -m pip install scikit-build-core==0.11 pybind11 ninja cmake
git clone --branch v5.4.0 https://github.com/flagos-ai/FlagGems.git
cd FlagGems
python -m pip install --no-build-isolation -e .
cd ..
Install the FlagTree unified compiler and FlagCX communication library as required by your platform, and complete the environment and communication configuration described in the model card. For CUDA/HIP environments that use PyTorch's CUDA dispatch key, refer to the plugin installation guide for native extension build instructions.
Run Inference
The following text generation example uses MiniMax-M3.1-Flash W8A8 Express on T-Head with tensor_parallel_size=8. Run it in a configured vLLM-plugin-FL environment or the corresponding container, on hardware that meets the model card's requirements. Accelerator counts and parallelism settings for other platforms are specified in their model cards.
Save the code as inference.py:
from vllm import LLM, SamplingParams
if __name__ == "__main__":
prompts = ["Please introduce MiniMax-M3.1-Flash."]
sampling_params = SamplingParams(max_tokens=512, temperature=0.0)
llm = LLM(
model="FlagRelease/MiniMax-M3.1-Flash-W8A8-zhenwu-FlagOS-Express",
tensor_parallel_size=8,
trust_remote_code=True,
)
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
print(f"Prompt: {output.prompt!r}")
print(f"Generated: {output.outputs[0].text!r}")
VLLM_PLUGINS=fl python inference.py
To use local weights, replace model with the downloaded model directory. When changing chip platforms, select the corresponding repository from the table and adjust tensor_parallel_size, max_model_len, max_num_batched_tokens, and max_num_seqs according to its model card. Refer to the platform's model card for online serving, chat templates, multimodal inputs, DSpark speculative decoding, and reasoning_effort configuration.