Text Generation
Transformers
Safetensors
English
Chinese
Russian
minimax_m2
minimax
minimax-m2
Mixture of Experts
mixture-of-experts
bf16
dequantized
conversational
custom_code
Instructions to use operationrange/MiniMax-M2.7-BF16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use operationrange/MiniMax-M2.7-BF16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="operationrange/MiniMax-M2.7-BF16", 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("operationrange/MiniMax-M2.7-BF16", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("operationrange/MiniMax-M2.7-BF16", trust_remote_code=True) 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
- vLLM
How to use operationrange/MiniMax-M2.7-BF16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "operationrange/MiniMax-M2.7-BF16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "operationrange/MiniMax-M2.7-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/operationrange/MiniMax-M2.7-BF16
- SGLang
How to use operationrange/MiniMax-M2.7-BF16 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 "operationrange/MiniMax-M2.7-BF16" \ --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": "operationrange/MiniMax-M2.7-BF16", "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 "operationrange/MiniMax-M2.7-BF16" \ --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": "operationrange/MiniMax-M2.7-BF16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use operationrange/MiniMax-M2.7-BF16 with Docker Model Runner:
docker model run hf.co/operationrange/MiniMax-M2.7-BF16
| license: other | |
| license_name: minimax-license | |
| license_link: https://huggingface.co/MiniMaxAI/MiniMax-M2.7/blob/main/LICENSE | |
| base_model: MiniMaxAI/MiniMax-M2.7 | |
| base_model_relation: quantized | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| language: | |
| - en | |
| - zh | |
| - ru | |
| tags: | |
| - minimax | |
| - minimax-m2 | |
| - moe | |
| - mixture-of-experts | |
| - bf16 | |
| - dequantized | |
| # MiniMax-M2.7 — BF16 (dequantized from FP8) | |
| Plain `bfloat16` weights of [MiniMaxAI/MiniMax-M2.7](https://huggingface.co/MiniMaxAI/MiniMax-M2.7), | |
| reconstructed from the upstream block-FP8 (E4M3, 128×128 blocks) checkpoint | |
| via shard-by-shard blockwise dequantization. **No calibration, no rounding loss | |
| beyond the original FP8→BF16 cast** — every block is materialized exactly: | |
| ``` | |
| bf16_block = (fp8_block.float() * scale_fp32).bfloat16() | |
| ``` | |
| ## Why this exists | |
| `MiniMaxAI/MiniMax-M2.7` ships natively in FP8. On Ampere and earlier | |
| (e.g. RTX A5000) FP8 tensor cores don't exist and inference engines have | |
| to emulate FP8 through FP16 — paying double bandwidth without the speed | |
| benefit. For further offline quantization (AWQ, GPTQ, RTN INT8, …) you | |
| need plain BF16 weights anyway: `transformers + torch_dtype=bfloat16` | |
| won't materialize the attention projections under the FP8 quant config, | |
| which trips up `llmcompressor`'s GPTQ tracer. | |
| This repo is the missing intermediate: **upstream MiniMax-M2.7 weights in | |
| plain BF16 safetensors**, ready to be fed into any standard quantization | |
| pipeline. | |
| ## Contents | |
| - 47 shards `model-NNNNN-of-00047.safetensors` | |
| - rebuilt `model.safetensors.index.json` (no `*.weight_scale_inv` entries) | |
| - `config.json` with the upstream `quantization_config` stripped | |
| - tokenizer + custom modeling `.py` files copied verbatim from the FP8 source | |
| Total ≈ **458 GB**. | |
| ## Provenance | |
| Produced on a single 48 GB GPU pod (~30 minutes wall time) using a | |
| ~150-line script — see | |
| [`dequant_fp8_blockwise.py`](https://github.com/operationrange/zonatelecom-agent/blob/main/scripts/quant/dequant_fp8_blockwise.py). | |
| Process per shard: | |
| 1. open `model-XXXXX-of-00130.safetensors` from the FP8 source | |
| 2. for each `*.weight` (FP8 e4m3fn): look up `*.weight_scale_inv` (FP32, 128×128) | |
| 3. broadcast scale to weight shape, multiply, cast to BF16 | |
| 4. drop the scale tensor | |
| 5. write `model-NNNNN-of-00047.safetensors` (5 GB shards) | |
| Other tensors (embeddings, layer norms, MoE routers/gates that were already | |
| unquantized in the upstream config's `modules_to_not_convert`) are passed | |
| through with a BF16 cast. | |
| ## Quick load | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| m = AutoModelForCausalLM.from_pretrained( | |
| "operationrange/MiniMax-M2.7-BF16", | |
| torch_dtype="bfloat16", | |
| device_map="auto", | |
| trust_remote_code=True, | |
| ) | |
| tok = AutoTokenizer.from_pretrained("operationrange/MiniMax-M2.7-BF16", trust_remote_code=True) | |
| ``` | |
| Inference at full BF16 needs ≥ ~470 GB combined GPU+CPU memory, so this | |
| checkpoint is mostly intended as a starting point for further compression | |
| (AWQ-INT4, GPTQ-INT8, etc.) rather than direct serving. | |
| ## License | |
| Inherits the [MiniMax-M2 license](https://huggingface.co/MiniMaxAI/MiniMax-M2.7/blob/main/LICENSE) from the | |
| upstream model. No weights were modified — only the storage format. | |