Image-Text-to-Text
Transformers
Safetensors
qwen3_vl
qwen3-vl
viss
streaming-video
visual-question-answering
causal-video
conversational
Instructions to use mis2/ViSS-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mis2/ViSS-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="mis2/ViSS-8B") 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("mis2/ViSS-8B") model = AutoModelForMultimodalLM.from_pretrained("mis2/ViSS-8B", 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 mis2/ViSS-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mis2/ViSS-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mis2/ViSS-8B", "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/mis2/ViSS-8B
- SGLang
How to use mis2/ViSS-8B 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 "mis2/ViSS-8B" \ --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": "mis2/ViSS-8B", "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 "mis2/ViSS-8B" \ --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": "mis2/ViSS-8B", "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 mis2/ViSS-8B with Docker Model Runner:
docker model run hf.co/mis2/ViSS-8B
Download code/data_pipeline/temporal_scope/semantic_mcq.py from mis2/ViSS-8B: direct link, hf CLI and curl.
- Browser
- Download file 3.46 kB
-
https://huggingface.co/mis2/ViSS-8B/resolve/main/code/data_pipeline/temporal_scope/semantic_mcq.py
- Command line
-
hf download hf://mis2/ViSS-8B/code/data_pipeline/temporal_scope/semantic_mcq.py
-
curl -L -o semantic_mcq.py https://huggingface.co/mis2/ViSS-8B/resolve/main/code/data_pipeline/temporal_scope/semantic_mcq.py
3.46 kB
| """Shared pure-VLM prompt and deterministic MCQ utilities.""" | |
| from __future__ import annotations | |
| import hashlib | |
| import re | |
| from collections.abc import Sequence | |
| DIRECT_PROMPT_PREFIX = ( | |
| "You are an advanced video question-answering AI assistant. You have been " | |
| "provided with causal frames from the video and a multiple-choice question. " | |
| "Analyze only the visible frames and provide the best answer." | |
| ) | |
| DIRECT_PROMPT_SUFFIX = "Only give the best option's letter (A, B, C, or D) directly." | |
| OPTION_LETTERS = "ABCD" | |
| DIRECT_PROMPT_RE = re.compile( | |
| r"(?:^|\n)Question:\s*(?P<question>.*?)\n+\s*Options:\s*\n" | |
| r"(?P<options>.*?)\n+\s*Only give the best option's letter", | |
| re.DOTALL, | |
| ) | |
| OPTION_LINE_RE = re.compile(r"^\s*([A-D])[.):]\s*(.+?)\s*$") | |
| class SemanticMCQError(ValueError): | |
| """Raised when a deterministic semantic MCQ cannot be constructed.""" | |
| def parse_direct_prompt(value: str) -> tuple[str, list[str]]: | |
| """Recover one canonical public question and its four visible options.""" | |
| match = DIRECT_PROMPT_RE.search(str(value)) | |
| if match is None: | |
| raise SemanticMCQError("canonical direct prompt is malformed") | |
| question = " ".join(match.group("question").split()) | |
| parsed: dict[str, str] = {} | |
| for line in match.group("options").splitlines(): | |
| option = OPTION_LINE_RE.fullmatch(line) | |
| if option is None: | |
| if line.strip(): | |
| raise SemanticMCQError("canonical option line is malformed") | |
| continue | |
| letter, text = option.groups() | |
| if letter in parsed: | |
| raise SemanticMCQError("canonical option letter is duplicated") | |
| parsed[letter] = " ".join(text.split()) | |
| if not question or list(parsed) != list(OPTION_LETTERS): | |
| raise SemanticMCQError("canonical prompt lacks one question and A--D options") | |
| options = [parsed[letter] for letter in OPTION_LETTERS] | |
| if any(not option for option in options) or len(set(options)) != len(options): | |
| raise SemanticMCQError("canonical prompt options are empty or duplicated") | |
| return question, options | |
| def rebalance_answer_slot( | |
| options: Sequence[str], | |
| *, | |
| answer: str, | |
| answer_slot: int, | |
| seed: str, | |
| ) -> tuple[list[str], str]: | |
| """Move the target to a fixed slot and hash-order the three distractors.""" | |
| if ( | |
| len(options) != len(OPTION_LETTERS) | |
| or answer not in OPTION_LETTERS | |
| or answer_slot not in range(len(OPTION_LETTERS)) | |
| or len(set(options)) != len(OPTION_LETTERS) | |
| ): | |
| raise SemanticMCQError("invalid four-option answer-space contract") | |
| target_index = OPTION_LETTERS.index(answer) | |
| target = str(options[target_index]) | |
| distractors = [ | |
| (index, str(option)) | |
| for index, option in enumerate(options) | |
| if index != target_index | |
| ] | |
| distractors.sort( | |
| key=lambda item: hashlib.sha256( | |
| f"{seed}|{item[0]}|{item[1]}".encode("utf-8") | |
| ).digest() | |
| ) | |
| balanced: list[str | None] = [None] * len(OPTION_LETTERS) | |
| balanced[answer_slot] = target | |
| remaining = [index for index, value in enumerate(balanced) if value is None] | |
| for slot, (_, option) in zip(remaining, distractors, strict=True): | |
| balanced[slot] = option | |
| if any(value is None for value in balanced): | |
| raise SemanticMCQError("balanced options are incomplete") | |
| return [str(value) for value in balanced], OPTION_LETTERS[answer_slot] | |