# Unsloth AMD PyTorch Synthetic Data Hackathon

MI300マシンにアクセスすると、Jupyter Notebookのインターフェースが表示されます：

<figure><img src="/files/e2335d55658f44b363f2539a90116f7021b778eb" alt=""><figcaption></figcaption></figure>

**まず、Unslothをアップデートします** そしてすべてが期待どおりに動作することを確認します - をクリックしてください **ターミナル**

<figure><img src="/files/4034f872ca1f6e8926b7133ce817e016664d526d" alt=""><figcaption></figcaption></figure>

次に、更新するために以下をで実行します **ターミナル** Unslothを更新するには - バージョンが **2025.10.5** 以上であることを確認してください。

```
pip install --upgrade -qqq --no-cache-dir --force-reinstall --no-deps unsloth unsloth_zoo
python -c "import unsloth; print(unsloth.__version__)"
```

<figure><img src="/files/155c74afae5dcfa602ed4a09b91c1fd07a2f8786" alt=""><figcaption></figcaption></figure>

新しいNotebookやターミナルを作るには、PLUSボタンをクリックします

<figure><img src="/files/0105918ff6f8cb52a5704a4c814386ae6adc5951" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**README.ipynbファイルを開いて、指示と採点基準を読んでください**
{% endhint %}

### :butterfly:チュートリアル1: Unslothが動作することを確認する

新しいでシンプルなLlama 3.2 1B / 3B会話ノートブックが期待どおりに実行されることを確認します **ターミナル**.

{% code overflow="wrap" %}

```bash
wget "https://raw.githubusercontent.com/unslothai/notebooks/refs/heads/main/python_scripts/Llama3.2_(1B_and_3B)-Conversational.py" -O llama_basic.py
python llama_basic.py
```

{% endcode %}

以下のように表示されるはずです（2分かかります）。何か壊れたら、まずUnslothを更新してみてください via

{% code overflow="wrap" %}

```bash
pip install --upgrade -qqq --no-cache-dir --force-reinstall --no-deps unsloth unsloth_zoo
python -c "import unsloth; print(unsloth.__version__)"
```

{% endcode %}

<figure><img src="/files/7af405c14d6217c035ad5cd3c20adb60d1124173" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ada8f3d0a242852b38c477d3b2080949280a7a39" alt=""><figcaption></figcaption></figure>

### :sloth:チュートリアル2: 合成データ生成の実行

{% hint style="success" %}
**tutorial.ipynbも実行できます。以下を見なくても我々のマシン上にすぐあるはずです：**
{% endhint %}

それでは次に以下の例を試してみましょう <https://github.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data> また <https://www.amd.com/en/developer/resources/technical-articles/2025/10x-model-fine-tuning-using-synthetic-data-with-unsloth.html>

まず新しいを作ります **ターミナル** 再度 - PLUSボタンで新しいを作成できます **ターミナル**.

<figure><img src="/files/4034f872ca1f6e8926b7133ce817e016664d526d" alt=""><figcaption></figcaption></figure>

新しいでvLLMを実行してLlama 3.3 70B Instructをロードします **ターミナル** （新しいターミナルはPLUSボタンを使用）

{% code overflow="wrap" %}

```
vllm serve Unsloth/Llama-3.3-70B-Instruct --port 8001 --max-model-len 48000 --gpu-memory-utilization 0.85
```

{% endcode %}

次のように表示されます：

<figure><img src="/files/292a69c7c88dc6059f4dbe53a144ae7caa3a2609" alt=""><figcaption></figcaption></figure>

まで待ちます `INFO: Application startup complete.` その後PLUSボタンをクリックして新しいタブを開きます

<figure><img src="/files/68c2c368fdac6198f7c99e1a09ae82a4ec429553" alt=""><figcaption></figcaption></figure>

インストールしてください **synthetic-data-kit** <https://github.com/meta-llama/synthetic-data-kit> 新しいで **ターミナル** ウィンドウ。

```
pip install --upgrade synthetic-data-kit
```

<figure><img src="/files/ba975245e7729b578c9872b044e4d70de94711cc" alt=""><figcaption></figcaption></figure>

を取得します `config.yaml` 次のいずれかから取得します <https://raw.githubusercontent.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data/refs/heads/main/config.yaml>、または以下：

{% file src="/files/a17c4fb67a8bedef9f7d478f779aeb0152438510" %}

{% code overflow="wrap" %}

```bash
wget https://raw.githubusercontent.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data/refs/heads/main/config.yaml -O config.yaml
```

{% endcode %}

synthetic data kitが動作したか確認します。エラーが出る場合は、1つ目のセルでvLLMが実行されていることを確認してください。

{% code overflow="wrap" %}

```bash
synthetic-data-kit -c config.yaml system-check
```

{% endcode %}

<figure><img src="/files/e4881787ee5d1aac9209191d00a0e0e8eac49c41" alt=""><figcaption></figcaption></figure>

次に処理で使用するファイルを取得します：

{% code overflow="wrap" %}

```bash
# PDFを使用し、サンプルを保存するリポジトリを作成します
mkdir -p logical_reasoning/{sources,data/{input,parsed,generated,curated,final}}

wget -P logical_reasoning/sources/ -q --show-progress "https://www.csus.edu/indiv/d/dowdenb/4/logical-reasoning-archives/logical-reasoning-2017-12-02.pdf"   "https://people.cs.umass.edu/~pthomas/solutions/Liar_Truth.pdf"

cp logical_reasoning/sources/* logical_reasoning/data/input/
cp config.yaml logical_reasoning
```

{% endcode %}

<figure><img src="/files/312fb9a01500e536f129ee6cd54005b4568fecbd" alt=""><figcaption></figcaption></figure>

では、データを取り込み処理しましょう：

{% code overflow="wrap" %}

```bash
cd logical_reasoning
synthetic-data-kit ingest ./data/input/ --verbose
```

{% endcode %}

次に、Q\&A（質問と回答ペア）またはCoT（思考の連鎖）ペアを作成します（3分かかる場合があります）

{% code overflow="wrap" %}

```bash
synthetic-data-kit -c ../config.yaml create ./data/parsed/ --type qa --num-pairs 15 --verbose

##### または #####

synthetic-data-kit -c ../config.yaml create ./data/parsed/ --type cot --num-pairs 15 --verbose
```

{% endcode %}

<figure><img src="/files/7364a1561b94a05c927c54f93148e10a060c1519" alt=""><figcaption></figcaption></figure>

次にLLMにデータをキュレートさせ、LLMをジャッジとして呼び出して望ましくない合成データ行を削除し、その出力を保存します - 3分かかる場合があります

{% code overflow="wrap" %}

```bash
synthetic-data-kit -c ../config.yaml curate ./data/generated/ --threshold 7.0 --verbose

synthetic-data-kit save-as ./data/curated/ --format ft --verbose
```

{% endcode %}

<figure><img src="/files/0064b034238e6513e6ef7f86084e3cc1be965f30" alt=""><figcaption></figcaption></figure>

再度、 <mark style="background-color:purple;">**VRAMを節約するためにvLLMサービスをシャットダウンしてください!!! 前のタブに戻り、CTRL+Cを3回押します。あるいは参照してください**</mark> [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")

次に実行するノートブックを取得します（以下で入手できます） <https://github.com/unslothai/notebooks/blob/main/nb/Synthetic_Data_Hackathon.ipynb>:

{% code overflow="wrap" %}

```bash
wget "https://github.com/unslothai/notebooks/raw/refs/heads/main/nb/Synthetic_Data_Hackathon.ipynb" -O "Synthetic_Data_Hackathon.ipynb"
```

{% endcode %}

{% hint style="info" %}
Out of Memoryエラーが出たら、vLLMインスタンスをシャットダウンしてください - 参照してください [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")
{% endhint %}

左のフォルダボタンをクリックして「Synthetic\_Data\_Hackathon.ipynb」を開きます（ダブルクリック）

<figure><img src="/files/349a8c6bc445705aaab3e65f044261d146ef4fee" alt=""><figcaption></figcaption></figure>

それから全て実行してください！

<figure><img src="/files/9af5c1cd3a4aa34feff186fc5c0b56c6972c8c35" alt=""><figcaption></figcaption></figure>

ノートブックの中央に次のように表示されます：

<figure><img src="/files/96d7e3cfb26e6fef47e47ceb1def996beb981118" alt=""><figcaption></figcaption></figure>

詳細については <https://github.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data/blob/main/tutorial.ipynb> 詳細については

### :dolphin:チュートリアル3: GPT-OSS 強化学習 自動カーネル生成

このノートブックはノートブックまたはPythonスクリプトとして実行できます！

Pythonスクリプト： <https://github.com/unslothai/notebooks/blob/main/python_scripts/gpt_oss_(20B)_GRPO_BF16.py>

ノートブック： <https://github.com/unslothai/notebooks/blob/main/nb/gpt_oss_(20B)_GRPO_BF16.ipynb>

{% code overflow="wrap" %}

```bash
wget "https://raw.githubusercontent.com/unslothai/notebooks/refs/heads/main/nb/gpt_oss_(20B)_GRPO_BF16.ipynb" -O "Auto_Kernels_RL.ipynb"
```

{% endcode %}

次にチュートリアル2と同様に、ファイル「Auto\_Kernels\_RL.ipynb」を開き、再起動してすべて実行してください！

<figure><img src="/files/cd1e5372f7e5f0ddf07aa186ca472488e7d9cf77" alt=""><figcaption></figcaption></figure>

実行して下にスクロールすると、RLを通じて自動生成された戦略で2048ゲームが実行されているのが見えます：

<figure><img src="/files/97f26c6f6745686bf119cd63280dbe442dbe7613" alt=""><figcaption></figcaption></figure>

### :diamonds:チュートリアル4: GPT-OSS 強化学習 2048ゲーム

このノートブックはノートブックまたはPythonスクリプトとして実行できます！

Pythonスクリプト： <https://github.com/unslothai/notebooks/blob/main/python_scripts/gpt_oss_(20B)_GRPO_BF16.py>

ノートブック： <https://github.com/unslothai/notebooks/blob/main/nb/gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb>

{% code overflow="wrap" %}

```bash
wget "https://github.com/unslothai/notebooks/raw/refs/heads/main/nb/gpt_oss_(20B)_Reinforcement_Learning_2048_Game_BF16.ipynb" -O "RL_2048_Game.ipynb"
```

{% endcode %}

次にチュートリアル3と同様に、ファイル「Auto\_Kernels\_RL.ipynb」を開き、再起動してすべて実行してください！

<figure><img src="/files/bcfd3da47fe93957acf2adcc9f928aefb48e166f" alt=""><figcaption></figcaption></figure>

スクロールすると、2048に勝つための戦略をRLアルゴリズムが自動生成しているのが見えます！

<figure><img src="/files/7bd804eaa7bfc8c52c64ffb36997df8bb8c59e70" alt=""><figcaption></figcaption></figure>

### :sunflower:AMD上での最適なvLLMコマンド

AMD GPUでモデルをサーブするには、パフォーマンスを向上させる次のコマンドを使用してください。aiterとflash-attentionがインストールされていることを確認するか参照してください [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

MI300X、MI325X、およびRadeon GPUの場合：

```bash
export VLLM_ROCM_USE_AITER=1
# VLLM_USE_AITER_UNIFIED_ATTENTIONはFlash Attentionがインストールされている場合にのみ機能します
export VLLM_USE_AITER_UNIFIED_ATTENTION=0
export VLLM_ROCM_USE_AITER_MHA=0
vllm serve unsloth/gpt-oss-20b \
  --no-enable-prefix-caching \
  --compilation-config '{"full_cuda_graph": true}'
```

MI355Xの場合は、以下を行ってください：

```bash
export VLLM_ROCM_USE_AITER=1
# VLLM_USE_AITER_UNIFIED_ATTENTIONはFlash Attentionがインストールされている場合にのみ機能します
export VLLM_USE_AITER_UNIFIED_ATTENTION=0
export VLLM_ROCM_USE_AITER_MHA=0
export VLLM_USE_AITER_TRITON_FUSED_SPLIT_QKV_ROPE=1
export VLLM_USE_AITER_TRITON_FUSED_ADD_RMSNORM_PAD=1
export TRITON_HIP_PRESHUFFLE_SCALES=1
export VLLM_USE_AITER_TRITON_GEMM=1
 
vllm serve unsloth/gpt-oss-120b \
--no-enable-prefix-caching \
--compilation-config '{"compile_sizes": [1, 2, 4, 8, 16, 24, 32, 64, 128, 256, 4096, 8192], "full_cuda_graph": true}' \
--block-size 64
```

## :tools:トラブルシューティングとFAQ

### :free:<mark style="background-color:purple;">AMD GPUメモリを解放するには？</mark>

Dockerイメージ（ハッカソンのような）を使用している場合は、新しいで以下を実行します **ターミナル** `rocm-smi -d 0 --showpids` ローカルマシンの場合

```bash
# /dev/kfd または /dev/dri/render* を開いているローカルPIDを一覧表示
for p in /proc/[0-9]*; do
  readlink -f "$p/fd"/* 2>/dev/null | grep -qE '/dev/(kfd|dri/render)' || continue
  cmd=$(tr -d '\0' < "$p/cmdline" 2>/dev/null | sed 's/ \+/ /g')
  printf "%-8s %s\n" "${p##*/}" "${cmd:-[unknown]}"
done | sort -n
```

ローカルマシンの場合は、単に次を実行します `rocm-smi -d 0 --showpids` そして実行します `sudo kill -9 XXXX` ここで `XXXX` はその特定のプロセス（最も多くのVRAMを使用しているもの）に割り当てられたPIDです。

<figure><img src="/files/bdae63a5302b816ebfdd2454956d2b14b46f43e7" alt=""><figcaption></figcaption></figure>

ハッカソンのようなDockerイメージの場合、最初のセルを実行した後に以下のような表示が出ることがあります：

<figure><img src="/files/defc76b7b079c3e1ddb81e147673af56cda97218" alt=""><figcaption></figcaption></figure>

次にVRAMを使用しているプロセス（vLLMのような）を探して、次を入力します `sudo kill -9 XXXX` ここで `XXXX` 左列に以下のように表示されているPIDです：

<figure><img src="/files/bcbd9a7ffa5840c64f6c56a10788d3cb50b66b51" alt=""><figcaption></figcaption></figure>

次で全てのGPUメモリが解放されていることを確認します `rocm-smi -d 0 --showpids` 例えば以下はメモリ使用が0であることを示しています：

<figure><img src="/files/65f24f63e38eb7557c34aef7141145a234724c7c" alt=""><figcaption></figcaption></figure>

一方で以下のように表示される場合は、最初のDockerセルイメージを再実行してプロセスを再度終了させてください。

<figure><img src="/files/aa326cb9f44942798b35ffa4b6129f524e41e781" alt=""><figcaption></figcaption></figure>

### :pencil:<mark style="background-color:purple;">torch.OutOfMemoryError: HIP out of memory RuntimeError: Engine process failed to start.</mark>

ご参照ください [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention") GPUが他のプロセスからメモリを使用しているか確認し、そのメモリを使用しているプロセスを削除してみてください。

また次を試してください `amd-smi process --gpu 0` GPUを使用しているすべてのプロセスと各プロセスのVRAM使用量を一覧表示します：

<figure><img src="/files/39fb89f795a3af54d8b995b49e413f5d04acea6c" alt=""><figcaption></figcaption></figure>

### :arrow\_forward:<mark style="background-color:purple;">vLLM用のプラットフォームが検出されない、vLLM上のgpt-ossのアップグレード</mark>

もし次を実行しているなら `vllm serve Unsloth/gpt-oss-20b` 古いvLLMバージョンを使用している可能性があります。 `python -c "import vllm; print(vllm.__version__)"` でvLLMのバージョンを取得します。

事前構築されたハッカソンドッカーでは、次が入っています `0.7.4` 残念ながらこれはGPT-OSSのような新しいモデルをサポートしていませんが、他のモデルは次のように動作します `vllm serve Unsloth/Llama-3.3-70B-Instruct --port 8001 --max-model-len 48000 --gpu-memory-utilization 0.85`

<figure><img src="/files/4487817307d6aa780df6cbc97a4411c157ebd264" alt=""><figcaption></figcaption></figure>

### :cupcake:<mark style="background-color:purple;">AMD上でvLLMを最新に更新する</mark>

{% hint style="warning" %}
**GPT-OSSはソースからビルドした後、まだvLLM上で動作しない場合があります - とりあえず参照してください** [**https://rocm.blogs.amd.com/ecosystems-and-partners/openai-day-0/README.html**](https://rocm.blogs.amd.com/ecosystems-and-partners/openai-day-0/README.html) **Dockerでgpt-ossを実行するための情報です - ハッカソン環境ではDockerインサイドDockerは使用できません。次のエラーが出ることがあります：**

{% code overflow="wrap" %}

```
ImportError: cannot import name 'GFX950MXScaleLayout' from 'triton_kernels.tensor_details.layout' (/usr/local/lib/python3.12/dist-packages/triton_kernels/tensor_details/layout.py)
(EngineCore_DP0 pid=44662) Process EngineCore_DP0:
```

{% endcode %}
{% endhint %}

最新のvLLMを取得するには、次を参照してください <https://docs.vllm.ai/en/latest/getting_started/installation/gpu.html#install-specific-revisions>特に、AMD GPUを使用しているすべてのプロセスをクリアした後、以下を実行してください [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")

{% code overflow="wrap" %}

```bash
# PyTorchをインストール
pip uninstall torch -y
pip uninstall pytorch-triton-rocm -y
pip uninstall triton -y
pip install --upgrade torch==2.8.0 pytorch-triton-rocm torchvision torchaudio torchao==0.13.0 xformers --index-url https://download.pytorch.org/whl/rocm6.4

# OpenAI Tritonカーネルをインストール
pip install git+https://github.com/triton-lang/triton.git@05b2c186c1b6c9a08375389d5efe9cb4c401c075#subdirectory=python/triton_kernels
```

{% endcode %}

上記を実行すると（GPUを使用しているすべてのプロセスを先に終了することを忘れないでください！参照してください） [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention"))

<figure><img src="/files/ff3f030205737000af4f3c94d3d71938f8f27dcb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/b205eaa5bc172a707de334a555e4286cc12c664f" alt=""><figcaption></figcaption></figure>

<details>

<summary><mark style="background-color:red;"><strong>（任意 折りたたみ可能なコード）</strong></mark> に <mark style="background-color:green;"><strong>Flash Attentionをビルドする</strong></mark> 経由（<strong>これには30分から1時間かかります</strong>）ため、30分から1時間待ちたくない場合はこれは任意です！ <mark style="background-color:green;"><strong>一般的にはこのプロセスはスキップすることをお勧めします。</strong></mark> Flash Attentionをインストールしたい場合はこのセルを展開してください。</summary>

{% code overflow="wrap" %}

```bash
# ********任意********* 1時間待つ必要があるかもしれません!!
# ********任意********* 1時間待つ必要があるかもしれません!!
git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
git checkout 1a7f4dfa
git submodule update --init

# ********任意********* 1時間待つ必要があるかもしれません!!
# ********任意********* 1時間待つ必要があるかもしれません!!
ARCH=$(rocminfo | grep -m1 -oE 'gfx[0-9]+[a-z]*')
echo "検出されたGPUアーキテクチャ: $ARCH"
GPU_ARCHS="$ARCH" python3 setup.py install
cd ..
# ********任意********* 1時間待つ必要があるかもしれません!!
```

{% endcode %}

次のように表示されます：

<figure><img src="/files/098a3631d729594f056b678e4f10425cca89bad0" alt=""><figcaption></figcaption></figure>

Flash-Attentionの進行状況を監視するには（非常に長くなることがあります）、\[296/2206]の進行を確認してください。

<figure><img src="/files/1c0b3b99925236885c4335af301a8fbe67719533" alt=""><figcaption></figcaption></figure>

</details>

<mark style="background-color:red;">**（必須ではありません）**</mark> 次にaiterをビルドします [ROCm向けのAIテンソルエンジン](https://github.com/ROCm/aiter) （これには5分かかります）

{% code overflow="wrap" %}

```bash
python3 -m pip uninstall -y aiter
git clone --recursive https://github.com/ROCm/aiter.git
cd aiter
git checkout $AITER_BRANCH_OR_COMMIT
git submodule sync; git submodule update --init --recursive
python3 setup.py develop
cd ..
```

{% endcode %}

<mark style="background-color:red;">**（必須ではありません）**</mark> 次にvLLMをビルドします：

```bash
pip install --upgrade pip
pip uninstall vllm -y
pip install --upgrade -qqq --no-cache-dir --force-reinstall --no-deps unsloth unsloth_zoo
pip uninstall bitsandbytes -y
pip install "unsloth[amd] @ git+https://github.com/unslothai/unsloth"

# AMD SMIをビルド & インストール
pip install /opt/rocm/share/amd_smi

# 依存関係をインストール
pip install --upgrade numba \
    scipy \
    huggingface-hub[cli,hf_transfer] \
    setuptools_scm

git clone --depth 1 --branch "v0.11.0" https://github.com/vllm-project/vllm.git vllm_build
cd vllm_build
pip install -r requirements/rocm.txt

# MI210/MI250/MI300向けにvLLMをビルドします。
export PYTORCH_ROCM_ARCH="$(rocminfo | grep -m1 -oE 'gfx[0-9]+[a-z]*')"
python3 setup.py develop
cd ..
```

以下のように表示されます（**5〜10分お待ちください！**)

<figure><img src="/files/317d2b02b4566740fc3ead2531ef571c6c33fc55" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/4b15d16f66bda7b660a57aab099681f41226cbc2" alt=""><figcaption></figcaption></figure>

次でvLLM、torchが更新されたことを確認します

{% code overflow="wrap" %}

```bash
python -c "import vllm, torch, unsloth; print(vllm.__version__); print(torch.__version__); print(unsloth.__version__);"
vllm
```

{% endcode %}

ここにはvLLMが0.11.0以上であることが表示されるはずで、torchは2025年10月時点で必ず2.8.0でなければなりません。タイプ `vllm` でvLLMが期待どおりに動作することを確認します。

```
🦥 Unsloth Zooはトレーニングを高速化するためにすべてをパッチします！
0.11.0
2.8.0+rocm6.4
2025.10.6
```

<figure><img src="/files/a8dc2125dfbe33e43414b90696bad362fb470fed" alt=""><figcaption></figcaption></figure>

### :book:vLLMでunsloth/gpt-oss-20bを実行する

{% hint style="warning" %}
**GPT-OSSはソースからビルドした後、まだvLLM上で動作しない場合があります - とりあえず参照してください** [**https://rocm.blogs.amd.com/ecosystems-and-partners/openai-day-0/README.html**](https://rocm.blogs.amd.com/ecosystems-and-partners/openai-day-0/README.html) **Dockerでgpt-ossを実行するための情報です - ハッカソン環境ではDockerインサイドDockerは使用できません。次のエラーが出ることがあります：**

{% code overflow="wrap" %}

```
ImportError: cannot import name 'GFX950MXScaleLayout' from 'triton_kernels.tensor_details.layout' (/usr/local/lib/python3.12/dist-packages/triton_kernels/tensor_details/layout.py)
(EngineCore_DP0 pid=44662) Process EngineCore_DP0:
```

{% endcode %}
{% endhint %}

vLLMを更新した後、 [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")で、実行できます [gpt-oss-20b](https://huggingface.co/unsloth/gpt-oss-20b)! 参照してください [#optimal-vllm-commands-on-amd](#optimal-vllm-commands-on-amd "mention") AMD GPUでvllmを実行するためのより最適なコマンド（推論が速くなる場合があります）については参照してください

{% code overflow="wrap" %}

```bash
export VLLM_ROCM_USE_AITER=1
export VLLM_ROCM_USE_AITER_MHA=0
vllm serve unsloth/gpt-oss-20b \
  --no-enable-prefix-caching \
  --compilation-config '{"full_cuda_graph": true}' \
  --port 8001 \
  --max-model-len 48000 \
  --gpu-memory-utilization 0.85
```

{% endcode %}

### :interrobang:RuntimeError: User specified an unsupported autocast device\_type 'hip'

<figure><img src="/files/4c31d2b8c90168083569682b6eb33473b23bec98" alt=""><figcaption></figcaption></figure>

**Unslothを更新してください！** 以下を参照してください [#updating-unsloth](#updating-unsloth "mention")

### :bug:NotImplementedError: Unsloth currently ok

<figure><img src="/files/3260d7634262111c5c76fb49834f04027f299796" alt=""><figcaption></figcaption></figure>

### :new:Unslothの更新

**まず、Unslothをアップデートします** そしてすべてが期待どおりに動作することを確認します - をクリックしてください **ターミナル**

<figure><img src="/files/4034f872ca1f6e8926b7133ce817e016664d526d" alt=""><figcaption></figcaption></figure>

次に、更新するために以下をで実行します **ターミナル** Unslothを更新するには - **バージョンが2025.10.5以上であることを確認してください。**

```
pip install --upgrade -qqq --no-cache-dir --force-reinstall --no-deps unsloth unsloth_zoo
pip uninstall bitsandbytes -y
pip install "unsloth[amd] @ git+https://github.com/unslothai/unsloth"
python -c "import unsloth; print(unsloth.__version__)"
```

**ランタイムも再起動する必要があります**

<figure><img src="/files/53b1140d41a136160e643e98a9d05707feaf1c36" alt=""><figcaption></figcaption></figure>

### :interrobang:terminate called after throwing an instance of 'std::logic\_error' what()

次を使用していることを確認してください `torch==2.8.0`。 以下を再実行してください：

{% code overflow="wrap" %}

```bash
pip install --upgrade torch==2.8.0 pytorch-triton-rocm torchvision torchaudio torchao==0.13.0 xformers --index-url https://download.pytorch.org/whl/rocm6.4
```

{% endcode %}

<figure><img src="/files/7f8d3e35158bd0875f1c02ac91fe6148051c4a97" alt=""><figcaption></figcaption></figure>

### :question:System has not been booted, Failed to connect to bus

次のような表示が出る場合があります：

```
root@270fa7fa9157:/jupyter-tutorial/AIAC_129_212_183_103/assets# reboot
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Failed to talk to init daemon.
```

マシンを再起動できるようにメッセージを送ってください！

### :bug:Configured ROCm binary not found - get\_native\_library()

これはbitsandbytesが正しくインストールされていないことを示しています（以下のように）：

{% code overflow="wrap" %}

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/bitsandbytes/cextension.py", line 313, in <module>
    lib = get_native_library()
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/bitsandbytes/cextension.py", line 282, in get_native_library
    raise RuntimeError(f"Configured {BNB_BACKEND} binary not found at {cuda_binary_path}")
RuntimeError: Configured ROCm binary not found at /usr/local/lib/python3.12/dist-packages/bitsandbytes/libbitsandbytes_rocm64.so
```

{% endcode %}

ご参照ください [#updating-unsloth](#updating-unsloth "mention")bitsandbytesとUnslothを更新してください！

### :exclamation:NotImplementedError: Cannot copy out of meta tensor; no data!

これはメモリ不足を意味します。GPUメモリ解放については参照してください [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention") GPUメモリを解放するためのページを参照してください。

{% code overflow="wrap" %}

```
--------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[18], line 8
      5     tokenizer.pad_token_id = tokenizer.eos_token_id
      7 # ROCmに優しい設定と適切なデータ処理でトレーナーをセットアップ
----> 8 trainer = SFTTrainer(
      9     model=model,
...
--> 235 lm_head_bad = lm_head_bad.cpu().float().numpy().round(3)
    236 from collections import Counter
    237 counter = Counter()

NotImplementedError: Cannot copy out of meta tensor; no data!
```

{% endcode %}

### :thought\_balloon:ModuleNotFoundError("No module named 'vllm.\_C'") により vllm.\_C からのインポートに失敗しました

vLLMを再インストールしてください。使用してください `vllm_build` をgit cloneしているフォルダ名として使用し、ではなく `vllm`. [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

### :hushed:ModuleNotFoundError: No module named 'vllm'

次のことは行わないでください `rm -rf vllm_build` ビルドしたフォルダを削除しないでください。あるいは次でvllmを再インストールしてください [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

### :ledger:ipykernel>6.30.1はプログレスバーを壊します。

もし以下が表示されたら：

{% code overflow="wrap" %}

```
🦥 Unsloth: あなたのコンピュータをパッチしてファインチューニングを2倍速くできるようにします。
#### Unsloth: `hf_xet==1.1.10` と `ipykernel>6.30.1` はプログレスバーを壊します。現在XETで無効にしています。
#### Unsloth: プログレスバーを再有効化するには、`ipykernel==6.30.1` にダウングレードするか、修正を待ってください（参照
https://github.com/huggingface/xet-core/issues/526
```

{% endcode %}

現時点では無視してください - モデルのダウンロードやアップロード時のプログレスバーが表示されないだけです。

### :bug:AssertionError: No MXFP4 MoE backend

gpt-oss-20bを実行していてvLLM中にこれが表示された場合、次でvLLMを再インストールしてください [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

### :head\_bandage:NotImplementedError: Could not run \`aten::empty\_strided\`

<figure><img src="/files/fba2e545b41eace9c55eea7a425765b7f764ab6a" alt=""><figcaption></figcaption></figure>

次を使用してください `.to("cuda")` ではなく `.to("hip")` またUnslothを更新してください [#updating-unsloth](#updating-unsloth "mention")

### :bug:NotImplementedError: Could not run 'aten::empty.memory\_format'

ご参照ください [#updating-unsloth](#updating-unsloth "mention")bitsandbytesとUnslothを更新してください！


---

# 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/burogu/unsloth-amd-pytorch-synthetic-data-hackathon.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.
