Image-Text-to-Text
Transformers
Safetensors
qwen3_5
vllm
video
multimodal
reinforcement-learning
temporal-grounding
object-tracking
video-segmentation
visual-question-answering
spatial-reasoning
qwen3.5
conversational
Instructions to use OraRL/Video-ORA-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OraRL/Video-ORA-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OraRL/Video-ORA-9B") 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("OraRL/Video-ORA-9B") model = AutoModelForMultimodalLM.from_pretrained("OraRL/Video-ORA-9B", 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 OraRL/Video-ORA-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OraRL/Video-ORA-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OraRL/Video-ORA-9B", "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/OraRL/Video-ORA-9B
- SGLang
How to use OraRL/Video-ORA-9B 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 "OraRL/Video-ORA-9B" \ --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": "OraRL/Video-ORA-9B", "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 "OraRL/Video-ORA-9B" \ --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": "OraRL/Video-ORA-9B", "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 OraRL/Video-ORA-9B with Docker Model Runner:
docker model run hf.co/OraRL/Video-ORA-9B
| """Built-in single-box spatial-grounding reward.""" | |
| from __future__ import annotations | |
| import json | |
| import re | |
| from collections.abc import Mapping | |
| from typing import Any | |
| from ..types import RewardContractError | |
| from ._common import ( | |
| answer_payload, | |
| box_iou, | |
| canonical_json, | |
| exact_answer_payload, | |
| final_response_text, | |
| normalize_box, | |
| parse_json, | |
| unfence, | |
| ) | |
| REWARD_NAME = "spatial_grounding" | |
| REWARD_TYPE = "batch" | |
| CANONICAL_RESPONSE_FORMAT = "qwen_json" | |
| ACCEPT_TAGGED_RESPONSE = True | |
| _NUMBER = r"[-+]?(?:\d+(?:\.\d+)?|\.\d+)" | |
| _POINT_BOX_RE = re.compile( | |
| rf"\(\s*({_NUMBER})\s*,\s*({_NUMBER})\s*\)" | |
| rf"\s*,?\s*\(\s*({_NUMBER})\s*,\s*({_NUMBER})\s*\)" | |
| ) | |
| _JSON_FENCE_RE = re.compile( | |
| r"\A\s*```json\s*(.*?)\s*```\s*\Z", | |
| flags=re.DOTALL | re.IGNORECASE, | |
| ) | |
| def _box(value: Any) -> list[float] | None: | |
| payload = parse_json(value) | |
| box = normalize_box(payload) | |
| if box is not None: | |
| return box | |
| text = answer_payload(value) | |
| match = _POINT_BOX_RE.search(text) | |
| if match is not None: | |
| return [float(number) for number in match.groups()] | |
| numbers = re.findall(_NUMBER, text) | |
| if len(numbers) >= 4: | |
| return [float(number) for number in numbers[-4:]] | |
| return None | |
| def _native_box(value: Any) -> list[float] | None: | |
| match = _JSON_FENCE_RE.fullmatch(str(value or "")) | |
| if match is None: | |
| return None | |
| try: | |
| payload = json.loads(match.group(1)) | |
| except (TypeError, ValueError): | |
| return None | |
| if not ( | |
| isinstance(payload, list) | |
| and len(payload) == 1 | |
| and isinstance(payload[0], Mapping) | |
| and "bbox_2d" in payload[0] | |
| ): | |
| return None | |
| return normalize_box(payload[0]["bbox_2d"]) | |
| def _prediction( | |
| response: Any, | |
| *, | |
| accept_tagged_response: bool, | |
| ) -> tuple[list[float] | None, float]: | |
| final_text = final_response_text(response) | |
| native = _native_box(final_text) | |
| if native is not None: | |
| return native, 1.0 | |
| tagged = exact_answer_payload(response) | |
| if accept_tagged_response and tagged is not None: | |
| tagged_box = _box(tagged) | |
| if tagged_box is not None: | |
| return tagged_box, 1.0 | |
| return _box(unfence(final_text)), 0.0 | |
| def compute_score( | |
| batch: list[dict[str, Any]], | |
| **kwargs: Any, | |
| ) -> list[dict[str, float]]: | |
| accept_tagged = bool(kwargs.get("accept_tagged_response", ACCEPT_TAGGED_RESPONSE)) | |
| results: list[dict[str, float]] = [] | |
| for item in batch: | |
| prediction, format_score = _prediction( | |
| item.get("response"), | |
| accept_tagged_response=accept_tagged, | |
| ) | |
| target = _box( | |
| item.get("ground_truth") if item.get("ground_truth") is not None else item.get("answer") | |
| ) | |
| iou = box_iou(prediction, target) | |
| results.append( | |
| { | |
| "overall": float(iou * format_score), | |
| "iou": float(iou), | |
| "format": float(format_score), | |
| } | |
| ) | |
| return results | |
| def build_oracle_response_from_ground_truth( | |
| ground_truth: Any, | |
| extra: Any = None, | |
| ) -> str: | |
| del extra | |
| box = _box(ground_truth) | |
| if box is None: | |
| raise RewardContractError("Spatial-grounding ground truth must contain one bounding box.") | |
| payload = [{"bbox_2d": box, "label": ""}] | |
| return f"```json\n{canonical_json(payload)}\n```" | |