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
Update inference environment documentation
Browse files- README.md +4 -2
- requirement.txt +12 -0
- requirements.txt +0 -5
README.md
CHANGED
|
@@ -33,8 +33,10 @@ The released weights are a merged Hugging Face checkpoint based on [Qwen3-VL-8B-
|
|
| 33 |
|
| 34 |
## Installation
|
| 35 |
|
|
|
|
|
|
|
| 36 |
```bash
|
| 37 |
-
pip install -r
|
| 38 |
```
|
| 39 |
|
| 40 |
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.
|
|
@@ -45,7 +47,7 @@ The benchmark environment used `torch==2.9.0`, `transformers==4.57.6`, `accelera
|
|
| 45 |
|
| 46 |
```bash
|
| 47 |
python inference.py \
|
| 48 |
-
--model
|
| 49 |
--video /path/to/video.mp4 \
|
| 50 |
--images /path/to/ref_1.jpg /path/to/ref_2.jpg /path/to/ref_3.png
|
| 51 |
```
|
|
|
|
| 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:
|
| 37 |
+
|
| 38 |
```bash
|
| 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.
|
|
|
|
| 47 |
|
| 48 |
```bash
|
| 49 |
python inference.py \
|
| 50 |
+
--model TengfeiLiuCoder/RefCaptioner \
|
| 51 |
--video /path/to/video.mp4 \
|
| 52 |
--images /path/to/ref_1.jpg /path/to/ref_2.jpg /path/to/ref_3.png
|
| 53 |
```
|
requirement.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tested model inference environment for RefCaptioner (Python 3.10).
|
| 2 |
+
torch==2.9.0
|
| 3 |
+
torchvision==0.24.0
|
| 4 |
+
transformers==4.57.6
|
| 5 |
+
accelerate==1.14.0
|
| 6 |
+
qwen-vl-utils==0.0.14
|
| 7 |
+
av==17.1.0
|
| 8 |
+
pillow==12.2.0
|
| 9 |
+
numpy==2.2.6
|
| 10 |
+
peft==0.19.1
|
| 11 |
+
safetensors==0.8.0
|
| 12 |
+
einops==0.8.2
|
requirements.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
torch>=2.4
|
| 2 |
-
transformers>=4.57.0,<5
|
| 3 |
-
accelerate>=1.0
|
| 4 |
-
qwen-vl-utils>=0.0.14
|
| 5 |
-
av>=14
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|