Image-Text-to-Text
Transformers
Safetensors
English
qwen3_vl
video
multi-image
video-captioning
reference-grounding
qwen3-vl
grpo
conversational
Instructions to use TengfeiLiuCoder/RefCaptioner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TengfeiLiuCoder/RefCaptioner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TengfeiLiuCoder/RefCaptioner") 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("TengfeiLiuCoder/RefCaptioner") model = AutoModelForMultimodalLM.from_pretrained("TengfeiLiuCoder/RefCaptioner", 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 TengfeiLiuCoder/RefCaptioner with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TengfeiLiuCoder/RefCaptioner" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TengfeiLiuCoder/RefCaptioner", "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/TengfeiLiuCoder/RefCaptioner
- SGLang
How to use TengfeiLiuCoder/RefCaptioner 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 "TengfeiLiuCoder/RefCaptioner" \ --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": "TengfeiLiuCoder/RefCaptioner", "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 "TengfeiLiuCoder/RefCaptioner" \ --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": "TengfeiLiuCoder/RefCaptioner", "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 TengfeiLiuCoder/RefCaptioner with Docker Model Runner:
docker model run hf.co/TengfeiLiuCoder/RefCaptioner
Add task and method overview figures
Browse files- .gitattributes +2 -0
- README.md +11 -2
- framework.png +3 -0
- teaser.png +3 -0
.gitattributes
CHANGED
|
@@ -6,3 +6,5 @@
|
|
| 6 |
*.gguf filter=lfs diff=lfs merge=lfs -text
|
| 7 |
captioncase_01.png filter=lfs diff=lfs merge=lfs -text
|
| 8 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 6 |
*.gguf filter=lfs diff=lfs merge=lfs -text
|
| 7 |
captioncase_01.png filter=lfs diff=lfs merge=lfs -text
|
| 8 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
teaser.png filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
framework.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -20,6 +20,12 @@ RefCaptioner is an 8B vision-language model for **multi-reference image-grounded
|
|
| 20 |
|
| 21 |
The released weights are a merged Hugging Face checkpoint based on [Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct). No PEFT adapter is required at inference time.
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
## Model details
|
| 24 |
|
| 25 |
| Item | Value |
|
|
@@ -31,6 +37,11 @@ The released weights are a merged Hugging Face checkpoint based on [Qwen3-VL-8B-
|
|
| 31 |
| Thinking mode | Disabled |
|
| 32 |
| Weight format | Merged `safetensors` |
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
## Installation
|
| 35 |
|
| 36 |
The tested environment for loading RefCaptioner and running inference is provided in `requirement.txt`. Use Python 3.10 and install it with:
|
|
@@ -39,9 +50,7 @@ The tested environment for loading RefCaptioner and running inference is provide
|
|
| 39 |
pip install -r requirement.txt
|
| 40 |
```
|
| 41 |
|
| 42 |
-
RefCaptioner uses the standard Qwen3-VL inference stack and does not require a task-specific runtime. Any environment that can run Qwen3-VL with a compatible Transformers release can be used directly.
|
| 43 |
|
| 44 |
-
The benchmark environment used `torch==2.9.0`, `transformers==4.57.6`, `accelerate==1.14.0`, `qwen-vl-utils==0.0.14`, and `av==17.1.0`.
|
| 45 |
|
| 46 |
## Quick start
|
| 47 |
|
|
|
|
| 20 |
|
| 21 |
The released weights are a merged Hugging Face checkpoint based on [Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct). No PEFT adapter is required at inference time.
|
| 22 |
|
| 23 |
+
## Task overview
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+
RefCaptioner grounds relevant reference images to local phrases in a video caption while rejecting distractor references.
|
| 28 |
+
|
| 29 |
## Model details
|
| 30 |
|
| 31 |
| Item | Value |
|
|
|
|
| 37 |
| Thinking mode | Disabled |
|
| 38 |
| Weight format | Merged `safetensors` |
|
| 39 |
|
| 40 |
+
## Method overview
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Training Framework
|
| 44 |
+
|
| 45 |
## Installation
|
| 46 |
|
| 47 |
The tested environment for loading RefCaptioner and running inference is provided in `requirement.txt`. Use Python 3.10 and install it with:
|
|
|
|
| 50 |
pip install -r requirement.txt
|
| 51 |
```
|
| 52 |
|
|
|
|
| 53 |
|
|
|
|
| 54 |
|
| 55 |
## Quick start
|
| 56 |
|
framework.png
ADDED
|
Git LFS Details
|
teaser.png
ADDED
|
Git LFS Details
|