---
title: MAKAR-3B
canonical_url: "https://www.modelscope.cn/models/soliton110/MAKAR-3B"
md_url: "https://www.modelscope.cn/models/soliton110/MAKAR-3B.md"
repository: soliton110/MAKAR-3B
chinese_name: MAKAR-3B
last_updated: 2025-12-10
license: "Apache License 2.0"
pipeline_tag: visual-grounding
tasks:
  - visual-grounding
model_type:
  - qwen2_5_vl
architectures:
  - Qwen2_5_VLForConditionalGeneration
parameters: 4.1B
tensor_type:
  - BF16
library_name:
  - transformer
  - safetensors
  - pytorch
frameworks:
  - Pytorch
inference_backends:
  - "deploy_task vlm/text/emb"
  - "lmdeploy 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 95
stars: 0
---

# MAKAR-3B

> MAKAR-3B - soliton110 在 ModelScope 开源的模型。MAKAR-3B, 用于GMNER任务

soliton110/MAKAR-3B 是 ModelScope 魔搭社区上的 4.1B 参数visual-grounding模型，采用 Apache License 2.0 许可，可用 deploy_task vlm/text/emb、lmdeploy 0.9.1、sglang 0.5.2 部署。

- **Repository**: soliton110/MAKAR-3B
- **License**: Apache License 2.0
- **Tasks**: visual-grounding
- **Parameters**: 4.1B
- **Inference backends**: deploy_task vlm/text/emb, lmdeploy 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 95
- **Stars**: 0
- **Last updated**: 2025-12-10

Source: https://www.modelscope.cn/models/soliton110/MAKAR-3B

---

### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重，可浏览“模型文件”页面获取。
#### 您可以通过如下git clone命令，或者ModelScope SDK来下载模型

SDK下载
```bash
#安装ModelScope
pip install modelscope
```
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('soliton110/MAKAR-3B')
```
Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/soliton110/MAKAR-3B.git
```

使用说明
```
import os
import json
import re
from tqdm import tqdm
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

# 初始化模型和处理器
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    "modelpath",
    torch_dtype="auto",
    device_map="balanced",
    attn_implementation="flash_attention_2",
)
processor = AutoProcessor.from_pretrained("modelpath")



# 构造图像路径（假设图片名为 {key}.jpg）
img_path = f"test.jpg"

# 构造提示（prompt）
prompt = f"""
Comprehensively analyze the Text and the Image.\nText: {test_text}\n

Is "{entity_name} (is a/an {entity_type})" present in the image? If yes, provide its coordinates; else return [0,0,0,0].

Notion:
Please ignore the text content in the image (such as titles, tags, text boxes, etc.) and only focus on non-text visual elements (such as people, objects, logos, etc.).
"""

# 构建消息格式
messages = [{
    "role": "user",
    "content": [
        {"type": "image", "image": img_path},
        {"type": "text", "text": prompt}
    ]
}]

# 处理输入数据
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, _ = process_vision_info(messages)
inputs = processor(
    text=[text],
    images=image_inputs,
    padding=True,
    return_tensors="pt"
).to("cuda")

# 生成预测结果
generated_ids = model.generate(**inputs, max_new_tokens=512)
generated_ids = generated_ids[:, inputs.input_ids.shape[1]:]
output = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]

# 解析坐标结果
coords = [0, 0, 0, 0]
if match := re.search(r'\[([\d,\s]+)\]', output):
    coords = list(map(int, match.group(1).replace(' ', '').split(',')))
    coords = coords[:4]

print(f"Predicted coordinates: {coords}")

```


<p style="color: lightgrey;">如果您是本模型的贡献者，我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>，及时完善模型卡片内容。</p>
