Image-Text-to-Text
Transformers
Safetensors
cohere_compass
vision
multimodal
conversational
multilingual
native-resolution
Instructions to use CohereLabs/North-Micro-Vision-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CohereLabs/North-Micro-Vision-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="CohereLabs/North-Micro-Vision-Instruct") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("CohereLabs/North-Micro-Vision-Instruct") model = AutoModelForMultimodalLM.from_pretrained("CohereLabs/North-Micro-Vision-Instruct", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CohereLabs/North-Micro-Vision-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CohereLabs/North-Micro-Vision-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Micro-Vision-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/CohereLabs/North-Micro-Vision-Instruct
- SGLang
How to use CohereLabs/North-Micro-Vision-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "CohereLabs/North-Micro-Vision-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Micro-Vision-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "CohereLabs/North-Micro-Vision-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CohereLabs/North-Micro-Vision-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use CohereLabs/North-Micro-Vision-Instruct with Docker Model Runner:
docker model run hf.co/CohereLabs/North-Micro-Vision-Instruct
Update README.md
Browse files
README.md
CHANGED
|
@@ -95,7 +95,7 @@ model = AutoModelForImageTextToText.from_pretrained(
|
|
| 95 |
)
|
| 96 |
|
| 97 |
# To enable Flash Attention 2, load the model with the following settings:
|
| 98 |
-
# model =
|
| 99 |
# model_id,
|
| 100 |
# dtype=torch.bfloat16,
|
| 101 |
# attn_implementation="flash_attention_2",
|
|
@@ -160,7 +160,7 @@ North Micro Vision Instruct is intended for research and development use cases s
|
|
| 160 |
|
| 161 |
## Benchmark Results
|
| 162 |
|
| 163 |
-
The complete comparison is provided below.
|
| 164 |
|
| 165 |
<table>
|
| 166 |
<thead>
|
|
@@ -244,7 +244,7 @@ The complete comparison is provided below. See the [technical blog post](https:/
|
|
| 244 |
<td>0.387</td>
|
| 245 |
<td>0.572</td>
|
| 246 |
<td>0.539</td>
|
| 247 |
-
<td>0.000<sup>
|
| 248 |
</tr>
|
| 249 |
<tr>
|
| 250 |
<th colspan="9" style="text-align: left; background-color: rgba(127, 127, 127, 0.16);">Multilingual</th>
|
|
@@ -375,7 +375,7 @@ The complete comparison is provided below. See the [technical blog post](https:/
|
|
| 375 |
<td>0.380</td>
|
| 376 |
<td>0.432</td>
|
| 377 |
<td>0.477</td>
|
| 378 |
-
|
| 379 |
<td>0.474</td>
|
| 380 |
<td>0.399</td>
|
| 381 |
</tr>
|
|
@@ -383,7 +383,7 @@ The complete comparison is provided below. See the [technical blog post](https:/
|
|
| 383 |
<th colspan="9" style="text-align: left; background-color: rgba(127, 127, 127, 0.16);">Grounding / Counting</th>
|
| 384 |
</tr>
|
| 385 |
<tr>
|
| 386 |
-
<th style="text-align: left; font-weight: normal;">RefCOCO<sub>avg</sub>
|
| 387 |
<td style="background-color: rgba(127, 127, 127, 0.08);">0.732</td>
|
| 388 |
<td>0.317</td>
|
| 389 |
<td>0.581</td>
|
|
@@ -395,7 +395,7 @@ The complete comparison is provided below. See the [technical blog post](https:/
|
|
| 395 |
</tr>
|
| 396 |
<tr>
|
| 397 |
<th style="text-align: left; font-weight: normal;">CountBench</th>
|
| 398 |
-
<td style="background-color: rgba(127,
|
| 399 |
<td>0.737</td>
|
| 400 |
<td>0.910</td>
|
| 401 |
<td>0.645</td>
|
|
@@ -467,8 +467,8 @@ The complete comparison is provided below. See the [technical blog post](https:/
|
|
| 467 |
</tr>
|
| 468 |
</tbody>
|
| 469 |
</table>
|
| 470 |
-
<p><small>
|
| 471 |
-
<p><small>
|
| 472 |
|
| 473 |
|
| 474 |
|
|
|
|
| 95 |
)
|
| 96 |
|
| 97 |
# To enable Flash Attention 2, load the model with the following settings:
|
| 98 |
+
# model = AutoModelForCausalLM.from_pretrained(
|
| 99 |
# model_id,
|
| 100 |
# dtype=torch.bfloat16,
|
| 101 |
# attn_implementation="flash_attention_2",
|
|
|
|
| 160 |
|
| 161 |
## Benchmark Results
|
| 162 |
|
| 163 |
+
The complete comparison is provided below. We ran vision-language and text-only evaluations with [VLMEvalKit](https://github.com/open-compass/vlmevalkit), capping generation at 1,024 tokens; see the [technical blog post](https://huggingface.co/blog/CohereLabs/meet-north-micro-vision-instruct) for the full methodology.
|
| 164 |
|
| 165 |
<table>
|
| 166 |
<thead>
|
|
|
|
| 244 |
<td>0.387</td>
|
| 245 |
<td>0.572</td>
|
| 246 |
<td>0.539</td>
|
| 247 |
+
<td>0.000<sup>‡</sup></td>
|
| 248 |
</tr>
|
| 249 |
<tr>
|
| 250 |
<th colspan="9" style="text-align: left; background-color: rgba(127, 127, 127, 0.16);">Multilingual</th>
|
|
|
|
| 375 |
<td>0.380</td>
|
| 376 |
<td>0.432</td>
|
| 377 |
<td>0.477</td>
|
| 378 |
+
<td>0.379</td>
|
| 379 |
<td>0.474</td>
|
| 380 |
<td>0.399</td>
|
| 381 |
</tr>
|
|
|
|
| 383 |
<th colspan="9" style="text-align: left; background-color: rgba(127, 127, 127, 0.16);">Grounding / Counting</th>
|
| 384 |
</tr>
|
| 385 |
<tr>
|
| 386 |
+
<th style="text-align: left; font-weight: normal;">RefCOCO<sub>avg</sub><sup>†</sup></th>
|
| 387 |
<td style="background-color: rgba(127, 127, 127, 0.08);">0.732</td>
|
| 388 |
<td>0.317</td>
|
| 389 |
<td>0.581</td>
|
|
|
|
| 395 |
</tr>
|
| 396 |
<tr>
|
| 397 |
<th style="text-align: left; font-weight: normal;">CountBench</th>
|
| 398 |
+
<td style="background-color: rgba(127, 127, 127, 0.08);">0.725</td>
|
| 399 |
<td>0.737</td>
|
| 400 |
<td>0.910</td>
|
| 401 |
<td>0.645</td>
|
|
|
|
| 467 |
</tr>
|
| 468 |
</tbody>
|
| 469 |
</table>
|
| 470 |
+
<p><small><sup>†</sup> Averaged over RefCOCO_val, RefCOCO_testA, RefCOCO_testB, RefCOCO+_val, RefCOCO+_testA, RefCOCO+_testB, RefCOCOg_val, RefCOCOg_test.</small></p>
|
| 471 |
+
<p><small><sup>‡</sup> SmolVLM2.2B's GQA output was scored as 0.000 under VLMEvalKit's answer-extraction rules.</small></p>
|
| 472 |
|
| 473 |
|
| 474 |
|