Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,114 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pretty_name: Libra-81K-SFT
|
| 4 |
+
task_categories:
|
| 5 |
+
- question-answering
|
| 6 |
+
- image-to-text
|
| 7 |
+
tags:
|
| 8 |
+
- gui
|
| 9 |
+
- vlm
|
| 10 |
+
- sft
|
| 11 |
+
- webdataset
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# Libra-81K-SFT
|
| 17 |
+
|
| 18 |
+
This dataset contains:
|
| 19 |
+
- `data/images/`: split image archives (`*.tar.gz.part-*`)
|
| 20 |
+
- `data/annotations/`: JSON annotation files
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Download Dataset
|
| 26 |
+
|
| 27 |
+
### 1) Install Git LFS
|
| 28 |
+
```bash
|
| 29 |
+
git lfs install
|
| 30 |
+
````
|
| 31 |
+
|
| 32 |
+
### 2) Clone the dataset repo
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
git clone https://huggingface.co/datasets/Ray2333/Libra-81K-SFT
|
| 36 |
+
cd Libra-81K-SFT
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## Reconstruct and extract image archives
|
| 42 |
+
|
| 43 |
+
### Folder structure
|
| 44 |
+
|
| 45 |
+
After cloning, you should see:
|
| 46 |
+
|
| 47 |
+
* `data/images/` containing `*.tar.gz.part-*`
|
| 48 |
+
* `data/annotations/` containing `*.json`
|
| 49 |
+
|
| 50 |
+
### 1) Merge split parts into `.tar.gz`
|
| 51 |
+
|
| 52 |
+
This will create merged archives under `data/images_archives/`.
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
cd data/images
|
| 56 |
+
mkdir -p ../images_archives ../images_extracted
|
| 57 |
+
|
| 58 |
+
for base in $(ls *.tar.gz.part-* | sed -E 's/\.part-[0-9]+$//' | sort -u); do
|
| 59 |
+
echo "[MERGE] $base.part-* -> ../images_archives/$base"
|
| 60 |
+
cat "${base}".part-* > "../images_archives/${base}"
|
| 61 |
+
done
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### 2) Extract each merged archive
|
| 65 |
+
|
| 66 |
+
This will extract each archive into a separate directory under `data/images_extracted/`.
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
cd ../images_archives
|
| 70 |
+
for tgz in *.tar.gz; do
|
| 71 |
+
name="${tgz%.tar.gz}"
|
| 72 |
+
mkdir -p "../images_extracted/${name}"
|
| 73 |
+
echo "[EXTRACT] $tgz -> ../images_extracted/${name}"
|
| 74 |
+
tar -xzf "$tgz" -C "../images_extracted/${name}"
|
| 75 |
+
done
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
After extraction, images will be available under:
|
| 79 |
+
|
| 80 |
+
* `data/images_extracted/<archive_name>/...`
|
| 81 |
+
|
| 82 |
+
---
|
| 83 |
+
|
| 84 |
+
## Load annotations in Python
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
import json
|
| 88 |
+
from pathlib import Path
|
| 89 |
+
|
| 90 |
+
ann_dir = Path("data/annotations")
|
| 91 |
+
all_json = {}
|
| 92 |
+
|
| 93 |
+
for p in sorted(ann_dir.glob("*.json")):
|
| 94 |
+
with open(p, "r", encoding="utf-8") as f:
|
| 95 |
+
all_json[p.name] = json.load(f)
|
| 96 |
+
|
| 97 |
+
print("Loaded json files:", len(all_json))
|
| 98 |
+
print("Example keys:", list(all_json.keys())[:5])
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## Notes
|
| 104 |
+
|
| 105 |
+
* Each `*.tar.gz.part-*` group must be merged **in order** before extraction.
|
| 106 |
+
* If you only need one subset (e.g., `gui-odyssey`), you can merge/extract only that prefix:
|
| 107 |
+
|
| 108 |
+
```bash
|
| 109 |
+
cd data/images
|
| 110 |
+
cat gui-odyssey.tar.gz.part-* > ../images_archives/gui-odyssey.tar.gz
|
| 111 |
+
tar -xzf ../images_archives/gui-odyssey.tar.gz -C ../images_extracted/gui-odyssey
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
|