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

# vLLM-Bereitstellungs- & Inferenzleitfaden

Leitfaden zum Speichern und Bereitstellen von LLMs mit vLLM für das Bereitstellen von LLMs in der Produktion

### :computer:vLLM installieren

Für NVIDIA-GPUs verwenden Sie uv und führen Sie aus:

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

Für AMD-GPUs verwenden Sie bitte das Nightly-Docker-Image: `rocm/vllm-dev:nightly`

Für den Nightly-Branch für NVIDIA-GPUs führen Sie aus:

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

Siehe [vLLM-Dokumentation](https://docs.vllm.ai/en/stable/getting_started/installation) für weitere Details

### :truck:vLLM-Modelle bereitstellen

Nachdem Sie Ihr Fine-Tuning gespeichert haben, können Sie einfach Folgendes tun:

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

### :fire\_engine:vLLM-Deployments-Server-Flags, Engine-Argumente und Optionen

Einige wichtige Server-Flags, die verwendet werden sollten, finden Sie unter [#vllm-deployment-server-flags-engine-arguments-and-options](#vllm-deployment-server-flags-engine-arguments-and-options "mention")

### 🦥Unsloth-Fine-Tunes in vLLM bereitstellen

Nach dem Fine-Tuning [Fine-tuning Guide](/docs/de/loslegen/fine-tuning-llms-guide.md) oder mit unseren Notebooks unter [Unsloth-Notebooks](/docs/de/loslegen/unsloth-notebooks.md), können Sie Ihre Modelle direkt über vLLM in einem einzigen Workflow speichern oder bereitstellen. Ein Beispiel für ein Unsloth-Fine-Tuning-Skript, z. B.:

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

**Um für vLLM in 16-Bit zu speichern, verwenden Sie:**

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "merged_16bit")
## ODER auf HuggingFace hochladen:
model.push_to_hub_merged("hf/model", tokenizer, save_method = "merged_16bit", token = "")
```

{% endcode %}

**Um nur die LoRA-Adapter zu speichern**, verwenden Sie entweder:

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

Oder verwenden Sie einfach unsere integrierte Funktion dafür:

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "lora")
## ODER auf HuggingFace hochladen
model.push_to_hub_merged("hf/model", tokenizer, save_method = "lora", token = "")
```

{% endcode %}

Um zum Laden auf HuggingFace auf 4-Bit zusammenzuführen, rufen Sie zuerst `merged_4bit`auf. Verwenden Sie dann `merged_4bit_forced` wenn Sie sicher sind, dass Sie zu 4-Bit zusammenführen möchten. Davon rate ich Ihnen sehr ab, es sei denn, Sie wissen genau, was Sie mit dem 4-Bit-Modell vorhaben (z. B. für DPO-Training oder für die Online-Inferenz-Engine von HuggingFace).

{% code overflow="wrap" %}

```python
model.save_pretrained_merged("finetuned_model", tokenizer, save_method = "merged_4bit")
## Auf HuggingFace hochladen:
model.push_to_hub_merged("hf/model", tokenizer, save_method = "merged_4bit", token = "")
```

{% endcode %}

Dann, um das feinabgestimmte Modell in vLLM in einem anderen Terminal zu laden:

```bash
vllm serve finetuned_model
```

Möglicherweise müssen Sie den vollständigen Pfad angeben, falls das oben nicht funktioniert, z. B.:

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

Siehe weitere Inhalte:

### [vLLM-Engine-Argumente](/docs/de/grundlagen/inference-and-deployment/vllm-guide/vllm-engine-arguments.md)

### [Leitfaden zum Hot-Swapping von LoRA](/docs/de/grundlagen/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/de/grundlagen/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.
