> 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-hi/vision-models/qwen-vl.md).

# Qwen2.5-VL विज़न लैंग्वेज मॉडल

Clore.ai GPUs पर छवि/वीडियो/दस्तावेज़ समझने के लिए अग्रणी ओपन विज़न-लैंग्वेज मॉडल Qwen2.5-VL चलाएँ।

Alibaba (दिसंबर 2024) का Qwen2.5-VL सबसे अच्छा प्रदर्शन करने वाला open-weight vision-language model (VLM) है। यह 3B, 7B, और 72B parameter sizes में उपलब्ध है, और images, video frames, PDFs, charts, तथा complex visual layouts को समझता है। 7B variant सही संतुलन बनाता है — यह benchmarks पर कई बड़े models से बेहतर प्रदर्शन करता है, जबकि एक अकेले 24 GB GPU पर आराम से चलता है।

पर [Clore.ai](https://clore.ai/) आप ठीक वही GPU किराए पर ले सकते हैं जिसकी आपको ज़रूरत है — 7B model के लिए RTX 3090 से लेकर 72B variant के लिए multi-GPU setups तक — और कुछ ही मिनटों में visual content का विश्लेषण शुरू कर सकते हैं।

## मुख्य विशेषताएँ

* **बहु-माध्यम इनपुट** — images, video, PDFs, screenshots, charts, और diagrams एक ही model में।
* **तीन स्केल** — 3B (edge/mobile), 7B (production sweet spot), 72B (SOTA quality).
* **गतिशील resolution** — images को उनके मूल resolution पर process करता है; 224×224 पर ज़बरदस्ती resize नहीं करता।
* **वीडियो समझ** — temporal reasoning के साथ multi-frame video input स्वीकार करता है।
* **दस्तावेज़ OCR** — scanned documents, receipts, और handwritten notes से text निकालता है।
* **बहुभाषी** — English, Chinese, और 20+ अन्य भाषाओं में मजबूत प्रदर्शन।
* **Ollama समर्थन** — के साथ स्थानीय रूप से चलाएँ `ollama run qwen2.5vl:7b` बिना-कोड deployment के लिए।
* **Transformers एकीकरण** — `Qwen2_5_VLForConditionalGeneration` HuggingFace में `transformers`.

## आवश्यकताएँ

{% hint style="warning" %}
**Clore.ai marketplace पर multi-GPU 80GB-class rigs सूचीबद्ध नहीं हैं।** आज सूचीबद्ध सबसे बड़े boxes 4× RTX PRO 6000 Blackwell (प्रत्येक 96GB, कुल 380GB) और 8–11× RTX 5090 (प्रत्येक 32GB) हैं। A100 / H200 / B200 क्षमता [bare metal](https://clore.ai/bare-metal) के रूप में अनुरोध पर बेची जाती है। देखें [GPU मूल्य और उपलब्धता](/guides/guides_v2-hi/getting-started/pricing.md) किसी deployment का आकार तय करने से पहले।
{% endhint %}

| घटक        | 3B    | 7B       | 72B                |
| ---------- | ----- | -------- | ------------------ |
| GPU VRAM   | 8 GB  | 16–24 GB | 80+ GB (multi-GPU) |
| System RAM | 16 GB | 32 GB    | 128 GB             |
| डिस्क      | 10 GB | 20 GB    | 150 GB             |
| Python     | 3.10+ | 3.10+    | 3.10+              |
| CUDA       | 12.8+ | 12.8+    | 12.8+              |

**Clore.ai GPU अनुशंसा:** के लिए **7B model**, एक **RTX 4090** (24 GB, $0.14–0.42/घंटा) या **RTX 3090** (24 GB, $0.07–0.21/घंटा) आदर्श है। For **72B**, मार्केटप्लेस को फ़िल्टर करें **A100 80 GB** या multi-GPU setups.

## त्वरित शुरुआत

### विकल्प A: Ollama (सबसे सरल)

```bash
# ollama इंस्टॉल करें
curl -fsSL https://ollama.ai/install.sh | sh

# 7B vision model को pull और run करें
ollama run qwen2.5vl:7b
```

फिर ollama prompt में:

```
>>> इस image का वर्णन करें: /path/to/photo.jpg
```

### विकल्प B: Python / Transformers

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

## उपयोग के उदाहरण

### Transformers के साथ Image Understanding

```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": "यह कीट किस प्रजाति का है? इसकी मुख्य पहचान करने वाली विशेषताओं का वर्णन करें."},
        ],
    }
]

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

### वीडियो विश्लेषण

```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": "इस वीडियो में क्या होता है, उसका सारांश दें। प्रमुख घटनाओं को क्रम में सूचीबद्ध करें."},
        ],
    }
]

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

### दस्तावेज़ OCR और निष्कर्षण

```python
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "file:///workspace/receipt.jpg"},
            {"type": "text", "text": "इस रसीद से सभी आइटम, मात्राएँ, और कीमतें निकालें। JSON के रूप में लौटाएँ."},
        ],
    }
]

# ऊपर दिए गए उसी model/processor setup का उपयोग करके प्रक्रिया करें
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

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

def analyze_image(image_path: str, question: str) -> str:
    """Ollama API के माध्यम से Qwen2.5-VL को एक image भेजें."""
    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"]

# images के एक folder को batch process करें
from pathlib import Path
for img in sorted(Path("./photos").glob("*.jpg")):
    result = analyze_image(str(img), "इस image का एक वाक्य में वर्णन करें.")
    print(f"{img.name}: {result}")
```

## Clore.ai उपयोगकर्ताओं के लिए सुझाव

1. **त्वरित deployment के लिए Ollama** — `ollama run qwen2.5vl:7b` कार्यशील VLM तक पहुँचने का सबसे तेज़ रास्ता है। इंटरैक्टिव उपयोग के लिए Python code की आवश्यकता नहीं है।
2. **7B ही सबसे उपयुक्त है** — 7B Instruct variant 4-bit quantization के साथ 16 GB VRAM में फिट हो जाता है और बहुत बड़े models के बराबर गुणवत्ता देता है।
3. **गतिशील resolution महत्वपूर्ण है** — Qwen2.5-VL images को मूल resolution पर process करता है। बड़ी images (>4K) के लिए, अत्यधिक VRAM उपयोग से बचने हेतु 1920px अधिकतम चौड़ाई तक resize करें।
4. **वीडियो fps सेटिंग** — वीडियो input के लिए, सेट करें `fps=1.0` ताकि प्रति सेकंड 1 frame sample हो। अधिक मान VRAM जल्दी खा जाते हैं; अधिकांश विश्लेषण कार्यों के लिए 1 fps पर्याप्त है।
5. **स्थायी storage** — सेट करें `HF_HOME=/workspace/hf_cache`; 7B model लगभग \~15 GB है। ollama के लिए, models यहाँ जाते हैं `~/.ollama/models/`.
6. **संरचित आउटपुट** — Qwen2.5-VL JSON formatting instructions का अच्छी तरह पालन करता है। "Return as JSON" माँगें और आपको अधिकांश समय parse करने योग्य output मिलेगा।
7. **बहु-image तुलना** — तुलना कार्यों के लिए आप एक ही संदेश में multiple images भेज सकते हैं (जैसे, "इन दो उत्पादों में से कौन सा अधिक premium दिखता है?").
8. **tmux** — हमेशा के अंदर चलाएँ `tmux` Clore.ai रेंटल्स पर।

## समस्या निवारण

| समस्या                                        | ठीक करें                                                                                                  |
| --------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `OutOfMemoryError` 7B के साथ                  | उपयोग करें `load_in_4bit=True` में `from_pretrained()` के साथ `bitsandbytes`; या 3B variant का उपयोग करें |
| Ollama मॉडल नहीं मिला                         | `ollama pull qwen2.5vl:7b` — सुनिश्चित करें कि आपके पास सही tag है                                        |
| धीमी video processing                         | कम करें `fps` को 0.5 तक और `max_pixels` को `256 * 256`; कम frames = तेज़ inference                        |
| बिगड़ा हुआ या खाली output                     | बढ़ाएँ `max_new_tokens`; default विस्तृत descriptions के लिए बहुत कम हो सकता है                           |
| `ImportError: qwen_vl_utils`                  | `pip install qwen-vl-utils` — के लिए आवश्यक `process_vision_info()`                                       |
| 72B model फिट नहीं होता                       | 2× A100 80 GB का उपयोग करें `device_map="auto"` या AWQ quantization लागू करें                             |
| Image path नहीं मिला                          | local files के लिए messages में, उपयोग करें `file:///absolute/path` format                                |
| English में prompt करने पर output में Chinese | अपनी prompt में "केवल English में जवाब दें." जोड़ें                                                       |


---

# 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-hi/vision-models/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.
