Instructions to use internlm/CapRL-Eval-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/CapRL-Eval-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="internlm/CapRL-Eval-3B") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("internlm/CapRL-Eval-3B") model = AutoModelForImageTextToText.from_pretrained("internlm/CapRL-Eval-3B") 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
- vLLM
How to use internlm/CapRL-Eval-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/CapRL-Eval-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/CapRL-Eval-3B", "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/internlm/CapRL-Eval-3B
- SGLang
How to use internlm/CapRL-Eval-3B 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 "internlm/CapRL-Eval-3B" \ --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": "internlm/CapRL-Eval-3B", "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 "internlm/CapRL-Eval-3B" \ --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": "internlm/CapRL-Eval-3B", "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 internlm/CapRL-Eval-3B with Docker Model Runner:
docker model run hf.co/internlm/CapRL-Eval-3B
Improve model card: Add pipeline tag, library name, code link, and update image paths
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
**CapRL-Eval-3B** is the model used for answering questions based on captions, and it is a finetuned version of Qwen2.5-VL-3B. When dealing with tasks such as ChartQA (not multiple-choice questions), it provides more stable output formatting.
|
|
@@ -25,10 +30,10 @@ By employing CapRL training framework, initializing with the Qwen2.5-VL-3B model
|
|
| 25 |
filtered 75K QA dataset as the training set, we obtained a highly capable captioner, CapRL-3B.
|
| 26 |
|
| 27 |
<p align="center">
|
| 28 |
-
<img src="./assets/teaser.png" alt="Main Results on GPT2" width="750"/>
|
| 29 |
</p>
|
| 30 |
<p align="center">
|
| 31 |
-
<img src="./assets/performance.png" alt="Main Results on GPT2" width="750"/>
|
| 32 |
</p>
|
| 33 |
|
| 34 |
## Key Features
|
|
@@ -105,16 +110,16 @@ print("Chat response:", chat_response)
|
|
| 105 |
|
| 106 |
## Cases
|
| 107 |
<p align="center">
|
| 108 |
-
<img src="./assets/comparison.png" alt="Main Results on GPT2" width="750"/>
|
| 109 |
</p>
|
| 110 |
|
| 111 |
<p align="center">
|
| 112 |
-
<img src="./assets/info_caprl.png" alt="Main Results on GPT2" width="750"/>
|
| 113 |
</p>
|
| 114 |
|
| 115 |
<p align="center">
|
| 116 |
-
<img src="./assets/info_caprl2.png" alt="Main Results on GPT2" width="750"/>
|
| 117 |
</p>
|
| 118 |
<p align="center">
|
| 119 |
-
<img src="./assets/natural_caprl.png" alt="Main Results on GPT2" width="750"/>
|
| 120 |
-
</p>
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
library_name: transformers
|
| 5 |
---
|
| 6 |
+
|
| 7 |
+
# CapRL: Stimulating Dense Image Caption Capabilities via Reinforcement Learning
|
| 8 |
+
|
| 9 |
+
π<a href="https://huggingface.co/papers/2509.22647">Paper</a> | π»<a href="https://github.com/InternLM/CapRL">Code</a> | π€<a href="https://huggingface.co/internlm/CapRL-3B">CapRL-3B Model</a> |
|
| 10 |
+
π€<a href="https://huggingface.co/datasets/internlm/CapRL-2M">CapRL-2M Dataset</a> |π€<a href="https://huggingface.co/collections/long-xing1/caprl-68d64ac32ded31596c36e189">CapRL Collection</a>
|
| 11 |
|
| 12 |
|
| 13 |
**CapRL-Eval-3B** is the model used for answering questions based on captions, and it is a finetuned version of Qwen2.5-VL-3B. When dealing with tasks such as ChartQA (not multiple-choice questions), it provides more stable output formatting.
|
|
|
|
| 30 |
filtered 75K QA dataset as the training set, we obtained a highly capable captioner, CapRL-3B.
|
| 31 |
|
| 32 |
<p align="center">
|
| 33 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/teaser.png" alt="Main Results on GPT2" width="750"/>
|
| 34 |
</p>
|
| 35 |
<p align="center">
|
| 36 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/performance.png" alt="Main Results on GPT2" width="750"/>
|
| 37 |
</p>
|
| 38 |
|
| 39 |
## Key Features
|
|
|
|
| 110 |
|
| 111 |
## Cases
|
| 112 |
<p align="center">
|
| 113 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/comparison.png" alt="Main Results on GPT2" width="750"/>
|
| 114 |
</p>
|
| 115 |
|
| 116 |
<p align="center">
|
| 117 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/info_caprl.png" alt="Main Results on GPT2" width="750"/>
|
| 118 |
</p>
|
| 119 |
|
| 120 |
<p align="center">
|
| 121 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/info_caprl2.png" alt="Main Results on GPT2" width="750"/>
|
| 122 |
</p>
|
| 123 |
<p align="center">
|
| 124 |
+
<img src="https://huggingface.co/internlm/CapRL-Eval-3B/resolve/main/assets/natural_caprl.png" alt="Main Results on GPT2" width="750"/>
|
| 125 |
+
</p>
|