> 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/computer-vision-modelle/qwen-vl.md).

# Qwen2.5-VL Vision-Language-Modell

Führe Qwen2.5-VL, das führende offene Vision-Language-Modell, für Bild-/Video-/Dokumentenverständnis auf Clore.ai-GPUs aus.

Qwen2.5-VL von Alibaba (Dezember 2024) ist das leistungsstärkste Open-Weight Vision-Language-Modell (VLM). Verfügbar in den Parametergrößen 3B, 7B und 72B versteht es Bilder, Videobilder, PDFs, Diagramme und komplexe visuelle Layouts. Die 7B-Variante trifft den Sweet Spot — sie übertrifft viele größere Modelle in Benchmarks und läuft dabei problemlos auf einer einzelnen 24-GB-GPU.

Auf [Clore.ai](https://clore.ai/) Sie können genau die GPU mieten, die Sie benötigen — von einer RTX 3090 für das 7B-Modell bis hin zu Multi-GPU-Setups für die 72B-Variante — und in wenigen Minuten mit der Analyse visueller Inhalte beginnen.

## Hauptfunktionen

* **Multimodale Eingabe** — Bilder, Video, PDFs, Screenshots, Diagramme und Schaubilder in einem einzigen Modell.
* **Drei Größen** — 3B (Edge/Mobil), 7B (Produktions-Sweet-Spot), 72B (SOTA-Qualität).
* **Dynamische Auflösung** — verarbeitet Bilder in ihrer nativen Auflösung; keine erzwungene Größenänderung auf 224×224.
* **Videoverständnis** — akzeptiert Videoeingaben mit mehreren Frames und zeitlichem Schlussfolgern.
* **Dokument-OCR** — extrahiert Text aus gescannten Dokumenten, Belegen und handschriftlichen Notizen.
* **Mehrsprachig** — starke Leistung in Englisch, Chinesisch und über 20 weiteren Sprachen.
* **Ollama-Unterstützung** — lokal ausführen mit `ollama run qwen2.5vl:7b` für eine Bereitstellung ohne Code.
* **Transformers-Integration** — `Qwen2_5_VLForConditionalGeneration` in HuggingFace `transformers`.

## Anforderungen

{% hint style="warning" %}
**Multi-GPU-Rigs der 80GB-Klasse sind auf dem Clore.ai-Marktplatz nicht gelistet.** Die größten heute gelisteten Systeme sind 4× RTX PRO 6000 Blackwell (je 96 GB, 380 GB gesamt) und 8–11× RTX 5090 (je 32 GB). Kapazitäten für A100 / H200 / B200 werden als [Bare Metal](https://clore.ai/bare-metal) auf Anfrage verkauft. Prüfe [GPU-Preise & Verfügbarkeit](/guides/guides_v2-de/erste-schritte/pricing.md) bevor du eine Bereitstellung dimensionierst.
{% endhint %}

| Komponente | 3B    | 7B       | 72B                |
| ---------- | ----- | -------- | ------------------ |
| GPU-VRAM   | 8 GB  | 16–24 GB | 80+ GB (Multi-GPU) |
| System-RAM | 16 GB | 32 GB    | 128 GB             |
| Festplatte | 10 GB | 20 GB    | 150 GB             |
| Python     | 3.10+ | 3.10+    | 3.10+              |
| CUDA       | 12.8+ | 12.8+    | 12.8+              |

**Clore.ai-GPU-Empfehlung:** Für das **7B-Modell**ist ein **RTX 4090** (24 GB, 0,14–0,42 $/Std.) oder **RTX 3090** (24 GB, 0,07–0,21 $/Std.) ideal. Für **72B**filtern Sie den Marktplatz nach **A100 80 GB** oder Multi-GPU-Setups.

## Schnellstart

### Option A: Ollama (am einfachsten)

```bash
# Ollama installieren
curl -fsSL https://ollama.ai/install.sh | sh

# Das 7B-Vision-Modell herunterladen und ausführen
ollama run qwen2.5vl:7b
```

Dann im Ollama-Prompt:

```
>>> Beschreibe dieses Bild: /pfad/zu/foto.jpg
```

### Option B: Python / Transformers

```bash
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
pip install transformers accelerate qwen-vl-utils pillow
```

## Anwendungsbeispiele

### Bildverständnis mit Transformers

```python
import torch
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

model_name = "Qwen/Qwen2.5-VL-7B-Instruct"

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    model_name,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
processor = AutoProcessor.from_pretrained(model_name)

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"},
            {"type": "text", "text": "Um welche Art Insekt handelt es sich? Beschreiben Sie seine wichtigsten identifizierenden Merkmale."},
        ],
    }
]

text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)

inputs = processor(
    text=[text],
    images=image_inputs,
    videos=video_inputs,
    padding=True,
    return_tensors="pt",
).to(model.device)

output_ids = model.generate(**inputs, max_new_tokens=512)
response = processor.batch_decode(
    output_ids[:, inputs.input_ids.shape[1]:],
    skip_special_tokens=True,
)[0]

print(response)
```

### Videoanalyse

```python
import torch
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-VL-7B-Instruct",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B-Instruct")

messages = [
    {
        "role": "user",
        "content": [
            {"type": "video", "video": "file:///workspace/clip.mp4", "max_pixels": 360 * 420, "fps": 1.0},
            {"type": "text", "text": "Fassen Sie zusammen, was in diesem Video passiert. Listen Sie die wichtigsten Ereignisse in der richtigen Reihenfolge auf."},
        ],
    }
]

text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)

inputs = processor(
    text=[text],
    images=image_inputs,
    videos=video_inputs,
    padding=True,
    return_tensors="pt",
).to(model.device)

output_ids = model.generate(**inputs, max_new_tokens=1024)
print(processor.batch_decode(output_ids[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0])
```

### Dokumenten-OCR und Extraktion

```python
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "file:///workspace/receipt.jpg"},
            Extrahieren Sie alle Positionen, Mengen und Preise aus diesem Beleg. Als JSON zurückgeben.
        ],
    }
]

# Verarbeitung mit demselben Modell-/Prozessor-Setup wie oben
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(text=[text], images=image_inputs, videos=video_inputs, padding=True, return_tensors="pt").to(model.device)
output_ids = model.generate(**inputs, max_new_tokens=2048)
print(processor.batch_decode(output_ids[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0])
```

### Ollama-API für Batch-Verarbeitung

```python
import ollama
import base64
from pathlib import Path

def analyze_image(image_path: str, question: str) -> str:
    """Ein Bild über die Ollama-API an Qwen2.5-VL senden."""
    image_data = base64.b64encode(Path(image_path).read_bytes()).decode()
    response = ollama.chat(
        model="qwen2.5vl:7b",
        messages=[{
            "role": "user",
            "content": question,
            "images": [image_data],
        }],
    )
    return response["message"]["content"]

# Einen Ordner mit Bildern im Batch verarbeiten
from pathlib import Path
for img in sorted(Path("./photos").glob("*.jpg")):
    result = analyze_image(str(img), "Beschreiben Sie dieses Bild in einem Satz.")
    print(f"{img.name}: {result}")
```

## Tipps für Clore.ai-Nutzer

1. **Ollama für schnelle Bereitstellung** — `ollama run qwen2.5vl:7b` ist der schnellste Weg zu einem funktionierenden VLM. Für die interaktive Nutzung ist kein Python-Code erforderlich.
2. **7B ist der Sweet Spot** — die 7B-Instruct-Variante passt mit 4-Bit-Quantisierung in 16 GB VRAM und liefert eine Qualität, die mit deutlich größeren Modellen konkurrieren kann.
3. **Dynamische Auflösung ist wichtig** — Qwen2.5-VL verarbeitet Bilder in nativer Auflösung. Bei großen Bildern (>4K) auf eine maximale Breite von 1920 px skalieren, um übermäßigen VRAM-Verbrauch zu vermeiden.
4. **Video-FPS-Einstellung** — für Videoeingaben setzen Sie `fps=1.0` auf 1 Frame pro Sekunde. Höhere Werte verbrauchen VRAM schnell; 1 fps reicht für die meisten Analyseaufgaben aus.
5. **Persistenter Speicher** — setzen Sie `HF_HOME=/workspace/hf_cache`; das 7B-Modell ist \~15 GB groß. Bei ollama landen Modelle unter `~/.ollama/models/`.
6. **Strukturierte Ausgabe** — Qwen2.5-VL befolgt Anweisungen zur JSON-Formatierung gut. Fordern Sie „Als JSON zurückgeben“ an, und Sie erhalten die meiste Zeit parsebare Ausgaben.
7. **Vergleich mehrerer Bilder** — Sie können mehrere Bilder in einer einzigen Nachricht für Vergleichsaufgaben übergeben (z. B. „Welches dieser beiden Produkte wirkt hochwertiger?“).
8. **tmux** — immer innerhalb von `tmux` bei Clore.ai-Mietinstanzen ausführen.

## Fehlerbehebung

| Problem                                                      | Fix                                                                                                          |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| `OutOfMemoryError` mit 7B                                    | Verwende `load_in_4bit=True` in `from_pretrained()` mit `bitsandbytes`; oder verwenden Sie die 3B-Variante   |
| Ollama-Modell nicht gefunden                                 | `ollama pull qwen2.5vl:7b` — stellen Sie sicher, dass Sie das richtige Tag haben                             |
| Langsame Videoverarbeitung                                   | Reduziere `fps` auf 0,5 und `max_pixels` auf `256 * 256`; weniger Frames = schnellere Inferenz               |
| Verwaschene oder leere Ausgabe                               | Erhöhen Sie `max_new_tokens`; der Standardwert ist für detaillierte Beschreibungen möglicherweise zu niedrig |
| `ImportError: qwen_vl_utils`                                 | `pip install qwen-vl-utils` — erforderlich für `process_vision_info()`                                       |
| 72B-Modell passt nicht hinein                                | Verwenden Sie 2× A100 80 GB mit `device_map="auto"` oder wenden Sie AWQ-Quantisierung an                     |
| Bildpfad nicht gefunden                                      | Für lokale Dateien in Nachrichten verwenden Sie `file:///absoluter/pfad` Format                              |
| Chinesisch in der Ausgabe, wenn auf Englisch gepromptet wird | Fügen Sie Ihrem Prompt „Antworten Sie nur auf Englisch.“ hinzu                                               |


---

# 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/computer-vision-modelle/qwen-vl.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.
