Text Generation
Transformers
Safetensors
English
Chinese
minimax_m2
minimax
nvfp4
4-bit precision
quantized
compressed-tensors
vllm
DGX-Spark
GB10
MoE
agentic
tool-use
code
conversational
custom_code
8-bit precision
Instructions to use saricles/MiniMax-M2.7-NVFP4-GB10-AC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use saricles/MiniMax-M2.7-NVFP4-GB10-AC with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="saricles/MiniMax-M2.7-NVFP4-GB10-AC", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("saricles/MiniMax-M2.7-NVFP4-GB10-AC", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("saricles/MiniMax-M2.7-NVFP4-GB10-AC", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use saricles/MiniMax-M2.7-NVFP4-GB10-AC with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "saricles/MiniMax-M2.7-NVFP4-GB10-AC" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "saricles/MiniMax-M2.7-NVFP4-GB10-AC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/saricles/MiniMax-M2.7-NVFP4-GB10-AC
- SGLang
How to use saricles/MiniMax-M2.7-NVFP4-GB10-AC 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 "saricles/MiniMax-M2.7-NVFP4-GB10-AC" \ --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": "saricles/MiniMax-M2.7-NVFP4-GB10-AC", "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 "saricles/MiniMax-M2.7-NVFP4-GB10-AC" \ --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": "saricles/MiniMax-M2.7-NVFP4-GB10-AC", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use saricles/MiniMax-M2.7-NVFP4-GB10-AC with Docker Model Runner:
docker model run hf.co/saricles/MiniMax-M2.7-NVFP4-GB10-AC
Add run_vllm.sh: reference dual-Spark launch script with tuned env vars + flag rationale
Browse files- run_vllm.sh +67 -0
run_vllm.sh
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# run_vllm.sh — reference vLLM launch for MiniMax-M2.7-NVFP4-GB10-AC on dual-Spark TP=2.
|
| 3 |
+
#
|
| 4 |
+
# Intended as a drop-in starter. Adjust MODEL_PATH, HOST, PORT, and the TP/cluster args
|
| 5 |
+
# for your own Ray topology. See README.md §"Running on 2× DGX Spark (Tensor Parallel)"
|
| 6 |
+
# for rationale behind every flag.
|
| 7 |
+
#
|
| 8 |
+
# Assumes:
|
| 9 |
+
# - Ray head + worker are already running (one per Spark)
|
| 10 |
+
# - Model is on a shared path or bind-mounted into both containers at MODEL_PATH
|
| 11 |
+
# - vllm ≥ 0.19 with FlashInfer MoE FP4 support
|
| 12 |
+
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
|
| 15 |
+
MODEL_PATH="${MODEL_PATH:-/models/MiniMax-M2.7-NVFP4-GB10-AC}"
|
| 16 |
+
SERVED_NAME="${SERVED_NAME:-minimax-m2.7-ac}"
|
| 17 |
+
HOST="${HOST:-0.0.0.0}"
|
| 18 |
+
PORT="${PORT:-30000}"
|
| 19 |
+
GPU_MEM_UTIL="${GPU_MEM_UTIL:-0.88}"
|
| 20 |
+
MAX_MODEL_LEN="${MAX_MODEL_LEN:-196608}"
|
| 21 |
+
MAX_NUM_SEQS="${MAX_NUM_SEQS:-12}"
|
| 22 |
+
MAX_NUM_BATCHED_TOKENS="${MAX_NUM_BATCHED_TOKENS:-32768}"
|
| 23 |
+
TP_SIZE="${TP_SIZE:-2}"
|
| 24 |
+
|
| 25 |
+
# --- Tuned environment variables ----------------------------------------------
|
| 26 |
+
# Forum + vendor-recipe validated for MiniMax-M2.7 NVFP4 on Blackwell/GB10.
|
| 27 |
+
# The single biggest win is VLLM_USE_FLASHINFER_MOE_FP4=1 — many older images
|
| 28 |
+
# default this to 0, which falls back to the slower CUTLASS MoE path.
|
| 29 |
+
|
| 30 |
+
export VLLM_USE_FLASHINFER_MOE_FP4=1
|
| 31 |
+
export VLLM_NVFP4_GEMM_BACKEND=flashinfer-cutlass
|
| 32 |
+
export VLLM_FLASHINFER_MOE_BACKEND=throughput
|
| 33 |
+
export VLLM_ALLOW_LONG_MAX_MODEL_LEN=1
|
| 34 |
+
export VLLM_FLOAT32_MATMUL_PRECISION=high
|
| 35 |
+
export VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS=1
|
| 36 |
+
export SAFETENSORS_FAST_GPU=1
|
| 37 |
+
export OMP_NUM_THREADS=8
|
| 38 |
+
|
| 39 |
+
# --- Compilation config -------------------------------------------------------
|
| 40 |
+
# cudagraph_mode=none is INTENTIONAL for dual-Spark Ray TP.
|
| 41 |
+
# PIECEWISE captures cleanly in current vLLM builds (historical deadlock is fixed)
|
| 42 |
+
# but measurably regresses decode throughput 12–20% on multi-node TP because each
|
| 43 |
+
# piece boundary forces a cross-node sync whose cost exceeds the launch-overhead
|
| 44 |
+
# savings. Revisit if you change the distributed_executor_backend away from Ray
|
| 45 |
+
# or run on a single Spark.
|
| 46 |
+
|
| 47 |
+
COMPILATION_CONFIG='{"cudagraph_mode":"none","inductor_compile_config":{"combo_kernels":false,"benchmark_combo_kernel":false,"max_autotune":false,"max_autotune_gemm":false}}'
|
| 48 |
+
|
| 49 |
+
# --- vLLM serve ---------------------------------------------------------------
|
| 50 |
+
exec vllm serve "$MODEL_PATH" \
|
| 51 |
+
--host "$HOST" --port "$PORT" \
|
| 52 |
+
--served-model-name "$SERVED_NAME" \
|
| 53 |
+
--tensor-parallel-size "$TP_SIZE" \
|
| 54 |
+
--distributed-executor-backend ray \
|
| 55 |
+
--gpu-memory-utilization "$GPU_MEM_UTIL" \
|
| 56 |
+
--max-model-len "$MAX_MODEL_LEN" \
|
| 57 |
+
--max-num-seqs "$MAX_NUM_SEQS" \
|
| 58 |
+
--max-num-batched-tokens "$MAX_NUM_BATCHED_TOKENS" \
|
| 59 |
+
--kv-cache-dtype fp8_e4m3 \
|
| 60 |
+
--attention-backend flashinfer \
|
| 61 |
+
--attention-config.use_trtllm_attention=0 \
|
| 62 |
+
--enable-prefix-caching \
|
| 63 |
+
--enable-chunked-prefill \
|
| 64 |
+
--trust-remote-code \
|
| 65 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 66 |
+
--reasoning-parser minimax_m2_append_think \
|
| 67 |
+
--compilation-config "$COMPILATION_CONFIG"
|