> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/fr/blog/unsloth-amd-pytorch-synthetic-data-hackathon.md).

# Hackathon de données synthétiques PyTorch d'Unsloth pour AMD

Astuces, dépannage et guide pour exécuter Unsloth sur un GPU AMD.

Une fois que vous avez accès à une machine MI300, vous verrez une interface Jupyter Notebook :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-b101286d42ee55d3bae07079e00abb87f12b38a9%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**Tout d’abord, mettez à jour Unsloth** et vérifiez que tout fonctionne comme prévu - cliquez sur **Terminal**

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-4424b7b132f2f4a30ebe52927fc28f9817a9fba2%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Ensuite, exécutez ce qui suit dans le **Terminal** pour mettre à jour Unsloth - assurez-vous que la version est **2025.10.5** ou supérieure.

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

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-a9439bc0e76b104a7680d92a383236c895470b2b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Pour créer un nouveau Notebook ou Terminal, cliquez sur le bouton PLUS

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-3609acb10e2759fc1f7b83b519b08f7bf6cc14ec%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
**Ouvrez le fichier README.ipynb pour lire les instructions et les critères d’évaluation**
{% endhint %}

### :butterfly:TUTORIEL 1 : Vérifier que Unsloth fonctionne

Vérifiez que notre notebook conversationnel simple Llama 3.2 1B / 3B s’exécute comme prévu dans un nouveau **Terminal**.

{% 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 %}

Vous devriez voir ce qui suit (cela prendra 2 minutes). Si quelque chose casse, essayez d’abord de mettre à jour 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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-ba9755d476bc1fc31ef3e181bc6cb29abe5cc205%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-f97eb548123118cc66fd56296f9a9d957b652413%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :sloth:TUTORIEL 2 : Exécuter la génération de données synthétiques

{% hint style="success" %}
**Vous pouvez aussi exécuter le fichier tutorial.ipynb qui devrait être immédiatement disponible sur notre machine sans regarder ci-dessous :**
{% endhint %}

Essayons maintenant l’exemple à <https://github.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data> et aussi <https://www.amd.com/en/developer/resources/technical-articles/2025/10x-model-fine-tuning-using-synthetic-data-with-unsloth.html>

Créez d’abord un nouveau **Terminal** à nouveau - le bouton PLUS permettra d’ouvrir un nouveau **Terminal**.

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-4424b7b132f2f4a30ebe52927fc28f9817a9fba2%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Lancez vLLM pour charger Llama 3.3 70B Instruct dans un nouveau **Terminal** (utilisez le bouton PLUS pour un nouveau Terminal)

{% code overflow="wrap" %}

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

{% endcode %}

Vous verrez :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-73270ddace11dd02f9b88fb488ae0302b4d5f1fd%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Attendez jusqu’à ce que vous voyiez `INFO : le démarrage de l’application est terminé.` puis cliquez sur le bouton PLUS pour ouvrir un nouvel onglet

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-a4853780928c707327d2a3513634529dd187c39f%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Installez **synthetic-data-kit** <https://github.com/meta-llama/synthetic-data-kit> dans une nouvelle **Terminal** fenêtre.

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

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-58d6ca34a5734a74eff41393798211ed4c68c7bc%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Obtenez `config.yaml` soit depuis <https://raw.githubusercontent.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data/refs/heads/main/config.yaml>, ou ci-dessous :

{% file src="/files/7aa2edb9a2b5789ec3dbfe90bcb3807b1bab91a7" %}

{% 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 %}

Vérifiez si synthetic data kit a fonctionné via. Si vous voyez des erreurs, confirmez que vLLM s’exécute dans la 1re cellule.

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-2f6ebfe2e511e9027561bea01e5bcc6b801ff6ba%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Maintenant, récupérons quelques fichiers que nous utiliserons pour le traitement :

{% code overflow="wrap" %}

```bash
# Créez les répertoires où nous utiliserons le PDF et enregistrerons les exemples
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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-9179ed6428dc901233723bc423e461237d5cb900%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Maintenant, ingérons les données et traitons-les :

{% code overflow="wrap" %}

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

{% endcode %}

Maintenant, créons soit des paires Q\&R (question et réponse), soit des paires CoT (chaîne de pensée) (cela peut prendre 3 minutes)

{% code overflow="wrap" %}

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

##### OU  #####

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

{% endcode %}

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-6a33809079b28448a69d79c18197f87a0f8b77cc%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Maintenant, demandons à un LLM de sélectionner les données et utilisons un LLM comme juge pour supprimer les lignes de données synthétiques moins souhaitables, puis enregistrons la sortie - cela peut prendre 3 minutes

{% 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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-d620b3fdb71e6ef7026f3aef8ced2656e3a73a9a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Encore une fois, <mark style="background-color:purple;">**ARRÊTEZ le service vLLM pour économiser de la VRAM !!! Allez dans l’onglet précédent, puis appuyez 3 fois sur CTRL+C. Ou voir**</mark> [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")

Maintenant, récupérez le notebook que nous exécuterons à <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" %}
Si vous obtenez des erreurs de mémoire insuffisante, arrêtez votre instance vLLM - voir [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")
{% endhint %}

Cliquez sur le bouton de dossier à gauche et ouvrez "Synthetic\_Data\_Hackathon.ipynb" (double-cliquez)

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-b0f2bf1c883d51bbb3de807c9f3e0330e25c81cf%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Puis exécutez tout !

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-f893affa579b0da821e4227118c09996430028e5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Vous verrez au milieu du notebook :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-e235213d0f073f69b5c800e0a28ce866f6e9b731%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Voir <https://github.com/edamamez/Unsloth-AMD-Fine-Tuning-Synthetic-Data/blob/main/tutorial.ipynb> pour plus de détails

### :dolphin:TUTORIEL 3 : Création automatique de noyaux par apprentissage par renforcement GPT-OSS

Vous pouvez l’exécuter comme notebook ou via un script Python !

Script Python : <https://github.com/unslothai/notebooks/blob/main/python_scripts/gpt_oss_(20B)_GRPO_BF16.py>

Notebook : <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 %}

Ensuite, comme pour le Tutoriel 2, ouvrez le fichier "Auto\_Kernels\_RL.ipynb" puis redémarrez et exécutez tout !

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-f0b8a0eccd443ad20f6165a916134630664c401f%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Si vous l’exécutez et faites défiler vers le bas, vous verrez le jeu 2048 s’exécuter via des stratégies auto-générées grâce au RL :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-007590e033be00f0bd498274e255b7783ab28d13%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :diamonds:TUTORIEL 4 : Jeu 2048 en apprentissage par renforcement GPT-OSS

Vous pouvez l’exécuter comme notebook ou via un script Python !

Script Python : <https://github.com/unslothai/notebooks/blob/main/python_scripts/gpt_oss_(20B)_GRPO_BF16.py>

Notebook : <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 %}

Ensuite, comme pour le Tutoriel 3, ouvrez le fichier "Auto\_Kernels\_RL.ipynb" puis redémarrez et exécutez tout !

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-3ea0ee7006537e7d6b49cc49a9cd3cb2017b19e1%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Lorsque vous faites défiler vers le bas, vous verrez l’algorithme de RL créer automatiquement des stratégies pour gagner à 2048 !

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-caff8db15ea8b7807a8b3e4e68cbede14d2a7e53%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :sunflower:Commandes vLLM optimales sur AMD

Pour servir des modèles sur des GPU AMD, veuillez utiliser les commandes suivantes, qui amélioreront les performances. Vérifiez que aiter et flash-attention sont installés ou voir [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

Pour MI300X, MI325X et les GPU Radeon :

```bash
export VLLM_ROCM_USE_AITER=1
# VLLM_USE_AITER_UNIFIED_ATTENTION fonctionne uniquement si Flash Attention est installé
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}'
```

Pour MI355X, faites ce qui suit :

```bash
export VLLM_ROCM_USE_AITER=1
# VLLM_USE_AITER_UNIFIED_ATTENTION fonctionne uniquement si Flash Attention est installé
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:Dépannage et FAQ

### :free:<mark style="background-color:purple;">Comment libérer de la mémoire du GPU AMD ?</mark>

Si vous êtes sur une image Docker (comme l’hackathon), exécutez ce qui suit dans un nouveau **Terminal** `rocm-smi -d 0 --showpids` si vous êtes sur une machine locale

```bash
# Lister les PID locaux qui ont /dev/kfd ou /dev/dri/render* ouverts
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
```

Si vous êtes sur une machine locale, faites simplement `rocm-smi -d 0 --showpids` et exécutez `sudo kill -9 XXXX` où `XXXX` est le PID indiqué pour ce processus spécifique qui utilise le plus de VRAM.

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-744e50de01da213754b3ce853953416acc3d2aa5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Pour l’image Docker comme dans l’hackathon, après avoir exécuté la première cellule, vous pourriez voir quelque chose comme ci-dessous :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-22dea1f085cd64f00a46c94fa132b1048266847e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Cherchez ensuite le processus qui utilise la VRAM (comme vLLM), puis tapez `sudo kill -9 XXXX` où `XXXX` est le PID indiqué dans la colonne de gauche comme ci-dessous :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-8f35587b13f4b44396d617d15c22fd107a122011%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Confirmez que toute la mémoire GPU est libérée via `rocm-smi -d 0 --showpids` Par exemple, ci-dessous montre 0 utilisation de mémoire :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-5e45b5aabeadd3725d3b38845024d420d0184a33%2Fimage%20(8)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

Si, en revanche, vous voyez ce qui suit, relancez la première cellule Docker pour tuer à nouveau le processus.

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-744e50de01da213754b3ce853953416acc3d2aa5%2Fimage%20(10)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

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

Veuillez consulter [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention") pour vérifier si votre GPU utilise de la mémoire à cause d’un autre processus et essayez de supprimer ce processus qui utilise de la mémoire.

Essayez aussi `amd-smi process --gpu 0` pour lister tous les processus et l’utilisation de VRAM par tous les processus utilisant le GPU :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-64e87a78e8c7a7466e3cf86aba712635991885f0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :arrow\_forward:<mark style="background-color:purple;">Aucune plateforme détectée pour vLLM, mise à jour de vLLM, gpt-oss sur vLLM</mark>

Si vous exécutez `vllm serve Unsloth/gpt-oss-20b` vous utilisez peut-être une ancienne version de vLLM. `python -c "import vllm; print(vllm.__version__)"` pour obtenir la version de vLLM.

Dans le docker de hackathon préinstallé, vous obtiendrez `0.7.4` qui malheureusement ne prend pas en charge les modèles plus récents comme GPT-OSS, cependant d’autres modèles fonctionnent comme `vllm serve Unsloth/Llama-3.3-70B-Instruct --port 8001 --max-model-len 48000 --gpu-memory-utilization 0.85`

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-662e84780d670c8935e91ae6c657dc790e6cfdab%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :cupcake:<mark style="background-color:purple;">Mettre à jour vLLM vers la dernière version sur AMD</mark>

{% hint style="warning" %}
**GPT-OSS ne peut pas encore s’exécuter dans vLLM après compilation depuis les sources - pour l’instant, veuillez voir** [**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) **pour Docker exécutant gpt-oss - malheureusement, l’hackathon ne peut pas utiliser Docker dans Docker. Vous pourriez obtenir l’erreur :**

{% 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 %}

Pour obtenir la dernière version de vLLM, veuillez voir <https://docs.vllm.ai/en/latest/getting_started/installation/gpu.html#install-specific-revisions>, et exécutez précisément ce qui suit, après avoir supprimé tous les processus utilisant le GPU AMD via [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention")

{% code overflow="wrap" %}

```bash
# Installer 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

# Installer les noyaux OpenAI Triton
pip install git+https://github.com/triton-lang/triton.git@05b2c186c1b6c9a08375389d5efe9cb4c401c075#subdirectory=python/triton_kernels
```

{% endcode %}

L’exécution de ce qui précède affichera (rappel : pensez à arrêter d’abord tous les processus utilisant le GPU ! Voir [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention"))

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-7fb6c46e967584487dc5da7f8f2db9749d61d6e7%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-14acda1d43c28edb4fca945ba7925904d84a5def%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<details>

<summary><mark style="background-color:red;"><strong>(code repliable OPTIONNEL)</strong></mark> Pour <mark style="background-color:green;"><strong>compiler Flash Attention</strong></mark> via (<strong>cela prendra 30 minutes à 1 heure</strong>) C’est donc facultatif si vous ne voulez pas attendre 30 minutes à 1 heure ! <mark style="background-color:green;"><strong>Je passerais généralement cette étape.</strong></mark> Développez cette cellule si vous voulez installer Flash Attention.</summary>

{% code overflow="wrap" %}

```bash
# ********OPTIONNEL********* Vous devrez peut-être attendre 1 heure !!
# ********OPTIONNEL********* Vous devrez peut-être attendre 1 heure !!
git clone https://github.com/Dao-AILab/flash-attention.git
cd flash-attention
git checkout 1a7f4dfa
git submodule update --init

# ********OPTIONNEL********* Vous devrez peut-être attendre 1 heure !!
# ********OPTIONNEL********* Vous devrez peut-être attendre 1 heure !!
ARCH=$(rocminfo | grep -m1 -oE 'gfx[0-9]+[a-z]*')
echo "GPU détecté : $ARCH"
GPU_ARCHS="$ARCH" python3 setup.py install
cd ..
# ********OPTIONNEL********* Vous devrez peut-être attendre 1 heure !!
```

{% endcode %}

Vous verrez :

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-7f0b097d836ad6b71ea413563b03c62ffea69c8e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Pour suivre la progression de Flash-Attention (qui peut être très longue), surveillez la progression \[296/2206].

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-0ab502e34f537f17aed68b19b2aa2c0ae6c9cd99%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

</details>

<mark style="background-color:red;">**(NON FACULTATIF)**</mark> Puis compilez aiter [AI Tensor Engine for ROCm](https://github.com/ROCm/aiter) (cela prendra 5 minutes)

{% 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;">**(NON FACULTATIF)**</mark> Puis compilez 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"

# Compiler et installer AMD SMI
pip install /opt/rocm/share/amd_smi

# Installer les dépendances
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

# Compiler vLLM pour MI210/MI250/MI300.
export PYTORCH_ROCM_ARCH="$(rocminfo | grep -m1 -oE 'gfx[0-9]+[a-z]*')"
python3 setup.py develop
cd ..
```

Vous verrez ce qui suit (**veuillez attendre 5 à 10 minutes !**)

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-3142f5d760cf104f478e4928b7a7b0d801bd8917%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-b30b366118d7e26529f2935aa08cb69d9ff46c24%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Confirmez que vLLM et torch ont été mis à jour via

{% code overflow="wrap" %}

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

{% endcode %}

ce qui devrait montrer que vLLM est en version 0.11.0 ou supérieure, et torch DOIT être en version 2.8.0 à partir d’octobre 2025. La saisie `vllm` pour confirmer que vLLM fonctionne comme prévu.

```
🦥 Unsloth Zoo va maintenant tout patcher pour rendre l’entraînement plus rapide !
0.11.0
2.8.0+rocm6.4
2025.10.6
```

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-69250ac3d160112a2fe055f5edbe5cd19927e200%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### :book:Exécution de unsloth/gpt-oss-20b dans vLLM

{% hint style="warning" %}
**GPT-OSS ne peut pas encore s’exécuter dans vLLM après compilation depuis les sources - pour l’instant, veuillez voir** [**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) **pour Docker exécutant gpt-oss - malheureusement, l’hackathon ne peut pas utiliser Docker dans Docker. Vous pourriez obtenir l’erreur :**

{% 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 %}

Après avoir mis à jour vLLM via [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention"), vous pouvez exécuter [gpt-oss-20b](https://huggingface.co/unsloth/gpt-oss-20b)! Voir [#optimal-vllm-commands-on-amd](#optimal-vllm-commands-on-amd "mention") pour de meilleures commandes optimales pour exécuter vllm sur les GPU AMD (vous pourriez obtenir une inférence plus rapide !)

{% 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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-5efe20901a75c667f94f87d5867f557293bcd486%2Fimage.webp?alt=media" alt=""><figcaption></figcaption></figure>

**Veuillez mettre à jour Unsloth !** Voir ci-dessous [#updating-unsloth](#updating-unsloth "mention")

### :bug:NotImplementedError : Unsloth actuellement ok

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-bb6061b993f6de7da26a6b8c6106a99910b64672%2FScreenshot_2025-10-19_at_01.27.32.webp?alt=media" alt=""><figcaption></figcaption></figure>

### :new:Mise à jour d'Unsloth

**Tout d’abord, mettez à jour Unsloth** et vérifiez que tout fonctionne comme prévu - cliquez sur **Terminal**

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-4424b7b132f2f4a30ebe52927fc28f9817a9fba2%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Ensuite, exécutez ce qui suit dans le **Terminal** pour mettre à jour Unsloth - **assurez-vous que la version est 2025.10.5 ou supérieure.**

```
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__)"
```

**Vous devez aussi REDÉMARRER l’exécution**

<figure><img src="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-df75f87e44c98dd8298853f854cfee64a957b44d%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

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

Veuillez vérifier que vous utilisez `torch==2.8.0`. Relancez ce qui suit :

{% 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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-a7e00a42f9acfeb8658aae9895afc85b1abf5128%2Fimage.webp?alt=media" alt=""><figcaption></figcaption></figure>

### :question:Le système n’a pas été amorcé, échec de la connexion au bus

Vous pourriez voir ce qui suit :

```
root@270fa7fa9157:/jupyter-tutorial/AIAC_129_212_183_103/assets# reboot
Le système n’a pas été démarré avec systemd comme système d’initialisation (PID 1). Impossible d’opérer.
Échec de la connexion au bus : l’hôte est hors ligne
Échec de communication avec le démon d’initialisation.
```

Merci de nous contacter afin que nous puissions redémarrer la machine !

### :bug:Binaire ROCm configuré introuvable - get\_native\_library()

Cela indique que bitsandbytes n’est pas installé correctement, comme ci-dessous :

{% 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 %}

Veuillez consulter [#updating-unsloth](#updating-unsloth "mention")pour mettre à jour bitsandbytes et Unsloth !

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

Cela signifie que vous êtes à court de mémoire. Voir [#how-do-i-free-amd-gpu-memory](#how-do-i-free-amd-gpu-memory "mention") pour libérer la mémoire du 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 # Configurer le formateur avec des paramètres adaptés à ROCm et une gestion appropriée des données
----> 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:Échec de l’import depuis vllm.\_C avec ModuleNotFoundError("No module named 'vllm.\_C'")

Veuillez réinstaller vLLM. Utilisez `vllm_build` comme dossier de destination de votre git clone, et non `vllm`. [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

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

Veuillez ne pas `rm -rf vllm_build` le dossier que vous avez compilé. Ou réinstallez vllm via [#updating-vllm-to-the-latest-on-amd](#updating-vllm-to-the-latest-on-amd "mention")

### :ledger:ipykernel>6.30.1 casse les barres de progression.

Si vous voyez ce qui suit :

{% code overflow="wrap" %}

```
🦥 Unsloth : Va patcher votre ordinateur pour permettre un fine-tuning gratuit 2x plus rapide.
#### Unsloth : `hf_xet==1.1.10` et `ipykernel>6.30.1` cassent les barres de progression. Désactivation temporaire dans XET.
#### Unsloth : Pour réactiver les barres de progression, veuillez rétrograder vers `ipykernel==6.30.1` ou attendre un correctif pour
https://github.com/huggingface/xet-core/issues/526
```

{% endcode %}

Pour l’instant, ignorez cela - vous ne verrez simplement pas les barres de progression lors du téléchargement et de l’envoi des modèles.

### :bug:AssertionError : Aucun backend MoE MXFP4

Si vous exécutez gpt-oss-20b et voyez cela pendant vLLM, veuillez réinstaller vLLM via [#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="https://550366147-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-5aa92b272f37cf8077ed69a0aa909c3717f8a6e0%2Fimage.webp?alt=media" alt=""><figcaption></figcaption></figure>

Veuillez utiliser `.to("cuda")` et non `.to("hip")` Mettez aussi à jour Unsloth [#updating-unsloth](#updating-unsloth "mention")

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

Veuillez consulter [#updating-unsloth](#updating-unsloth "mention")pour mettre à jour bitsandbytes et Unsloth !


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/fr/blog/unsloth-amd-pytorch-synthetic-data-hackathon.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
