Instructions to use aimagelab/CounterVid-InternVL3-9B-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aimagelab/CounterVid-InternVL3-9B-LoRA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="aimagelab/CounterVid-InternVL3-9B-LoRA", trust_remote_code=True) 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 AutoModel model = AutoModel.from_pretrained("aimagelab/CounterVid-InternVL3-9B-LoRA", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aimagelab/CounterVid-InternVL3-9B-LoRA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aimagelab/CounterVid-InternVL3-9B-LoRA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aimagelab/CounterVid-InternVL3-9B-LoRA", "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/aimagelab/CounterVid-InternVL3-9B-LoRA
- SGLang
How to use aimagelab/CounterVid-InternVL3-9B-LoRA 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 "aimagelab/CounterVid-InternVL3-9B-LoRA" \ --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": "aimagelab/CounterVid-InternVL3-9B-LoRA", "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 "aimagelab/CounterVid-InternVL3-9B-LoRA" \ --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": "aimagelab/CounterVid-InternVL3-9B-LoRA", "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 aimagelab/CounterVid-InternVL3-9B-LoRA with Docker Model Runner:
docker model run hf.co/aimagelab/CounterVid-InternVL3-9B-LoRA
CounterVid — InternVL3-9B
This repository contains the 9B CounterVid-aligned model from CounterVid: Counterfactual Video Generation for Mitigating Action and Temporal Hallucinations in Video-Language Models (EMNLP 2026).
CounterVid improves grounding in video-language models by combining textual and visual preferences generated from controlled counterfactual videos. The released weights are a standalone merge of the language-model LoRA, the trained multimodal projector, and the original InternVL3 base model.
Loading
import torch
from transformers import AutoModel, AutoTokenizer
model_id = "aimagelab/CounterVid-InternVL3-9B-LoRA"
model = AutoModel.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto", trust_remote_code=True,
).eval()
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True, use_fast=False)
For complete video inference and evaluation examples, see the CounterVid repository and project page.
Training summary
- Base model:
OpenGVLab/InternVL3-9B-Instruct - Training data: CounterVid (26,167 synthetic visual and textual preference pairs)
- Objective: MixDPO / PaMi-VDPO with CounterVid anchors
- LoRA was merged before release; PEFT is not required at inference time
- Vision encoder frozen during preference optimization
Intended use and limitations
This is a research model for video-language understanding, with a focus on action recognition and temporal reasoning. It inherits the capabilities, limitations, biases, and license conditions of its base model. It may still produce incorrect or unsupported answers and should not be used as the sole basis for high-stakes decisions.
Citation
@inproceedings{poppi2026countervid,
title = {{CounterVid}: Counterfactual Video Generation for Mitigating Action and Temporal Hallucinations in Video-Language Models},
author = {Poppi, Tobia and Uzkent, Burak and Garg, Amanmeet and Porto, Lucas and Kessler, Garin and Yang, Yezhou and Cornia, Marcella and Baraldi, Lorenzo and Cucchiara, Rita and Schiffers, Florian},
booktitle = {Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing},
year = {2026}
}
This work was conducted during Tobia Poppi's Applied Scientist internship with the Amazon Prime Video team in Seattle.
- Downloads last month
- -
Model tree for aimagelab/CounterVid-InternVL3-9B-LoRA
Base model
OpenGVLab/InternVL3-9B-Pretrained