Instructions to use Arijit-09/RoadXpert_AI-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Arijit-09/RoadXpert_AI-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Arijit-09/RoadXpert_AI-v1") 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("Arijit-09/RoadXpert_AI-v1") model = AutoModelForMultimodalLM.from_pretrained("Arijit-09/RoadXpert_AI-v1") 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 Arijit-09/RoadXpert_AI-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Arijit-09/RoadXpert_AI-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Arijit-09/RoadXpert_AI-v1", "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/Arijit-09/RoadXpert_AI-v1
- SGLang
How to use Arijit-09/RoadXpert_AI-v1 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 "Arijit-09/RoadXpert_AI-v1" \ --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": "Arijit-09/RoadXpert_AI-v1", "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 "Arijit-09/RoadXpert_AI-v1" \ --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": "Arijit-09/RoadXpert_AI-v1", "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 Arijit-09/RoadXpert_AI-v1 with Docker Model Runner:
docker model run hf.co/Arijit-09/RoadXpert_AI-v1
| {{- bos_token }} | |
| {%- if not tools is defined %} | |
| {%- set tools = none %} | |
| {%- endif %} | |
| {%- if not enable_thinking is defined %} | |
| {%- set enable_thinking = false %} | |
| {%- endif %} | |
| {#- This block extracts the system message, so we can slot it into the right place. #} | |
| {%- if messages[0]['role'] == 'system' %} | |
| {%- if messages[0]['content'] is string %} | |
| {%- set system_message = messages[0]['content']|trim %} | |
| {%- else %} | |
| {%- set system_message = messages[0]['content'][0]['text']|trim %} | |
| {%- endif %} | |
| {%- set messages = messages[1:] %} | |
| {%- else %} | |
| {%- set system_message = "" %} | |
| {%- endif %} | |
| {#- Set the system message. If enable_thinking is true, add the "Enable deep thinking subroutine." #} | |
| {%- if enable_thinking %} | |
| {%- if system_message != "" %} | |
| {%- set system_message = "Enable deep thinking subroutine. | |
| " ~ system_message %} | |
| {%- else %} | |
| {%- set system_message = "Enable deep thinking subroutine." %} | |
| {%- endif %} | |
| {%- endif %} | |
| {#- System message + tools #} | |
| {%- if tools is not none or system_message != '' %} | |
| {{- "<|header_start|>system<|header_end|> | |
| " }} | |
| {{- system_message }} | |
| {%- if tools is not none %} | |
| {%- if system_message != "" %} | |
| {{- " | |
| " }} | |
| {%- endif %} | |
| {{- "Available Tools: | |
| " }} | |
| {%- for t in tools %} | |
| {{- t | tojson(indent=4) }} | |
| {{- " | |
| " }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- "<|eot|>" }} | |
| {%- endif %} | |
| {#- Rest of the messages #} | |
| {%- for message in messages %} | |
| {#- Case 1 - Usual, non tool related message. #} | |
| {%- if not (message.role == "ipython" or message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %} | |
| {{- '<|header_start|>' + message['role'] + '<|header_end|> | |
| ' }} | |
| {%- if message['content'] is string %} | |
| {{- message['content'] }} | |
| {%- else %} | |
| {%- for content in message['content'] %} | |
| {%- if content['type'] == 'image' %} | |
| {{- '<|image|>' }} | |
| {%- elif content['type'] == 'text' %} | |
| {{- content['text'] }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- "<|eot|>" }} | |
| {#- Case 2 - the response is from the assistant, but has a tool call returned. #} | |
| {%- elif message.tool_calls is defined and message.tool_calls is not none %} | |
| {{- "<|header_start|>assistant<|header_end|> | |
| " }} | |
| {%- if message['content'] is string %} | |
| {{- message['content'] }} | |
| {%- if message['content'] | trim != "" %} | |
| {{- " | |
| " }} | |
| {%- endif %} | |
| {%- else %} | |
| {%- for content in message['content'] %} | |
| {%- if content['type'] == 'image' %} | |
| {{- '<|image|>' }} | |
| {%- elif content['type'] == 'text' %} | |
| {{- content['text'] }} | |
| {%- if content['text'] | trim != "" %} | |
| {{- " | |
| " }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- "[" }} | |
| {%- for tool_call in message.tool_calls %} | |
| {%- if tool_call.function is defined %} | |
| {%- set out = tool_call.function|tojson %} | |
| {%- if not tool_call.id is defined %} | |
| {{- out }} | |
| {%- else %} | |
| {{- out[:-1] }} | |
| {{- ', "id": "' + tool_call.id + '"}' }} | |
| {%- endif %} | |
| {%- else %} | |
| {{- tool_call|tojson }} | |
| {%- endif %} | |
| {%- if not loop.last %} | |
| {{- ", " }} | |
| {%- else %} | |
| {{- "]<|eot|>" }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {#- Case 3 - the response is from a tool call. #} | |
| {%- elif message.role == "ipython" or message["role"] == "tool_results" or message["role"] == "tool" %} | |
| {{- "<|header_start|>ipython<|header_end|> | |
| " }} | |
| {%- if message.tool_call_id is defined and message.tool_call_id != '' %} | |
| {{- '{"content": ' }} | |
| {%- if message.content is mapping or (message.content is iterable and not message.content is string) %} | |
| {{- message.content | tojson }} | |
| {%- else %} | |
| {{- '"' ~ message.content ~ '"' }} | |
| {%- endif %} | |
| {{- ', "call_id": "' ~ message.tool_call_id ~ '"}' }} | |
| {%- else %} | |
| {%- if message.content is mapping or (message.content is iterable and not message.content is string) %} | |
| {{- message.content | tojson }} | |
| {%- else %} | |
| {{- message.content }} | |
| {%- endif %} | |
| {%- endif %} | |
| {{- "<|eot|>" }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- if add_generation_prompt %} | |
| {{- '<|header_start|>assistant<|header_end|>\n\n' }} | |
| {%- if enable_thinking %} | |
| {{- '<think>\n' }} | |
| {%- endif %} | |
| {%- endif %} |