BLIP3o-Recap / README.md
zli12321's picture
Rename recaption folder to qwen3-vl-8b-recaptions
bb2a6b4 verified
|
Raw History Blame Contribute Delete
7.51 kB
---
license: apache-2.0
task_categories:
- image-to-text
size_categories:
- 1M<n<10M
pretty_name: BLIP3o Recap 1M
configs:
- config_name: default
data_files:
- split: train
path: "*.tar"
---
# BLIP3o-Recap
1,000,000 image–caption pairs sampled from [BLIP3o/BLIP3o-Pretrain-Long-Caption](https://huggingface.co/datasets/BLIP3o/BLIP3o-Pretrain-Long-Caption) at revision `e4d07091a466d1a1e35a9b0c61caddc78d14a059`.
The source dataset has about 27.2 million images, each with a long caption (about 120 tokens) produced by Qwen2.5-VL-7B-Instruct. This repo is a fixed 1,000,000-pair subset of those existing pairs. The captions in the tars were not regenerated; two new captions per image are provided separately in `recaptions/` (see [Recaptions](#recaptions)).
## Sampling
Shards were taken at even intervals from each of the three webdataset groups, so the subset is spread across the corpus.
| Group | Shards kept | Pairs |
| --- | ---: | ---: |
| `sa_*.tar` | 36 | 402,626 |
| `webdataset_shard_*.tar` | 52 | 498,922 |
| `webdataset_JDB_*.tar` | 10 | 98,452 |
| **Total** | **98** | **1,000,000** |
`webdataset_JDB_270_part.tar` contains the first 8,469 pairs from source shard `webdataset_JDB_270.tar`. Every other shard is an unchanged copy of the source file. Per-shard counts are in `subset_manifest.json`.
## Format
Each shard is a WebDataset tar. An example is two files that share a key:
- `<key>.jpg`
- `<key>.txt` (the long caption)
## Load
```python
from datasets import load_dataset
ds = load_dataset(
"webdataset",
data_files="https://huggingface.co/datasets/IntelligenceLab/BLIP3o-Recap/resolve/main/*.tar",
split="train",
)
```
For local files:
```python
import glob
from datasets import load_dataset
ds = load_dataset("webdataset", data_files=glob.glob("/path/to/shards/*.tar"), split="train")
```
## Recaptions
`recaptions/<shard>.parquet` holds, for every image of `<shard>.tar` (same order, 1,000,000 rows in total), the original caption and two new captions written by [Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct). The images are not duplicated; join on `key`.
| Column | Content |
| --- | --- |
| `key` | example key in the tar (`<key>.jpg`) |
| `source_shard` | tar file name |
| `orig_caption` | the original `<key>.txt` caption |
| `recap_1`, `recap_2` | two new captions, one paragraph each |
```python
from datasets import load_dataset
recaps = load_dataset(
"parquet",
data_files="hf://datasets/IntelligenceLab/BLIP3o-Recap/recaptions/*.parquet",
split="train",
)
```
### Generation
- Model: `Qwen/Qwen2.5-VL-3B-Instruct`, vLLM 0.31.0, bf16, images capped at 640×28×28 pixels.
- Code: [`code/recaption.py`](code/recaption.py) (`run`, `fix`, `stats`, `export`) and [`code/launch.sh`](code/launch.sh) (one worker per GPU).
- Both captions are two samples (`n=2`) of the same prompt: temperature 0.8, top-p 0.9, at most 160 new tokens.
- Prompt (verbatim):
```text
System: You are an image captioner. Describe only what is visible.
User: Describe this image in ONE paragraph of 70–90 words.
Order: main subject(s) (count, category, color, size, pose/action) → spatial relations (left/right, front/behind, near/far) → background and setting → lighting, viewpoint, and medium (photo, illustration, 3D render, etc.).
Rules:
- Start directly with the main subject. Never begin with "The image", "This picture", "In this photo", or similar.
- State only what is clearly visible. No guesses ("likely", "possibly", "suggesting", "appears to be"), no mood words ("serene", "vibrant", "charming", "picturesque"), no interpretation of purpose or meaning.
- Quote visible text only if it is legible.
- No lists, no line breaks, no concluding summary sentence.
```
### Constraints and filtering
The 3B model ignores parts of the prompt (without intervention about 60% of captions start with "The image …" and about 80% contain a banned word), so the rules are also enforced while decoding and checked afterwards.
**Banned while decoding** (every casing and leading-space token form, through vLLM `bad_words` and `logit_bias`):
- words from the prompt: likely, possibly, appears, suggesting, serene, vibrant, charming, picturesque;
- their inflections and the substitutes the model switched to: appear(ed/ing), suggest(s/ed), seem(s/ed/ingly), indicat(e/es/ed/ing/ive), perhaps, probably, might, possible, potentially, presumably, apparently, supposedly, hint(s/ing), impl(ies/ying), impression;
- mood and interpretive words: tranquil, peaceful, idyllic, cozy, inviting, stunning, breathtaking, bustling, overall, atmosphere, ambiance, ambience, calm, lively, festive, scenic, striking, dramatic, majestic, grand, dynamic, typical, emphasiz(e/es/ed/ing), enjoy(s/ing), welcoming, relax(ed/ing), pleasant, playful, harmonious, elegant, whimsical, energetic, cheerful, celebratory, celebrating, intimate, aesthetic, iconic, mood, moody;
- phrases: "creating a", "sense of", "giving a / it / the scene / the image", "adding a", "natural beauty", "looks like", "what looks", "could be", "may be";
- openers: "The / This / These" + image, picture, photo, photograph, scene, illustration, snapshot; "In this", "In the image / picture / photo"; and "The", "This", "These" as the first word.
**Rejected and resampled** (up to 3 times): an opener or banned word outside quotes (quoted visible text is kept verbatim), a line break or list, fewer than 60 words, or Chinese / Japanese / Korean characters outside quotes (the model sometimes drifts into Chinese mid-sentence). A caption cut off at 160 tokens keeps its complete sentences. There is no upper word limit.
The banned list grew in three rounds while inspecting outputs; after the main run, every caption that violated the final rules (110,176 of 2,000,000) was regenerated with the final rules. No other caption was changed.
### Statistics
| | |
| --- | ---: |
| captions that still violate a rule | 0.02% (439 images) |
| words per caption (p5 / median / p95) | 63 / 81 / 108 |
| recap_1 vs recap_2, same image: bigram Jaccard / ROUGE-L | 0.157 / 0.394 |
| recap_1 vs recap_2, different images: bigram Jaccard / ROUGE-L | 0.041 / 0.231 |
| recap_1 vs original caption: bigram Jaccard / ROUGE-L | 0.091 / 0.289 |
The two captions of an image share the prompt's fixed sentence order but differ in wording and detail; on average 57% of the content words of `recap_2` do not occur in `recap_1`.
### Known limitations
These are small-model captions. A manual check of 16 captions found the main subject, colors, setting, medium and legible text correct in all of them, but about a third had one wrong secondary detail: left/right or front/back orientation, an object count, or an invented small object. The two captions of an image rarely make the same error. Some interpretive phrasing that is not on the banned lists remains.
## Qwen3-VL-8B recaptions
`qwen3-vl-8b-recaptions/<shard>.parquet` holds one new caption for each of the first 500,000 images (subset `index` 0–499,999). The captions were written by [Qwen/Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct). See `qwen3-vl-8b-recaptions/README.md` for columns and the generation setup. Join on `key`.
```python
from datasets import load_dataset
qwen3 = load_dataset(
"parquet",
data_files="hf://datasets/IntelligenceLab/BLIP3o-Recap/qwen3-vl-8b-recaptions/*.parquet",
split="train",
)
```
## License
Apache-2.0, same as the source dataset.