# MiniMax-M2.7 - ローカルで実行する方法

MiniMax-M2.7 は、エージェント的コーディングおよびチャットのユースケース向けの新しいオープンモデルです。このモデルは、SWE-Pro（56.22%）と Terminal Bench 2（57.0%）で SOTA の性能を達成しています。

この **230B パラメータ** （10B アクティブ）のモデルは、 [MiniMax-M25](https://unsloth.ai/docs/jp/moderu/tutorials/minimax-m25) の後継であり、 **200K のコンテキスト** ウィンドウを備えています。量子化されていない bf16 には **457GB**が必要です。Unsloth Dynamic **4-bit** GGUF はサイズを **108GB** **(-60%)** まで削減するため、 **128GB RAM** のデバイスで実行できます。**:** [**MiniMax-M2.7 GGUF**](https://huggingface.co/unsloth/MiniMax-M2.7-GGUF)

すべてのアップロードは Unsloth を使用します [Dynamic 2.0](https://unsloth.ai/docs/jp/ji-ben/unsloth-dynamic-2.0-ggufs) を用いて SOTA の量子化性能を実現します。そのため、重要な層はより高いビット数（例: 8-bit または 16-bit）にアップキャストされます。MiniMax の初日アクセスに感謝します。

{% hint style="warning" %}
CUDA 13.2 を使っていかなるモデルも実行しないでください。文字化けや低品質な出力の原因になる可能性があります。NVIDIA は修正に取り組んでいます。
{% endhint %}

### :gear: 使用ガイド

4-bit の動的量子化 `UD-IQ4_XS` は **108GB** のディスク容量を使用します。これは **128GB ユニファイドメモリの Mac** に非常によく収まり、約15+ トークン/秒で動作し、さらに **1x16GB GPU と 96GB の RAM** でもより高速に、25+ トークン/秒で動作します。 **2-bit** の量子化、または最も大きい 2-bit は 96GB のデバイスに収まります。

ほぼ **完全精度**に近いものが必要なら、 `Q8_0` （8-bit）を使ってください。これは 243GB を使用し、256GB RAM のデバイス / Mac に収まり、15+ トークン/秒で動作します。

{% hint style="success" %}
最良のパフォーマンスを得るには、利用可能な合計メモリ（VRAM + システム RAM）が、ダウンロードする量子化モデルファイルのサイズを上回っていることを確認してください。そうでない場合でも llama.cpp は SSD/HDD オフロード経由で実行できますが、推論は遅くなります。
{% endhint %}

### 推奨設定

MiniMax では、最良のパフォーマンスのために以下のパラメータを使用することを推奨しています: `temperature=1.0`, `top_p = 0.95`, `top_k = 40`.

{% columns %}
{% column %}

| デフォルト設定（ほとんどのタスク）   |
| ------------------- |
| `temperature = 1.0` |
| `top_p = 0.95`      |
| `top_k = 40`        |
| {% endcolumn %}     |

{% column %}

* **最大コンテキストウィンドウ:** `196,608`
* デフォルトのシステムプロンプト:

{% code overflow="wrap" %}

```
あなたは役立つアシスタントです。あなたの名前は MiniMax-M2.7 で、MiniMax によって構築されています。
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

## MiniMax-M2.7 のチュートリアルを実行:

MiniMax-M2.7 を 128GB RAM のデバイスで動作させるために、4-bit の [`UD-IQ4_XS` 量子化](https://huggingface.co/unsloth/MiniMax-M2.7-GGUF?show_file_info=UD-IQ4_XS%2FMiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf)を利用します。これで MiniMax-M2.7 を [llama.cpp](#run-in-llama.cpp) および [Unsloth Studio](#run-in-unsloth-studio).

{% hint style="warning" %}
CUDA 13.2 を使っていかなるモデルも実行しないでください。文字化けや低品質な出力の原因になる可能性があります。NVIDIA は修正に取り組んでいます。
{% endhint %}

### 🦥 Unsloth Studio で実行

MiniMax-M2.7 は現在 [Unsloth Studio](https://unsloth.ai/docs/jp/xin-zhe/studio)で実行できます。これはローカル AI 向けの新しいオープンソース Web UI です。Unsloth Studio を使うと、ローカルでモデルを実行できます。 **MacOS、Windows**、Linux などで:

{% columns %}
{% column %}

* 検索、ダウンロード、 [GGUF を実行](https://unsloth.ai/docs/jp/xin-zhe/studio#run-models-locally) および safetensor モデル
* [**自己修復** ツール呼び出し](https://unsloth.ai/docs/jp/xin-zhe/studio#execute-code--heal-tool-calling) + **ウェブ検索**
* [**コード実行**](https://unsloth.ai/docs/jp/xin-zhe/studio#run-models-locally) （Python、Bash）
* [自動推論](https://unsloth.ai/docs/jp/xin-zhe/studio#model-arena) パラメータ調整（temp、top-p など）
* 高速な CPU + GPU 推論と CPU オフロードに llama.cpp を使用
  {% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FstfdTMsoBMmsbQsgQ1Ma%2Flandscape%20clip%20gemma.gif?alt=media&#x26;token=eec5f2f7-b97a-4c1c-ad01-5a041c3e4013" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% stepper %}
{% step %}

#### Unsloth をインストール

ターミナルで実行:

**MacOS、Linux、WSL:**

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

**Windows PowerShell:**

```bash
irm https://unsloth.ai/install.ps1 | iex
```

{% endstep %}

{% step %}

#### Unsloth を起動

**MacOS、Linux、WSL および Windows:**

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

**その後、 `http://localhost:8888` をブラウザで開きます。**
{% endstep %}

{% step %}

#### MiniMax-M2.7 を検索してダウンロード

初回起動時には、アカウントを保護するためのパスワードを作成し、後で再度サインインする必要があります。その後、モデル、データセット、基本設定を選ぶための簡単なオンボーディングウィザードが表示されます。いつでもスキップできます。

選択できます `UD-IQ4_XS` （dynamic 4bit quant）または、次のような他の量子化版を `UD-Q4_K_XL` 。ダウンロードが停止した場合は、 [hugging-face-hub-xet-debugging](https://unsloth.ai/docs/jp/ji-ben/troubleshooting-and-faqs/hugging-face-hub-xet-debugging "mention")

次に [Studio Chat](https://unsloth.ai/docs/jp/xin-zhe/studio/chat) タブに移動し、検索バーで MiniMax-M2.7 を検索して、希望するモデルと量子化版をダウンロードしてください。サイズが大きいためダウンロードには時間がかかるので、お待ちください。高速な推論を確保するには、 [十分な RAM/VRAM](#usage-guide)があることを確認してください。そうでない場合でも推論は動作しますが、Unsloth は CPU にオフロードします。

<div data-with-frame="true"><figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fh6qv7Mh2VqtdhZaixrnO%2FScreenshot%202026-04-11%20at%206.46.55%E2%80%AFPM.png?alt=media&#x26;token=e2568c00-86eb-452f-a4eb-10bcc0194ddf" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### MiniMax-M2.7 を実行

Unsloth Studio を使用する場合、推論パラメータは自動設定されるはずですが、手動で変更することもできます。コンテキスト長、チャットテンプレート、その他の設定も編集できます。

詳細については、 [Unsloth Studio 推論ガイド](https://unsloth.ai/docs/jp/xin-zhe/studio/chat).
{% endstep %}
{% endstepper %}

### ✨ llama.cpp で実行

{% hint style="warning" %}
CUDA 13.2 を使っていかなるモデルも実行しないでください。文字化けや低品質な出力の原因になる可能性があります。NVIDIA は修正に取り組んでいます。
{% endhint %}

{% stepper %}
{% step %}
最新の `llama.cpp` を [GitHub こちら](https://github.com/ggml-org/llama.cpp)で入手してください。以下のビルド手順に従うこともできます。GPU がない場合、または CPU 推論だけを行いたい場合は、 `-DGGML_CUDA=ON` を `-DGGML_CUDA=OFF` に変更してください。 **Apple Mac / Metal デバイスでは**、 `-DGGML_CUDA=OFF` に設定し、その後は通常どおり続行してください。Metal サポートはデフォルトで有効です。

{% code overflow="wrap" %}

```bash
apt-get update
apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
git clone https://github.com/ggml-org/llama.cpp
cmake llama.cpp -B llama.cpp/build \
    -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON
cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-mtmd-cli llama-server llama-gguf-split
cp llama.cpp/build/bin/llama-* llama.cpp
```

{% endcode %}
{% endstep %}

{% step %}
を `llama.cpp` 直接使ってモデルを読み込みたい場合は、以下を使えます:（:IQ4\_XS）は量子化タイプです。Hugging Face 経由でもダウンロードできます（ポイント 3）。これは `ollama run` に似ています。 `export LLAMA_CACHE="folder"` を使って `llama.cpp` 特定の場所に保存するよう強制できます。モデルの最大コンテキスト長は 200K までであることを覚えておいてください。

これを **ほとんどのデフォルト** ユースケースに対して次のようにしてください:

```bash
export LLAMA_CACHE="unsloth/MiniMax-M2.7-GGUF"
./llama.cpp/llama-cli \
    -hf unsloth/MiniMax-M2.7-GGUF:UD-IQ4_XS \
    --temp 1.0 \
    --top-p 0.95 \
    --top-k 40
```

{% endstep %}

{% step %}
（をインストールした後に）モデルをダウンロード: `pip install huggingface_hub hf_transfer` 。UD-IQ4\_XS（dynamic 4-bit quant）や、次のような他の量子化版を選べます `UD-Q6_K_XL` 。サイズと精度のバランスのために、4bit の動的量子化 UD-IQ4\_XS の使用を推奨します。ダウンロードが停止した場合は、 [hugging-face-hub-xet-debugging](https://unsloth.ai/docs/jp/ji-ben/troubleshooting-and-faqs/hugging-face-hub-xet-debugging "mention")

```bash
hf download unsloth/MiniMax-M2.7-GGUF \
    --local-dir unsloth/MiniMax-M2.7-GGUF \
    --include "*UD-IQ4_XS*" # 8-bit には "*Q8_0*" を使用
```

{% endstep %}

{% step %}
編集できます `--threads 32` CPU スレッド数を、 `--ctx-size 16384` コンテキスト長を、 `--n-gpu-layers 2` GPU オフロードする層数を。GPU のメモリ不足が起きる場合は調整してみてください。CPU のみで推論する場合は、これも削除してください。

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-cli \
    --model unsloth/MiniMax-M2.7-GGUF/UD-IQ4_XS/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf \
    --temp 1.0 \
    --top-p 0.95 \
    --top-k 40
```

{% endcode %}
{% endstep %}
{% endstepper %}

#### 🦙 Llama-server と OpenAI の completion ライブラリ

MiniMax-M2.7 を本番環境に展開するには、 `llama-server` または OpenAI API を使用します。tmux 経由などで新しいターミナルを開き、次の方法でモデルを展開します:

{% code overflow="wrap" %}

```bash
./llama.cpp/llama-server \
    --model unsloth/MiniMax-M2.7-GGUF/UD-IQ4_XS/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf \
    --alias "unsloth/MiniMax-M2.7" \
    --prio 3 \
    --temp 1.0 \
    --top-p 0.95 \
    --min-p 0.01 \
    --top-k 40 \
    --port 8001
```

{% endcode %}

その後、新しいターミナルで、 `pip install openai`を実行した後、次を行います:

{% code overflow="wrap" %}

```python
from openai import OpenAI
import json
openai_client = OpenAI(
    base_url = "http://127.0.0.1:8001/v1",
    api_key = "sk-no-key-required",
)
completion = openai_client.chat.completions.create(
    model = "unsloth/MiniMax-M2.7",
    messages = [{"role": "user", "content": "Create a Snake game."},],
)
print(completion.choices[0].message.content)
```

{% endcode %}

## 📊 ベンチマーク

### GGUF ベンチマーク

MiniMax-M2.7 は MiniMax-M2.5 と同じアーキテクチャを利用しているため、M2.7 の GGUF 量子化ベンチマークは M2.5 と非常に似たものになるはずです。そのため、M2.5 に対して行われた以前の量子化ベンチマークを参照します。

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhfO2gsbz2lWrZXg3ojyE%2FHCGBTzgboAASv_A.png?alt=media&#x26;token=7d6334ca-4f3c-4946-aacd-d55527375fce" alt=""><figcaption></figcaption></figure>

[Benjamin Marie（第三者）は](https://x.com/bnjmn_marie/status/2027043753484021810/photo/1) **MiniMax-M2.5** を使用して **Unsloth GGUF 量子化** を **750 プロンプトの混合スイート** （LiveCodeBench v6、MMLU Pro、GPQA、Math500）でベンチマークし、次の両方を報告しました **全体精度** および **相対誤差増加** （量子化モデルが元モデルに比べてどれだけ頻繁にミスをするか）。

Unsloth の量子化モデルは、精度と相対誤差の両方で、Unsloth でない対応品よりも、どの精度であってもはるかに優れています（8GB 小さいにもかかわらず）。

**主な結果:**

* **ここでの品質/サイズの最良バランス: `unsloth UD-Q4_K_XL`.**\
  これは元モデルに最も近く、低下はわずか **6.0 ポイント** で、ベースラインより“たった” **+22.8%** だけエラーが多いです。
* **他の Unsloth Q4 量子化版は互いに近い性能（約64.5〜64.9 の精度）を示します。**\
  `IQ4_NL`, `MXFP4_MOE`、および `UD-IQ2_XXS` はこのベンチマークでは基本的に同じ品質で、Original より **約33〜35%** エラーが多いです。
* Unsloth GGUF は他の非 Unsloth GGUF よりもはるかに優れており、例えば `lmstudio-community - Q4_K_M` （8GB 小さいにもかかわらず）や `AesSedai - IQ3_S`.

### 公式ベンチマーク

<figure><img src="https://735611837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fn5Xz2P6kzHRH2sQGPsHH%2Fminimaxm2.7%20model.jpg?alt=media&#x26;token=04f4b3fd-9d04-4e80-9f06-09afd8ce884d" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unsloth.ai/docs/jp/moderu/minimax-m27.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
