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)# 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=40) 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
| { | |
| "transformers_version": "5.15.0.dev0", | |
| "architectures": [ | |
| "CohereCompassForConditionalGeneration" | |
| ], | |
| "output_hidden_states": false, | |
| "return_dict": true, | |
| "dtype": "bfloat16", | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "problem_type": null, | |
| "text_config": { | |
| "architectures": null, | |
| "output_hidden_states": false, | |
| "return_dict": true, | |
| "dtype": "bfloat16", | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "problem_type": null, | |
| "vocab_size": 262144, | |
| "hidden_size": 2048, | |
| "intermediate_size": 6144, | |
| "logit_scale": 0.25, | |
| "num_hidden_layers": 28, | |
| "num_attention_heads": 16, | |
| "num_key_value_heads": 8, | |
| "hidden_act": "silu", | |
| "max_position_embeddings": 500000, | |
| "initializer_range": 0.02, | |
| "layer_norm_eps": 1e-05, | |
| "use_cache": true, | |
| "pad_token_id": 0, | |
| "bos_token_id": 2, | |
| "eos_token_id": 255001, | |
| "tie_word_embeddings": true, | |
| "rope_parameters": { | |
| "sliding_attention": { | |
| "mrope_interleaved": true, | |
| "mrope_section": [ | |
| 24, | |
| 20, | |
| 20 | |
| ], | |
| "rope_type": "default", | |
| "rope_theta": 50000 | |
| }, | |
| "full_attention": null, | |
| "rope_theta": 10000.0, | |
| "rope_type": "default" | |
| }, | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "sliding_window": 4096, | |
| "layer_types": [ | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "sliding_attention", | |
| "full_attention" | |
| ], | |
| "score_shift_a": null, | |
| "score_shift_b": null, | |
| "pooling": null, | |
| "head_dim": 128, | |
| "_name_or_path": "", | |
| "model_type": "cohere_compass_text", | |
| "output_attentions": false | |
| }, | |
| "vision_config": { | |
| "architectures": null, | |
| "output_hidden_states": false, | |
| "return_dict": true, | |
| "dtype": "bfloat16", | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "problem_type": null, | |
| "depth": 27, | |
| "hidden_size": 1152, | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "intermediate_size": 4304, | |
| "num_heads": 16, | |
| "in_channels": 3, | |
| "patch_size": 16, | |
| "spatial_merge_size": 2, | |
| "temporal_patch_size": 2, | |
| "out_hidden_size": 2048, | |
| "num_position_embeddings": 2304, | |
| "deepstack_visual_indexes": [ | |
| 8, | |
| 16, | |
| 24 | |
| ], | |
| "initializer_range": 0.02, | |
| "_name_or_path": "", | |
| "model_type": "cohere_compass_vision", | |
| "output_attentions": false | |
| }, | |
| "fusion_config": { | |
| "patch_embeddings": true | |
| }, | |
| "image_token_id": 255031, | |
| "video_token_id": 255032, | |
| "vision_start_token_id": 255028, | |
| "vision_end_token_id": 255029, | |
| "tie_word_embeddings": true, | |
| "_name_or_path": "", | |
| "eos_token_id": 255001, | |
| "pad_token_id": 0, | |
| "model_type": "cohere_compass", | |
| "output_attentions": false | |
| } |