Text Generation
Transformers
Safetensors
English
minimax_m2
Mixture of Experts
mixture-of-experts
quantization
nvfp4
fp4
fp8
reap
pruned
minimax
minimax-m2
blackwell
dgx-spark
vllm
conversational
custom_code
8-bit precision
modelopt
Instructions to use catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", 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("catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", 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 catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4
- SGLang
How to use catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4 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 "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4" \ --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": "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", "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 "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4" \ --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": "catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4 with Docker Model Runner:
docker model run hf.co/catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4
Download extras/minimax_m2_optthink_reasoning_parser.py from catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4: direct link, hf CLI and curl.
- Browser
- Download file 4.05 kB
-
https://huggingface.co/catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4/resolve/main/extras/minimax_m2_optthink_reasoning_parser.py
- Command line
-
hf download hf://catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4/extras/minimax_m2_optthink_reasoning_parser.py
-
curl -L -o minimax_m2_optthink_reasoning_parser.py https://huggingface.co/catplusplus/MiniMax-M2.7-REAP-172B-A10B-NVFP4/resolve/main/extras/minimax_m2_optthink_reasoning_parser.py
4.05 kB
| # minimax_m2_optthink_reasoning_parser.py | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from collections.abc import Sequence | |
| from typing import TYPE_CHECKING | |
| from vllm.entrypoints.openai.engine.protocol import DeltaMessage | |
| from vllm.logger import init_logger | |
| from vllm.reasoning.abs_reasoning_parsers import ReasoningParserManager | |
| from vllm.reasoning.basic_parsers import BaseThinkingReasoningParser | |
| from vllm.tokenizers import TokenizerLike | |
| if TYPE_CHECKING: | |
| from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest | |
| from vllm.entrypoints.openai.responses.protocol import ResponsesRequest | |
| logger = init_logger(__name__) | |
| class MiniMaxM2OptthinkReasoningParser(BaseThinkingReasoningParser): | |
| """ | |
| Reasoning parser for MiniMax M2 model that handles enable_thinking=False configs. | |
| MiniMax M2 models don't generate <think> start token, only </think> end | |
| token. All content before </think> is reasoning, content after is the | |
| actual response. This checks chat_template_kwargs for thinking config. | |
| """ | |
| def __init__(self, tokenizer: TokenizerLike, *args, **kwargs): | |
| super().__init__(tokenizer, *args, **kwargs) | |
| chat_kwargs = kwargs.get("chat_template_kwargs", {}) or {} | |
| self.thinking_enabled = chat_kwargs.get("enable_thinking", True) | |
| def start_token(self) -> str: | |
| """The token that starts reasoning content.""" | |
| return "<think>" | |
| def end_token(self) -> str: | |
| """The token that ends reasoning content.""" | |
| return "</think>" | |
| def extract_reasoning( | |
| self, model_output: str, request: "ChatCompletionRequest | ResponsesRequest" | |
| ) -> tuple[str | None, str | None]: | |
| # Strip <think> if present in the generated output. | |
| model_output_parts = model_output.partition(self.start_token) | |
| model_output = ( | |
| model_output_parts[2] if model_output_parts[1] else model_output_parts[0] | |
| ) | |
| if self.end_token not in model_output: | |
| if not self.thinking_enabled: | |
| # Thinking explicitly disabled \u2014 treat everything as content. | |
| return None, model_output | |
| # Thinking enabled but no </think>: output was truncated. | |
| return model_output, None | |
| # Extract reasoning content from the model output. | |
| reasoning, _, content = model_output.partition(self.end_token) | |
| final_content = content or None | |
| return reasoning, final_content | |
| def extract_reasoning_streaming( | |
| self, | |
| previous_text: str, | |
| current_text: str, | |
| delta_text: str, | |
| previous_token_ids: Sequence[int], | |
| current_token_ids: Sequence[int], | |
| delta_token_ids: Sequence[int], | |
| ) -> DeltaMessage | None: | |
| """ | |
| Extract reasoning content from a delta message for streaming. | |
| """ | |
| # Skip single special tokens | |
| if len(delta_token_ids) == 1 and ( | |
| delta_token_ids[0] in [self.start_token_id, self.end_token_id] | |
| ): | |
| return None | |
| # Check if end token has already appeared in previous tokens | |
| if self.end_token_id in previous_token_ids: | |
| # We're past the reasoning phase, this is content | |
| return DeltaMessage(content=delta_text) | |
| # Check if end token is in delta tokens | |
| if self.end_token_id in delta_token_ids: | |
| # End token in delta, split reasoning and content | |
| end_index = delta_text.find(self.end_token) | |
| if end_index >= 0: | |
| reasoning = delta_text[:end_index] | |
| content = delta_text[end_index + len(self.end_token) :] | |
| return DeltaMessage( | |
| reasoning=reasoning if reasoning else None, | |
| content=content if content else None, | |
| ) | |
| return None | |
| # No end token yet, all content is reasoning | |
| return DeltaMessage(reasoning=delta_text) | |