> 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/notions-de-base/inference-and-deployment/vllm-guide.md).

# Guide de déploiement et d'inférence vLLM

Guide pour enregistrer et déployer des LLM sur vLLM afin de servir des LLM en production

### :computer:Installation de vLLM

Pour les GPU NVIDIA, utilisez uv et exécutez :

```bash
pip install --upgrade pip
pip install uv
uv pip install -U vllm --torch-backend=auto
```

Pour les GPU AMD, veuillez utiliser l'image Docker nightly : `rocm/vllm-dev:nightly`

Pour la branche nightly pour les GPU NVIDIA, exécutez :

{% code overflow="wrap" %}

```bash
pip install --upgrade pip
pip install uv
uv pip install -U vllm --torch-backend=auto --extra-index-url https://wheels.vllm.ai/nightly
```

{% endcode %}

Voir [Documentation vLLM](https://docs.vllm.ai/en/stable/getting_started/installation) pour plus de détails

### :truck:Déploiement des modèles vLLM

Après avoir enregistré votre fine-tuning, vous pouvez simplement faire :

```bash
vllm serve unsloth/gpt-oss-120b
```

### :fire\_engine:Drapeaux de serveur de déploiement vLLM, arguments du moteur et options

Certains drapeaux de serveur importants à utiliser se trouvent dans [#vllm-deployment-server-flags-engine-arguments-and-options](#vllm-deployment-server-flags-engine-arguments-and-options "mention")

### 🦥Déploiement des fine-tunes Unsloth dans vLLM

Après le fine-tuning [Fine-tuning Guide](/docs/fr/commencer/fine-tuning-llms-guide.md) ou en utilisant nos notebooks à [Notebooks Unsloth](/docs/fr/commencer/unsloth-notebooks.md), vous pouvez enregistrer ou déployer vos modèles directement via vLLM dans un seul flux de travail. Un exemple de script de fine-tuning Unsloth, par exemple :

```python
from unsloth import FastLanguageModel
import torch
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "unsloth/gpt-oss-20b",
    max_seq_length = 2048,
    load_in_4bit = True,
)
model = FastLanguageModel.get_peft_model(model)
```

**Pour enregistrer en 16 bits pour vLLM, utilisez :**

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "merged_16bit")
## OU pour téléverser sur Hugging Face :
model.push_to_hub_merged("hf/model", tokenizer, save_method = "merged_16bit", token = "")
```

{% endcode %}

**Pour enregistrer uniquement les adaptateurs LoRA**, utilisez l’une des options suivantes :

```python
model.save_pretrained("finetuned_lora")
tokenizer.save_pretrained("finetuned_lora")
```

Ou utilisez simplement notre fonction intégrée pour cela :

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "lora")
## OU pour téléverser sur Hugging Face
model.push_to_hub_merged("hf/model", tokenizer, save_method = "lora", token = "")
```

{% endcode %}

Pour fusionner en 4 bits afin de charger sur Hugging Face, appelez d’abord `merged_4bit`. Puis utilisez `merged_4bit_forced` si vous êtes certain de vouloir fusionner en 4 bits. Je vous le déconseille fortement, sauf si vous savez ce que vous allez faire du modèle 4 bits (c.-à-d. pour l’entraînement DPO par exemple, ou pour le moteur d’inférence en ligne de Hugging Face)

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "merged_4bit")
## Pour téléverser sur Hugging Face :
model.push_to_hub_merged("hf/model", tokenizer, save_method = "merged_4bit", token = "")
```

{% endcode %}

Puis, pour charger le modèle fine-tuné dans vLLM dans un autre terminal :

```bash
vllm serve finetuned_model
```

Vous devrez peut-être fournir le chemin complet si ce qui précède ne fonctionne pas, c.-à-d. :

```bash
vllm serve /mnt/disks/daniel/finetuned_model
```

Voir d’autres contenus :

### [Arguments du moteur vLLM](/docs/fr/notions-de-base/inference-and-deployment/vllm-guide/vllm-engine-arguments.md)

### [Guide de permutation à chaud LoRA](/docs/fr/notions-de-base/inference-and-deployment/vllm-guide/lora-hot-swapping-guide.md)


---

# 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/notions-de-base/inference-and-deployment/vllm-guide.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.
