Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# **Spatial-VU**
|
| 6 |
+
|
| 7 |
+
> The **Spatial-VU** model is a fine-tuned variant of **Qwen2.5-VL-7B-Instruct**, developed for **Spatial Reasoning** and **Vision Understanding**. It is designed to deliver detailed, context-aware visual descriptions and reasoning outputs across a wide range of image types, resolutions, and aspect ratios.
|
| 8 |
+
|
| 9 |
+
## Key Highlights
|
| 10 |
+
|
| 11 |
+
* **Spatial Reasoning and Visual Comprehension**: Optimized for interpreting spatial layouts, object relationships, and scene understanding within images.
|
| 12 |
+
* **High-Precision Descriptions**: Generates detailed, context-rich captions for general, technical, and abstract imagery.
|
| 13 |
+
* **Adaptive Across Aspect Ratios**: Performs effectively with images of varying formats—wide, tall, square, and irregular.
|
| 14 |
+
* **Multi-Level Detail Control**: Supports both concise summaries and fine-grained analytical outputs, depending on the prompt.
|
| 15 |
+
* **Built on Qwen2.5-VL Architecture**: Utilizes the visual-linguistic reasoning power of Qwen2.5-VL-7B for structured and accurate comprehension tasks.
|
| 16 |
+
* **Multilingual Support**: Outputs in English by default, with the ability to generate multilingual responses through prompt conditioning.
|
| 17 |
+
|
| 18 |
+
## Quick Start with Transformers
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
| 22 |
+
from qwen_vl_utils import process_vision_info
|
| 23 |
+
|
| 24 |
+
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 25 |
+
"prithivMLmods/Spatial-VU", torch_dtype="auto", device_map="auto"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
processor = AutoProcessor.from_pretrained("prithivMLmods/Spatial-VU")
|
| 29 |
+
|
| 30 |
+
messages = [
|
| 31 |
+
{
|
| 32 |
+
"role": "user",
|
| 33 |
+
"content": [
|
| 34 |
+
{
|
| 35 |
+
"type": "image",
|
| 36 |
+
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
| 37 |
+
},
|
| 38 |
+
{"type": "text", "text": "Analyze the spatial layout and describe the scene."},
|
| 39 |
+
],
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
|
| 43 |
+
text = processor.apply_chat_template(
|
| 44 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 45 |
+
)
|
| 46 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
| 47 |
+
inputs = processor(
|
| 48 |
+
text=[text],
|
| 49 |
+
images=image_inputs,
|
| 50 |
+
videos=video_inputs,
|
| 51 |
+
padding=True,
|
| 52 |
+
return_tensors="pt",
|
| 53 |
+
)
|
| 54 |
+
inputs = inputs.to("cuda")
|
| 55 |
+
|
| 56 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
| 57 |
+
generated_ids_trimmed = [
|
| 58 |
+
out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 59 |
+
]
|
| 60 |
+
output_text = processor.batch_decode(
|
| 61 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 62 |
+
)
|
| 63 |
+
print(output_text)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Intended Use
|
| 67 |
+
|
| 68 |
+
* Spatial reasoning, visual understanding, and scene analysis tasks.
|
| 69 |
+
* Descriptive and interpretive caption generation for research or vision-language evaluation.
|
| 70 |
+
* Structured visual comprehension in creative and analytical applications.
|
| 71 |
+
* Data annotation and reasoning augmentation in multimodal AI pipelines.
|
| 72 |
+
* Spatial layout and context interpretation across diverse visual domains.
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
|
| 76 |
+
* May generate variable outputs depending on the phrasing of prompts.
|
| 77 |
+
* Not recommended for production use cases requiring strong moderation or controlled tone.
|
| 78 |
+
* Performance may vary on abstract, heavily stylized, or low-context visual inputs.
|
| 79 |
+
* Lacks fine-tuned control over subjective or ambiguous visual content interpretations.
|