> 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

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

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](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 %}

## Schnelle Bereitstellung 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, budgetfreundliche Server auf [CLORE.AI Marketplace](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 Leistungsverhältnis pro Kosten

### 2. Verbindung per SSH

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

### 3. Aphrodite Engine Image ziehen

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

### 4. Aphrodite Engine starten

**Einfache Startanweisung 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
```

**Ein GGUF-Modell ausführen (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. Überprüfen Sie den Server

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

# Health-Check
curl http://localhost:2242/health

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

### 6. Zugriff über 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
```

***

## Beispielanwendungen

### 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": "Sie sind ein kreativer Schriftsteller, der sich auf Fantasy-Fiktion spezialisiert hat."},
      {"role": "user", "content": "Beginnen Sie 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 kohärenteren 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 KoboldAI-basierten Frontends:

```bash
# Kobold-Generierungsendpunkt
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 maßgeschneiderten 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 alte Zauberer öffnete sein Buch und",
    "In der neongrün beleuchteten 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`       | Serverport                                          |
| `--dtype`                  | `auto`       | `float16`, `bfloat16`, `float32`                    |
| `--quantization`           | keine        | `awq`, `gptq`, `squeezellm`, `fp8`                  |
| `--max-model-len`          | modell max   | Maximale Kontextlänge überschreiben                 |
| `--gpu-memory-utilization` | `0.90`       | GPU-Speicheranteil                                  |
| `--tensor-parallel-size`   | `1`          | Anzahl der GPUs für Tensor-Parallelismus            |
| `--max-num-seqs`           | `256`        | Maximale gleichzeitige Sequenzen                    |
| `--trust-remote-code`      | false        | Erlaube benutzerdefinierten Modellcode              |
| `--api-keys`               | keine        | Komma-getrennte 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"
```

Verwenden Sie dann `Authorization: Bearer mysecretkey1` in Anfragen.

### Lokale Modelle laden

```bash
# Binden Sie Ihr Modellverzeichnis und referenzieren Sie es
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
```

***

## Leistungs-Tipps

### 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 (eng) | ❌          |
| 12 GB    | Float16     | GPTQ Q4       | ❌          |
| 16 GB    | Float16     | Float16       | GPTQ Q4    |
| 24 GB    | Float16     | Float16       | GPTQ Q4    |
| 48 GB    | Float16     | Float16       | Float16    |

### 2. GPU-Speichernutzung optimieren

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

Beginnen Sie niedriger und erhöhen Sie, wenn Sie keine OOM-Fehler erhalten.

### 3. Verwenden Sie bfloat16 auf Ampere+-GPUs

```bash
--dtype bfloat16
```

Bessere numerische Stabilität als float16, gleiche Geschwindigkeit.

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

Diese Sampler funktionieren gut für erzählerischen Text:

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

### 5. Pascal-GPU-Tipps (GTX 10xx)

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

```bash
--dtype float16  # float32, wenn Sie NaN-Fehler bekommen
--max-model-len 2048  # Kontext reduzieren, um Speicher zu sparen
```

***

## Fehlerbehebung

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

Pascal-GPUs erfordern spezielle Behandlung. Verwenden Sie:

```bash
--dtype float16
```

Falls weiterhin Fehler auftreten, prüfen Sie, ob die Image-Version Pascal unterstützt:

```bash
docker pull alpindale/aphrodite-engine:v0.5.4  # Probieren Sie eine spezifische Version
```

### 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` innerhalb des Containers
* Ermöglichen Sie größere Batch-Größen: `--max-num-seqs 64`
* Verwenden Sie AWQ statt GPTQ (schnellere Inferenz)

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

Prüfen Sie stets, ob Ihr Modellname genau übereinstimmt:

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

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

### Problem: Wiederholte Ausgaben

Fügen Sie eine Wiederholungsstrafe hinzu:

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

### Problem: Docker-Container beendet sich stillschweigend

```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 Marketplace](https://clore.ai/marketplace)

***

## Clore.ai GPU-Empfehlungen

| Anwendungsfall       | Empfohlene GPU   | Geschätzte Kosten auf Clore.ai |
| -------------------- | ---------------- | ------------------------------ |
| Entwicklung/Tests    | RTX 3090 (24GB)  | \~$0.12/gpu/hr                 |
| Produktion (7B–13B)  | RTX 4090 (24GB)  | \~$0.70/gpu/hr                 |
| Große Modelle (70B+) | A100 80GB / H100 | \~$1.20/gpu/hr                 |

> 💡 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:

```
GET https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/aphrodite-engine.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.
