> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/aphrodite-engine.md).

# Aphrodite Engine

Führe Aphrodite Engine für LLM-Inferenz auf älteren und modernen GPUs auf Clore.ai aus

Aphrodite Engine ist ein optimierter LLM-Inferenzserver, der auf vLLM aufbaut und speziell auf die Community für kreatives Schreiben und Rollenspiele zugeschnitten ist. Er unterstützt eine breite Palette von GPUs ab Pascal (GTX-1000-Serie) und ist damit die perfekte Wahl, um Sprachmodelle auf älteren oder günstigen CLORE.AI-GPU-Servern auszuführen, auf denen andere Frameworks versagen. Aphrodite bietet Kobold-kompatible APIs, Mirostat-Sampling und fortgeschrittene Text-Sampling-Algorithmen, die in gängigen Serving-Frameworks nicht zu finden sind.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die gemietet wurden über [CLORE.AI-Marktplatz](https://clore.ai/marketplace).
{% endhint %}

## Serveranforderungen

| Parameter  | Minimum                    | Empfohlen      |
| ---------- | -------------------------- | -------------- |
| RAM        | 16 GB                      | 32 GB+         |
| VRAM       | 6 GB                       | 16 GB+         |
| Festplatte | 40 GB                      | 150 GB+        |
| GPU        | NVIDIA Pascal+ (GTX 1060+) | RTX 3090, A100 |

{% hint style="info" %}
Aphrodite Engine ist einer der wenigen LLM-Server, die GPUs der Pascal-Generation (GTX-10xx-Serie) unterstützen. Das macht ihn ideal für Budget-Server auf CLORE.AI mit älteren GPUs, die niedrige Mietpreise haben.
{% endhint %}

## Schnellbereitstellung auf CLORE.AI

**Docker-Image:** `alpindale/aphrodite-engine:latest`

**Ports:** `22/tcp`, `2242/http`

**Umgebungsvariablen:**

| Variable          | Beispiel                             | Beschreibung                            |
| ----------------- | ------------------------------------ | --------------------------------------- |
| `HF_TOKEN`        | `hf_xxx...`                          | HuggingFace-Token für gesperrte Modelle |
| `APHRODITE_MODEL` | `mistralai/Mistral-7B-Instruct-v0.3` | Zu ladendes Modell                      |

## Schritt-für-Schritt-Einrichtung

### 1. Mieten Sie einen GPU-Server auf CLORE.AI

Aphrodites breite GPU-Unterstützung ermöglicht es Ihnen, kostengünstige Server auf [CLORE.AI-Marktplatz](https://clore.ai/marketplace):

* **Pascal (GTX 1060–1080 Ti)**: 6–11 GB VRAM — kleine 3B-7B-Modelle mit Quantisierung ausführen
* **Turing (RTX-2000-Serie)**: 8–24 GB VRAM — 7B-13B-Modelle, bessere Leistung
* **Ampere (RTX-3000/A100)**: 24–80 GB VRAM — 30B-70B-Modelle, volle Geschwindigkeit
* **Ada (RTX-4000-Serie)**: 16–24 GB VRAM — bestes Leistungs-/Preisverhältnis

### 2. Verbinden Sie sich per SSH

```bash
ssh -p <PORT> root@<SERVER_IP>
```

### 3. Aphrodite-Engine-Image herunterladen

```bash
docker pull alpindale/aphrodite-engine:latest
```

### 4. Aphrodite Engine starten

**Einfacher Start mit einem 7B-Modell:**

```bash
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /root/models:/root/.cache/huggingface \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model mistralai/Mistral-7B-Instruct-v0.3 \\
    --host 0.0.0.0 \
    --port 2242 \
    --max-model-len 4096
```

**Mit HuggingFace-Token (Llama 3):**

```bash
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /root/models:/root/.cache/huggingface \
  -e HF_TOKEN=hf_your_token_here \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model meta-llama/Meta-Llama-3-8B-Instruct \
    --host 0.0.0.0 \
    --port 2242 \
    --dtype bfloat16 \\
    --max-model-len 8192
```

**Mit GPTQ-Quantisierung (für begrenzten VRAM):**

```bash
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /root/models:/root/.cache/huggingface \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model TheBloke/Mistral-7B-Instruct-v0.2-GPTQ \
    --host 0.0.0.0 \
    --port 2242 \
    --quantization gptq \
    --max-model-len 4096
```

**Mit AWQ-Quantisierung:**

```bash
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /root/models:/root/.cache/huggingface \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model casperhansen/mistral-7b-instruct-v0.2-awq \
    --host 0.0.0.0 \
    --port 2242 \
    --quantization awq \\
    --max-model-len 4096
```

**Ausführen eines GGUF-Modells (Aphrodite unterstützt GGUF nativ):**

```bash
# Zuerst die GGUF-Datei herunterladen
docker exec -it aphrodite bash -c "
pip install huggingface_hub
python3 -c \"from huggingface_hub import hf_hub_download; hf_hub_download(
    repo_id='TheBloke/Mistral-7B-Instruct-v0.2-GGUF',
    filename='mistral-7b-instruct-v0.2.Q4_K_M.gguf',
    local_dir='/root/models/mistral-gguf'
)\"
"

# Dann mit GGUF starten
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /root/models:/models \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model /models/mistral-gguf/mistral-7b-instruct-v0.2.Q4_K_M.gguf \
    --host 0.0.0.0 \
    --port 2242 \
    --tokenizer mistralai/Mistral-7B-Instruct-v0.2
```

### 5. Den Server überprüfen

```bash
# Protokolle prüfen
docker logs -f aphrodite

# Gesundheitsprüfung
curl http://localhost:2242/health

# Geladene Modelle auflisten
curl http://localhost:2242/v1/models
```

### 6. Zugriff über den CLORE.AI-HTTP-Proxy

Das CLORE.AI-Bestellpanel stellt eine `http_pub` URL für Port 2242 bereit. Verwenden Sie sie in Ihren Client-Anwendungen:

```
https://<order-id>-2242.clore.ai/v1
```

***

## Anwendungsbeispiele

### Beispiel 1: OpenAI-kompatibler Chat

```bash
curl http://localhost:2242/v1/chat/completions \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.3",
    "messages": [
      {"role": "system", "content": "Du bist ein kreativer Schriftsteller, der sich auf Fantasy-Fiktion spezialisiert hat."},
      {"role": "user", "content": "Beginne eine Kurzgeschichte über einen Drachen, der das Malen lernt."}
    ],
    "max_tokens": 500,
    "temperature": 0.9,
    "top_p": 0.95
  }'
```

### Beispiel 2: Fortgeschrittenes Sampling mit Mirostat

Aphrodite unterstützt Mirostat-Sampling für zusammenhängenderen Langtext:

```bash
curl http://localhost:2242/v1/completions \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.3",
    "prompt": "Es war einmal in einer Cyberpunk-Stadt,",
    "max_tokens": 400,
    "mirostat_mode": 2,
    "mirostat_tau": 5.0,
    "mirostat_eta": 0.1
  }'
```

### Beispiel 3: Kobold-kompatible API

Aphrodite enthält einen Kobold-kompatiblen Endpunkt zur Verwendung mit auf KoboldAI basierenden Frontends:

```bash
# Kobold-Generierungs-Endpunkt
curl http://localhost:2242/api/v1/generate \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "Das Raumschiff trat in den Hyperraum ein,",
    "max_length": 200,
    "temperature": 0.8,
    "top_p": 0.92,
    "rep_pen": 1.15
  }'
```

### Beispiel 4: Python-Client mit benutzerdefinierten Samplern

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:2242/v1",
    api_key="none",
)

# Kreatives Schreiben mit angepassten Samplern
response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.3",
    messages=[
        {
            "role": "user",
            "content": "Schreibe ein Gedicht über die Stille zwischen den Sternen.",
        }
    ],
    max_tokens=300,
    temperature=1.1,
    top_p=0.95,
    frequency_penalty=0.3,
    presence_penalty=0.2,
)

print(response.choices[0].message.content)
```

### Beispiel 5: Batch-Vervollständigungen

```python
import requests

BASE_URL = "http://localhost:2242"

prompts = [
    "Der uralte Zauberer öffnete sein Buch und",
    "In der neonbeleuchteten Gasse bemerkte der Detektiv",
    "Die letzte KI auf der Erde sagte zum Roboter:",
]

for prompt in prompts:
    response = requests.post(
        f"{BASE_URL}/v1/completions",
        json={
            "model": "mistralai/Mistral-7B-Instruct-v0.3",
            "prompt": prompt,
            "max_tokens": 150,
            "temperature": 0.85,
            "top_k": 50,
            "top_p": 0.95,
            "repetition_penalty": 1.1,
        },
    )
    result = response.json()
    print(f"Prompt: {prompt}")
    print(f"Fortsetzung: {result['choices'][0]['text']}\n")
```

***

## Konfiguration

### Wichtige Startparameter

| Parameter                  | Standard     | Beschreibung                                       |
| -------------------------- | ------------ | -------------------------------------------------- |
| `--model`                  | erforderlich | Modell-ID oder lokaler Pfad                        |
| `--host`                   | `127.0.0.1`  | Bind-Adresse                                       |
| `--port`                   | `2242`       | Server-Port                                        |
| `--dtype`                  | `auto`       | `float16`, `bfloat16`, `float32`                   |
| `--quantization`           | none         | `awq`, `gptq`, `squeezellm`, `fp8`                 |
| `--max-model-len`          | max. Modell  | Maximale Kontextlänge überschreiben                |
| `--gpu-memory-utilization` | `0.90`       | Anteil des GPU-Speichers                           |
| `--tensor-parallel-size`   | `1`          | Anzahl der GPUs für Tensor Parallelism             |
| `--max-num-seqs`           | `256`        | Maximale gleichzeitige Sequenzen                   |
| `--trust-remote-code`      | false        | Benutzerdefinierten Modellcode erlauben            |
| `--api-keys`               | none         | Kommagetrennte API-Schlüssel zur Authentifizierung |
| `--served-model-name`      | Modellname   | Benutzerdefinierter Name für API-Antworten         |

### API-Schlüssel-Authentifizierung hinzufügen

```bash
python3 -m aphrodite.endpoints.openai.api_server \
  --model mistralai/Mistral-7B-Instruct-v0.3 \\
  --host 0.0.0.0 \
  --port 2242 \
  --api-keys "mysecretkey1,mysecretkey2"
```

Dann verwenden `Authorization: Bearer mysecretkey1` in Anfragen.

### Lokale Modelle laden

```bash
# Mounten Sie Ihr Modellverzeichnis und verweisen Sie darauf
docker run -d \
  --name aphrodite \
  --gpus all \
  --ipc host \
  -p 2242:2242 \
  -v /path/to/your/model:/model \
  alpindale/aphrodite-engine:latest \
  python3 -m aphrodite.endpoints.openai.api_server \
    --model /model \
    --host 0.0.0.0 \
    --port 2242
```

***

## Leistungstipps

### 1. Wählen Sie die richtige Quantisierung für Ihre GPU

| GPU-VRAM | 7B-Modell   | 13B-Modell      | 30B-Modell |
| -------- | ----------- | --------------- | ---------- |
| 6 GB     | GPTQ/AWQ Q4 | ❌               | ❌          |
| 8 GB     | GPTQ Q4     | GPTQ Q4 (knapp) | ❌          |
| 12 GB    | Float16     | GPTQ Q4         | ❌          |
| 16 GB    | Float16     | Float16         | GPTQ Q4    |
| 24 GB    | Float16     | Float16         | GPTQ Q4    |
| 48 GB    | Float16     | Float16         | Float16    |

### 2. GPU-Speicherauslastung optimieren

```bash
--gpu-memory-utilization 0.93  # Mehr KV-Cache herausquetschen
```

Fangen Sie niedriger an und erhöhen Sie den Wert, wenn keine OOM-Fehler auftreten.

### 3. bfloat16 auf Ampere+-GPUs verwenden

```bash
--dtype bfloat16
```

Bessere numerische Stabilität als float16, gleiche Geschwindigkeit.

### 4. Für Rollenspiel/Kreatives Schreiben optimieren

Diese Sampler eignen sich gut für narrative Texte:

```json
{
  "temperature": 0.85,
  "top_p": 0.92,
  "top_k": 40,
  "repetition_penalty": 1.12,
  "mirostat_mode": 2,
  "mirostat_tau": 5.0
}
```

### 5. Tipps für Pascal-GPUs (GTX 10xx)

Bei Pascal-GPUs Flash Attention vermeiden (nicht unterstützt):

```bash
--dtype float16  # float32, wenn Sie NaN-Fehler erhalten
--max-model-len 2048  # Kontext für mehr Speichereinsparung reduzieren
```

***

## Fehlerbehebung

### Problem: "CUDA capability sm\_6x not supported"

Pascal-GPUs erfordern eine besondere Behandlung. Verwenden Sie:

```bash
--dtype float16
```

Wenn es immer noch fehlschlägt, prüfen Sie, ob die Image-Version Pascal unterstützt:

```bash
docker pull alpindale/aphrodite-engine:v0.5.4  # Bestimmte Version ausprobieren
```

### Problem: "out of memory" auf kleinen GPUs

```bash
--gpu-memory-utilization 0.85
--max-model-len 2048
--quantization gptq  # Oder awq
```

### Problem: Langsame Token-Generierung

* Prüfen Sie, ob die GPU tatsächlich verwendet wird: `nvidia-smi` im Container
* Größere Batch-Größen aktivieren: `--max-num-seqs 64`
* AWQ statt GPTQ verwenden (schnellere Inferenz)

### Problem: Modell nicht gefunden / 404-Fehler

Prüfen Sie immer, ob Ihr Modellname exakt übereinstimmt:

```bash
curl http://localhost:2242/v1/models
```

Verwenden Sie in Ihren Anfragen den exakten Modellnamen aus der Antwort.

### Problem: Wiederholte Ausgaben

Wiederholungsstrafe hinzufügen:

```json
{
  "repetition_penalty": 1.15,
  "frequency_penalty": 0.3
}
```

### Problem: Docker-Container beendet sich ohne Meldung

```bash
docker logs aphrodite 2>&1 | tail -100
# Häufige Ursachen: unzureichender VRAM, ungültiger Modellpfad
```

***

## Links

* [GitHub](https://github.com/PygmalionAI/aphrodite-engine)
* [Dokumentation](https://aphrodite.pygmalion.chat)
* [Docker Hub](https://hub.docker.com/r/alpindale/aphrodite-engine)
* [Unterstützte Modelle](https://github.com/PygmalionAI/aphrodite-engine?tab=readme-ov-file#supported-models)
* [CLORE.AI-Marktplatz](https://clore.ai/marketplace)

***

## GPU-Empfehlungen für Clore.ai

| Anwendungsfall       | Empfohlene GPU   | Geschätzte Kosten bei Clore.ai |
| -------------------- | ---------------- | ------------------------------ |
| Entwicklung/Testen   | RTX 3090 (24 GB) | 0,07–0,21 $/GPU/Stunde         |
| Produktion (7B–13B)  | RTX 4090 (24 GB) | 0,14–0,42 $/GPU/Stunde         |
| Große Modelle (70B+) | A100 80GB / H100 | \~$1.04/GPU/Stunde             |

> 💡 Alle Beispiele in diesem Leitfaden können bereitgestellt werden auf [Clore.ai](https://clore.ai/marketplace) GPU-Servern. Durchsuchen Sie verfügbare GPUs und mieten Sie stundenweise — keine Verpflichtungen, voller Root-Zugriff.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/aphrodite-engine.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
