Run this model with HF Jobs
Run MiniMaxAI/MiniMax-M2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/MiniMaxAI/MiniMax-M2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MiniMaxAI/MiniMax-M2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/MiniMaxAI/MiniMax-M2. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/MiniMaxAI/MiniMax-M2. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use MiniMaxAI/MiniMax-M2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MiniMaxAI/MiniMax-M2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MiniMaxAI/MiniMax-M2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MiniMaxAI/MiniMax-M2", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("MiniMaxAI/MiniMax-M2", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MiniMaxAI/MiniMax-M2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MiniMaxAI/MiniMax-M2" # 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-M2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MiniMaxAI/MiniMax-M2
- SGLang
How to use MiniMaxAI/MiniMax-M2 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-M2" \ --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-M2", "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-M2" \ --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-M2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MiniMaxAI/MiniMax-M2 with Docker Model Runner:
docker model run hf.co/MiniMaxAI/MiniMax-M2
jiaxin commited on
Commit ·
c4075e3
1
Parent(s): 8abcad7
update README
Browse filesFiles changed (3)
33 unmodified lines34353637383940414233 unmodified lines建议在全新的 Python 环境中安装 SGLang。由于尚未 release,需要从源码手动编译:```bashgit clone https://github.com/sgl-project/sglang.gitcd sglanguv pip install ./python --torch-backend=auto```运行如下命令启动 SGLang 服务器,SGLang 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。33 unmodified lines34353637383940414243444533 unmodified lines建议在全新的 Python 环境中安装 SGLang。由于尚未 release,需要从源码手动编译:```bashgit clone -b v0.5.4.post3 https://github.com/sgl-project/sglang.gitcd sglang# Install the python packagespip install --upgrade pippip install -e "python"```运行如下命令启动 SGLang 服务器,SGLang 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。
41 unmodified lines4243444546471 unmodified line495051525354555626 unmodified lines83848586878841 unmodified linesRun the following command to start the vLLM server. vLLM will automatically download and cache the MiniMax-M2 model from Hugging Face.8-GPU deployment command:```bash1 unmodified lineMiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think \--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"```## Testing Deployment26 unmodified linesThis vLLM version is outdated. Please upgrade to the latest version.## Getting SupportIf you encounter any issues while deploying the MiniMax model:41 unmodified lines424344454647484950515253545556571 unmodified line5960616263646526 unmodified lines929394959697989910010110210310410510610710810941 unmodified linesRun the following command to start the vLLM server. vLLM will automatically download and cache the MiniMax-M2 model from Hugging Face.4-GPU deployment command:```bashSAFETENSORS_FAST_GPU=1 vllm serve \MiniMaxAI/MiniMax-M2 --trust-remote-code \--tensor-parallel-size 4 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think```8-GPU deployment command:```bash1 unmodified lineMiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think```## Testing Deployment26 unmodified linesThis vLLM version is outdated. Please upgrade to the latest version.### torch.AcceleratorError: CUDA error: an illegal memory access was encounteredAdd `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` to the startup parameters to resolve this issue. For example:```bashSAFETENSORS_FAST_GPU=1 vllm serve \MiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think \--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"```## Getting SupportIf you encounter any issues while deploying the MiniMax model:
40 unmodified lines4142434445461 unmodified line484950515253545526 unmodified lines82838485868740 unmodified lines运行如下命令启动 vLLM 服务器,vLLM 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。8 卡部署命令:```bash1 unmodified lineMiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think \--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"```## 测试部署26 unmodified lines该 vLLM 版本过旧,请升级到最新版本。## 获取支持如果在部署 MiniMax 模型过程中遇到任何问题:40 unmodified lines414243444546474849505152535455561 unmodified line5859606162636426 unmodified lines91929394959697989910010110210310410510610710840 unmodified lines运行如下命令启动 vLLM 服务器,vLLM 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。4 卡部署命令:```bashSAFETENSORS_FAST_GPU=1 vllm serve \MiniMaxAI/MiniMax-M2 --trust-remote-code \--tensor-parallel-size 4 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think```8 卡部署命令:```bash1 unmodified lineMiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think```## 测试部署26 unmodified lines该 vLLM 版本过旧,请升级到最新版本。### torch.AcceleratorError: CUDA error: an illegal memory access was encountered在启动参数添加 `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` 可以解决。例如:```bashSAFETENSORS_FAST_GPU=1 vllm serve \MiniMaxAI/MiniMax-M2 --trust-remote-code \--enable_expert_parallel --tensor-parallel-size 8 \--enable-auto-tool-choice --tool-call-parser minimax_m2 \--reasoning-parser minimax_m2_append_think \--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"```## 获取支持如果在部署 MiniMax 模型过程中遇到任何问题:
docs/sglang_deploy_guide_cn.md+5-2
docs/vllm_deploy_guide.md+23-2
docs/vllm_deploy_guide_cn.md+23-2