Image-Text-to-Text
Transformers
Safetensors
GGUF
English
qwen3_5
text-generation-inference
object-detection
localization
grounding
visual-grounding-anything
vllm
opencv-python
vlm
llama.cpp
conversational
Instructions to use prithivMLmods/Polaris-VGA-4B-Post1.0e with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="prithivMLmods/Polaris-VGA-4B-Post1.0e") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("prithivMLmods/Polaris-VGA-4B-Post1.0e") model = AutoModelForImageTextToText.from_pretrained("prithivMLmods/Polaris-VGA-4B-Post1.0e") 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]:])) - llama-cpp-python
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="prithivMLmods/Polaris-VGA-4B-Post1.0e", filename="GGUF/Polaris-VGA-4B-Post1.0e.BF16.gguf", )
llm.create_chat_completion( 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" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16 # Run inference directly in the terminal: llama-cli -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16 # Run inference directly in the terminal: llama-cli -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16 # Run inference directly in the terminal: ./llama-cli -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Use Docker
docker model run hf.co/prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
- LM Studio
- Jan
- vLLM
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Polaris-VGA-4B-Post1.0e" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Polaris-VGA-4B-Post1.0e", "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/prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
- SGLang
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e 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 "prithivMLmods/Polaris-VGA-4B-Post1.0e" \ --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": "prithivMLmods/Polaris-VGA-4B-Post1.0e", "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 "prithivMLmods/Polaris-VGA-4B-Post1.0e" \ --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": "prithivMLmods/Polaris-VGA-4B-Post1.0e", "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" } } ] } ] }' - Ollama
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Ollama:
ollama run hf.co/prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
- Unsloth Studio
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for prithivMLmods/Polaris-VGA-4B-Post1.0e to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for prithivMLmods/Polaris-VGA-4B-Post1.0e to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for prithivMLmods/Polaris-VGA-4B-Post1.0e to start chatting
- Pi
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Run Hermes
hermes
- Docker Model Runner
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Docker Model Runner:
docker model run hf.co/prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
- Lemonade
How to use prithivMLmods/Polaris-VGA-4B-Post1.0e with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull prithivMLmods/Polaris-VGA-4B-Post1.0e:BF16
Run and chat with the model
lemonade run user.Polaris-VGA-4B-Post1.0e-BF16
List all available models
lemonade list
update
Browse files- chat_template.jinja +20 -6
chat_template.jinja
CHANGED
|
@@ -1,5 +1,10 @@
|
|
| 1 |
{%- set image_count = namespace(value=0) %}
|
| 2 |
{%- set video_count = namespace(value=0) %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
{%- if content is string %}
|
| 5 |
{{- content }}
|
|
@@ -39,12 +44,15 @@
|
|
| 39 |
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
{%- endif %}
|
| 41 |
{%- endmacro %}
|
|
|
|
| 42 |
{%- if not messages %}
|
| 43 |
{{- raise_exception('No messages provided.') }}
|
| 44 |
{%- endif %}
|
|
|
|
| 45 |
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
{{- '<|im_start|>system\n' }}
|
| 47 |
-
{{-
|
|
|
|
| 48 |
{%- for tool in tools %}
|
| 49 |
{{- "\n" }}
|
| 50 |
{{- tool | tojson }}
|
|
@@ -60,10 +68,13 @@
|
|
| 60 |
{{- '<|im_end|>\n' }}
|
| 61 |
{%- else %}
|
| 62 |
{%- if messages[0].role == 'system' %}
|
| 63 |
-
{%- set
|
| 64 |
-
{{- '<|im_start|>system\n' +
|
|
|
|
|
|
|
| 65 |
{%- endif %}
|
| 66 |
{%- endif %}
|
|
|
|
| 67 |
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
{%- for message in messages[::-1] %}
|
| 69 |
{%- set index = (messages|length - 1) - loop.index0 %}
|
|
@@ -75,9 +86,11 @@
|
|
| 75 |
{%- endif %}
|
| 76 |
{%- endif %}
|
| 77 |
{%- endfor %}
|
|
|
|
| 78 |
{%- if ns.multi_step_tool %}
|
| 79 |
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
{%- endif %}
|
|
|
|
| 81 |
{%- for message in messages %}
|
| 82 |
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
{%- if message.role == "system" %}
|
|
@@ -144,11 +157,12 @@
|
|
| 144 |
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
{%- endif %}
|
| 146 |
{%- endfor %}
|
|
|
|
| 147 |
{%- if add_generation_prompt %}
|
| 148 |
{{- '<|im_start|>assistant\n' }}
|
| 149 |
-
{%- if enable_thinking is defined and enable_thinking is
|
| 150 |
-
{{- '<think>\n\n</think>\n\n' }}
|
| 151 |
-
{%- else %}
|
| 152 |
{{- '<think>\n' }}
|
|
|
|
|
|
|
| 153 |
{%- endif %}
|
| 154 |
{%- endif %}
|
|
|
|
| 1 |
{%- set image_count = namespace(value=0) %}
|
| 2 |
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
|
| 4 |
+
{%- set detection_system_prompt %}
|
| 5 |
+
You are a helpful assistant to detect objects in images. When asked to detect elements based on a description you return bounding boxes for all elements in the form of [xmin, ymin, xmax, ymax] with the values being scaled between 0 and 1000. When there are more than one result, answer with a list of bounding boxes in the form of [[xmin, ymin, xmax, ymax], [xmin, ymin, xmax, ymax], ...].
|
| 6 |
+
{%- endset %}
|
| 7 |
+
|
| 8 |
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 9 |
{%- if content is string %}
|
| 10 |
{{- content }}
|
|
|
|
| 44 |
{{- raise_exception('Unexpected content type.') }}
|
| 45 |
{%- endif %}
|
| 46 |
{%- endmacro %}
|
| 47 |
+
|
| 48 |
{%- if not messages %}
|
| 49 |
{{- raise_exception('No messages provided.') }}
|
| 50 |
{%- endif %}
|
| 51 |
+
|
| 52 |
{%- if tools and tools is iterable and tools is not mapping %}
|
| 53 |
{{- '<|im_start|>system\n' }}
|
| 54 |
+
{{- detection_system_prompt }}
|
| 55 |
+
{{- "\n\n# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 56 |
{%- for tool in tools %}
|
| 57 |
{{- "\n" }}
|
| 58 |
{{- tool | tojson }}
|
|
|
|
| 68 |
{{- '<|im_end|>\n' }}
|
| 69 |
{%- else %}
|
| 70 |
{%- if messages[0].role == 'system' %}
|
| 71 |
+
{%- set user_system = render_content(messages[0].content, false, true)|trim %}
|
| 72 |
+
{{- '<|im_start|>system\n' + detection_system_prompt + '\n\n' + user_system + '<|im_end|>\n' }}
|
| 73 |
+
{%- else %}
|
| 74 |
+
{{- '<|im_start|>system\n' + detection_system_prompt + '<|im_end|>\n' }}
|
| 75 |
{%- endif %}
|
| 76 |
{%- endif %}
|
| 77 |
+
|
| 78 |
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 79 |
{%- for message in messages[::-1] %}
|
| 80 |
{%- set index = (messages|length - 1) - loop.index0 %}
|
|
|
|
| 86 |
{%- endif %}
|
| 87 |
{%- endif %}
|
| 88 |
{%- endfor %}
|
| 89 |
+
|
| 90 |
{%- if ns.multi_step_tool %}
|
| 91 |
{{- raise_exception('No user query found in messages.') }}
|
| 92 |
{%- endif %}
|
| 93 |
+
|
| 94 |
{%- for message in messages %}
|
| 95 |
{%- set content = render_content(message.content, true)|trim %}
|
| 96 |
{%- if message.role == "system" %}
|
|
|
|
| 157 |
{{- raise_exception('Unexpected message role.') }}
|
| 158 |
{%- endif %}
|
| 159 |
{%- endfor %}
|
| 160 |
+
|
| 161 |
{%- if add_generation_prompt %}
|
| 162 |
{{- '<|im_start|>assistant\n' }}
|
| 163 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
|
|
|
|
|
|
| 164 |
{{- '<think>\n' }}
|
| 165 |
+
{%- else %}
|
| 166 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 167 |
{%- endif %}
|
| 168 |
{%- endif %}
|