Spaces:
Running on Zero
Running on Zero
yuhangzang commited on
Commit Β·
19f4b38
1
Parent(s): f42ad7c
Update descriptions and default caption
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: CapRL-Qwen3VL-4B
|
| 3 |
emoji: π¨
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
|
@@ -8,6 +8,7 @@ sdk_version: 5.49.1
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# CapRL-Qwen3VL-4B Image Captioning
|
|
|
|
| 1 |
---
|
| 2 |
+
title: CapRL-Qwen3VL-4B for Image Captioning
|
| 3 |
emoji: π¨
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
+
short_description: Generate captions for images with CapRL-Qwen3VL-4B
|
| 12 |
---
|
| 13 |
|
| 14 |
# CapRL-Qwen3VL-4B Image Captioning
|
app.py
CHANGED
|
@@ -10,77 +10,61 @@ MAX_NEW_TOKENS = 4096
|
|
| 10 |
|
| 11 |
# Default demo content
|
| 12 |
DEFAULT_IMAGE = "./examples/1909.png"
|
| 13 |
-
DEFAULT_CAPTION =
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
"13. **Lean Republican:**\n"
|
| 69 |
-
" - Very well: 36%\n"
|
| 70 |
-
" - Fairly well: 41%\n"
|
| 71 |
-
" - NET: 77\n\n"
|
| 72 |
-
"### Notes:\n"
|
| 73 |
-
"- The note at the bottom states that the data is based on Republicans and Republican-leaning independents.\n"
|
| 74 |
-
"- The source is a survey of U.S. adults conducted from February 4-15, 2020.\n\n"
|
| 75 |
-
"### Key Observations:\n"
|
| 76 |
-
"1. Older Republicans (65+) are the most likely to see Trump as someone who \"fights for what I believe in,\" with a net positive percentage of 94.\n"
|
| 77 |
-
"2. Younger age groups (18-29) have the lowest net positive percentage at 76.\n"
|
| 78 |
-
"3. Those with higher educational backgrounds (postgrad and college grad) have slightly lower net positive percentages compared to those with some college education (80 vs. 85).\n"
|
| 79 |
-
"4. Conservatives (63% very well) are the most likely to see Trump this way, followed by Republicans (61%).\n"
|
| 80 |
-
"5. Lean Republicans (36% very well) have the lowest percentage among the leaner categories.\n\n"
|
| 81 |
-
"This detailed description should provide a pure text model with sufficient information to answer any related questions about the image."
|
| 82 |
-
)
|
| 83 |
-
DEFAULT_CAPTION_TOKENS = 826
|
| 84 |
|
| 85 |
|
| 86 |
def get_device() -> str:
|
|
@@ -181,15 +165,31 @@ def generate_caption(image: Image.Image):
|
|
| 181 |
|
| 182 |
|
| 183 |
with gr.Blocks(title="CapRL-Qwen3VL-4B Image Captioning") as demo:
|
| 184 |
-
gr.Markdown("# CapRL-Qwen3VL-4B for Image Captioning")
|
| 185 |
-
gr.Markdown("### CapRL: Stimulating Dense Image Caption Capabilities via Reinforcement Learning")
|
| 186 |
-
gr.Markdown("Upload an image to generate a detailed caption with CapRL-Qwen3VL-4B!")
|
| 187 |
gr.Markdown(
|
| 188 |
"""
|
| 189 |
-
|
| 190 |
-
<a href="https://huggingface.co/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
|
| 192 |
-
|
| 193 |
"""
|
| 194 |
)
|
| 195 |
|
|
|
|
| 10 |
|
| 11 |
# Default demo content
|
| 12 |
DEFAULT_IMAGE = "./examples/1909.png"
|
| 13 |
+
DEFAULT_CAPTION = """Based on the provided bar chart from the Pew Research Center, here is a detailed description:
|
| 14 |
+
|
| 15 |
+
**Title:** Older Republicans especially likely to see Trump as fighting for their beliefs
|
| 16 |
+
**Subtitle:** Among Republicans and Republican leaners, % who say the phrase 'fights for what I believe in' describes Trump ...
|
| 17 |
+
|
| 18 |
+
**Source:** Survey of U.S. adults conducted Feb. 4-15, 2020.
|
| 19 |
+
|
| 20 |
+
**Legend:**
|
| 21 |
+
- **Very well:** 51% (All Rep/Lean Rep)
|
| 22 |
+
- **Fairly well:** 36% (All Rep/Lean Rep)
|
| 23 |
+
- **NET:** Sum of "Very well" and "Fairly well"
|
| 24 |
+
|
| 25 |
+
**Data Summary:**
|
| 26 |
+
|
| 27 |
+
**All Rep/Lean Rep:**
|
| 28 |
+
- Very well: 51%
|
| 29 |
+
- Fairly well: 36%
|
| 30 |
+
- NET: 87%
|
| 31 |
+
|
| 32 |
+
**By Age:**
|
| 33 |
+
- Ages 18-29: Very well 31%, Fairly well 45%, NET 76%
|
| 34 |
+
- 30-49: Very well 41%, Fairly well 42%, NET 82%
|
| 35 |
+
- 50-64: Very well 58%, Fairly well 33%, NET 92%
|
| 36 |
+
- 65+: Very well 68%, Fairly well 26%, NET 94%
|
| 37 |
+
|
| 38 |
+
**By Education:**
|
| 39 |
+
- Postgrad: Very well 42%, Fairly well 38%, NET 80%
|
| 40 |
+
- College grad: Very well 45%, Fairly well 40%, NET 85%
|
| 41 |
+
- Some college: Very well 51%, Fairly well 36%, NET 87%
|
| 42 |
+
- HS or less: Very well 56%, Fairly well 33%, NET 89%
|
| 43 |
+
|
| 44 |
+
**By Conservatism:**
|
| 45 |
+
- Conserv: Very well 63%, Fairly well 31%, NET 94%
|
| 46 |
+
- Mod/Lib: Very well 32%, Fairly well 44%, NET 75%
|
| 47 |
+
|
| 48 |
+
**By Party Identification:**
|
| 49 |
+
- Republican: Very well 61%, Fairly well 32%, NET 93%
|
| 50 |
+
- Lean Republican: Very well 36%, Fairly well 41%, NET 77%
|
| 51 |
+
|
| 52 |
+
**Analysis:**
|
| 53 |
+
|
| 54 |
+
- The overall percentage of Republicans and Republican leaners who say Trump "fights for what I believe in" is 87% (51% "very well" and 36% "fairly well").
|
| 55 |
+
- The group most likely to say this is those aged 65 and older (94% NET), followed by those 50-64 (92% NET) and those with a high school diploma or less (89% NET).
|
| 56 |
+
- The youngest group (18-29) is the least likely (76% NET).
|
| 57 |
+
- Among education levels, those with a high school diploma or less are most likely (89% NET), followed by some college (87%) and college graduates (85%).
|
| 58 |
+
- The most conservative group (Conservative) is the most likely to say this (94% NET), while the moderate/liberal group is the least likely (75% NET).
|
| 59 |
+
- Among party identifiers, Republicans are most likely (93% NET), while lean Republicans are less likely (77% NET).
|
| 60 |
+
- The 65+ age group is also the most conservative (94% NET) and the most likely to say Trump fights for their beliefs.
|
| 61 |
+
- The 65+ group is also the most likely to say it "very well" (68%) and the least likely to say it "fairly well" (26%).
|
| 62 |
+
- The most conservative group (63% "very well") is also the most likely overall (94% NET), while the most moderate/liberal group (32% "very well") is the least likely (75% NET).
|
| 63 |
+
- The Republican party has a 93% NET, while the lean Republican group has a 77% NET.
|
| 64 |
+
|
| 65 |
+
**Conclusion:**
|
| 66 |
+
The chart shows that older Republicans (65+) are the most likely to see Trump as fighting for their beliefs, with 94% saying it "very well" or "fairly well." This is followed by those aged 50-64 (92%) and those with a high school diploma or less (89%). The most conservative Republicans are also the most likely (94%), while moderate/liberal Republicans are the least likely (75%). The youngest group (18-29) is the least likely (76%)."""
|
| 67 |
+
DEFAULT_CAPTION_TOKENS = 993
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
def get_device() -> str:
|
|
|
|
| 165 |
|
| 166 |
|
| 167 |
with gr.Blocks(title="CapRL-Qwen3VL-4B Image Captioning") as demo:
|
|
|
|
|
|
|
|
|
|
| 168 |
gr.Markdown(
|
| 169 |
"""
|
| 170 |
+
# CapRL
|
| 171 |
+
π<a href="https://arxiv.org/abs/2509.22647">Paper</a> | π <a href="https://github.com/InternLM/CapRL">Github</a> | π€<a href="https://huggingface.co/collections/long-xing1/caprl-68d64ac32ded31596c36e189">CapRL Collection</a> | π€<a href="https://huggingface.co/papers/2509.22647">Daily Paper</a>
|
| 172 |
+
|
| 173 |
+
### CapRL Series Model & Dataset
|
| 174 |
+
| Series | Models & Resources |
|
| 175 |
+
| :--- | :--- |
|
| 176 |
+
| **CapRL 2.0 Series** | [π€ CapRL-Qwen3VL-2B](https://huggingface.co/internlm/CapRL-Qwen3VL-2B) \| [π€ CapRL-Qwen3VL-4B](https://huggingface.co/internlm/CapRL-Qwen3VL-4B) |
|
| 177 |
+
| **CapRL 1.0 Series** | [π€ CapRL-Qwen2.5VL-3B](https://huggingface.co/internlm/CapRL-3B) \| [π€ CapRL-InternVL3.5-8B](https://huggingface.co/yuhangzang/CapRL-InternVL3.5-8B) \| [π CapRL-2M Dataset](https://huggingface.co/datasets/internlm/CapRL-2M) \| [π¦ CapRL-3B-GGUF](https://huggingface.co/mradermacher/CapRL-3B-GGUF) \| [π¦ CapRL-3B-i1-GGUF](https://huggingface.co/mradermacher/CapRL-3B-i1-GGUF) |
|
| 178 |
+
|
| 179 |
+
### CapRL-Qwen3VL-4B
|
| 180 |
+
We are excited to release the **CapRL 2.0 series**: **CapRL-Qwen3VL-2B** and **CapRL-Qwen3VL-4B**. These models feature fewer parameters while delivering even more powerful captioning performance.
|
| 181 |
+
Notably, **CapRL-Qwen3VL-2B outperforms both CapRL-Qwen2.5VL-3B and Qwen2.5VL-72B in captioning tasks**.
|
| 182 |
+
This leap in efficiency is driven by our upgraded training recipe, which includes a more rigorous QA data filter and a significantly more diverse image dataset. We welcome everyone to try them out!
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
When selecting between the available CapRL models, it's essential to consider the trade-off between performance and computational cost.
|
| 186 |
+
This guide will help you choose the most suitable model for your specific needs:
|
| 187 |
+
|Model|Parameters|Strength|
|
| 188 |
+
|-|-|-|
|
| 189 |
+
|π€[CapRL-Qwen3VL-2B](https://huggingface.co/internlm/CapRL-Qwen3VL-2B)|2B|Speed, Efficiency|
|
| 190 |
+
|π€[CapRL-Qwen3VL-4B](https://huggingface.co/internlm/CapRL-Qwen3VL-4B)|4B|High Performance, Advanced Captioning Ability|
|
| 191 |
|
| 192 |
+
**This Space** is based on **CapRL-Qwen3VL-4B**. You can also try out **CapRL-Qwen2.5VL-3B** π¨ β‘οΈ [πCapRL-Qwen2.5VL-3B Space](https://huggingface.co/spaces/yuhangzang/caprl)
|
| 193 |
"""
|
| 194 |
)
|
| 195 |
|