Spaces:
Runtime error
Runtime error
Commit
Β·
db67f95
1
Parent(s):
51fc377
Delete dataset
Browse files- dataset/README_1_STAGE.md +0 -96
- dataset/README_2_STAGE.md +0 -19
- dataset/convert_cc_sbu.py +0 -20
- dataset/convert_laion.py +0 -20
- dataset/download_cc_sbu.sh +0 -6
- dataset/download_laion.sh +0 -6
dataset/README_1_STAGE.md
DELETED
|
@@ -1,96 +0,0 @@
|
|
| 1 |
-
## Download the filtered Conceptual Captions, SBU, LAION datasets
|
| 2 |
-
|
| 3 |
-
### Pre-training datasets download:
|
| 4 |
-
We use the filtered synthetic captions prepared by BLIP. For more details about the dataset, please refer to [BLIP](https://github.com/salesforce/BLIP).
|
| 5 |
-
|
| 6 |
-
It requires ~2.3T to store LAION and CC3M+CC12M+SBU datasets
|
| 7 |
-
|
| 8 |
-
Image source | Filtered synthetic caption by ViT-L
|
| 9 |
-
--- | :---:
|
| 10 |
-
CC3M+CC12M+SBU | <a href="https://storage.googleapis.com/sfr-vision-language-research/BLIP/datasets/ccs_synthetic_filtered_large.json">Download</a>
|
| 11 |
-
LAION115M | <a href="https://storage.googleapis.com/sfr-vision-language-research/BLIP/datasets/laion_synthetic_filtered_large.json">Download</a>
|
| 12 |
-
|
| 13 |
-
This will download two json files
|
| 14 |
-
```
|
| 15 |
-
ccs_synthetic_filtered_large.json
|
| 16 |
-
laion_synthetic_filtered_large.json
|
| 17 |
-
```
|
| 18 |
-
|
| 19 |
-
## prepare the data step-by-step
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
### setup the dataset folder and move the annotation file to the data storage folder
|
| 23 |
-
```
|
| 24 |
-
export MINIGPT4_DATASET=/YOUR/PATH/FOR/LARGE/DATASET/
|
| 25 |
-
mkdir ${MINIGPT4_DATASET}/cc_sbu
|
| 26 |
-
mkdir ${MINIGPT4_DATASET}/laion
|
| 27 |
-
mv ccs_synthetic_filtered_large.json ${MINIGPT4_DATASET}/cc_sbu
|
| 28 |
-
mv laion_synthetic_filtered_large.json ${MINIGPT4_DATASET}/laion
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
### Convert the scripts to data storate folder
|
| 32 |
-
```
|
| 33 |
-
cp convert_cc_sbu.py ${MINIGPT4_DATASET}/cc_sbu
|
| 34 |
-
cp download_cc_sbu.sh ${MINIGPT4_DATASET}/cc_sbu
|
| 35 |
-
cp convert_laion.py ${MINIGPT4_DATASET}/laion
|
| 36 |
-
cp download_laion.sh ${MINIGPT4_DATASET}/laion
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
### Convert the laion and cc_sbu annotation file format to be img2dataset format
|
| 41 |
-
```
|
| 42 |
-
cd ${MINIGPT4_DATASET}/cc_sbu
|
| 43 |
-
python convert_cc_sbu.py
|
| 44 |
-
|
| 45 |
-
cd ${MINIGPT4_DATASET}/laion
|
| 46 |
-
python convert_laion.py
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
### Download the datasets with img2dataset
|
| 50 |
-
```
|
| 51 |
-
cd ${MINIGPT4_DATASET}/cc_sbu
|
| 52 |
-
sh download_cc_sbu.sh
|
| 53 |
-
cd ${MINIGPT4_DATASET}/laion
|
| 54 |
-
sh download_laion.sh
|
| 55 |
-
```
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
The final dataset structure
|
| 59 |
-
|
| 60 |
-
```
|
| 61 |
-
.
|
| 62 |
-
βββ ${MINIGPT4_DATASET}
|
| 63 |
-
β βββ cc_sbu
|
| 64 |
-
β βββ convert_cc_sbu.py
|
| 65 |
-
β βββ download_cc_sbu.sh
|
| 66 |
-
β βββ ccs_synthetic_filtered_large.json
|
| 67 |
-
β βββ ccs_synthetic_filtered_large.tsv
|
| 68 |
-
β βββ cc_sbu_dataset
|
| 69 |
-
β βββ 00000.tar
|
| 70 |
-
β βββ 00000.parquet
|
| 71 |
-
β ...
|
| 72 |
-
β βββ laion
|
| 73 |
-
β βββ convert_laion.py
|
| 74 |
-
β βββ download_laion.sh
|
| 75 |
-
β βββ laion_synthetic_filtered_large.json
|
| 76 |
-
β βββ laion_synthetic_filtered_large.tsv
|
| 77 |
-
β βββ laion_dataset
|
| 78 |
-
β βββ 00000.tar
|
| 79 |
-
β βββ 00000.parquet
|
| 80 |
-
β ...
|
| 81 |
-
...
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
## Set up the dataset configuration files
|
| 86 |
-
|
| 87 |
-
Then, set up the LAION dataset loading path in
|
| 88 |
-
[here](../minigpt4/configs/datasets/laion/defaults.yaml#L5) at Line 5 as
|
| 89 |
-
${MINIGPT4_DATASET}/laion/laion_dataset/{00000..10488}.tar
|
| 90 |
-
|
| 91 |
-
and the Conceptual Captoin and SBU datasets loading path in
|
| 92 |
-
[here](../minigpt4/configs/datasets/cc_sbu/defaults.yaml#L5) at Line 5 as
|
| 93 |
-
${MINIGPT4_DATASET}/cc_sbu/cc_sbu_dataset/{00000..01255}.tar
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset/README_2_STAGE.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
## Second Stage Data Preparation
|
| 2 |
-
|
| 3 |
-
Our second stage dataset can be downloaded from
|
| 4 |
-
[here](https://drive.google.com/file/d/1nJXhoEcy3KTExr17I7BXqY5Y9Lx_-n-9/view?usp=share_link)
|
| 5 |
-
After extraction, you will get a data follder with the following structure:
|
| 6 |
-
|
| 7 |
-
```
|
| 8 |
-
cc_sbu_align
|
| 9 |
-
βββ filter_cap.json
|
| 10 |
-
βββ image
|
| 11 |
-
βββ 2.jpg
|
| 12 |
-
βββ 3.jpg
|
| 13 |
-
...
|
| 14 |
-
```
|
| 15 |
-
|
| 16 |
-
Put the folder to any path you want.
|
| 17 |
-
Then, set up the dataset path in the dataset config file
|
| 18 |
-
[here](../minigpt4/configs/datasets/cc_sbu/align.yaml#L5) at Line 5.
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset/convert_cc_sbu.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import csv
|
| 3 |
-
|
| 4 |
-
# specify input and output file paths
|
| 5 |
-
input_file = 'ccs_synthetic_filtered_large.json'
|
| 6 |
-
output_file = 'ccs_synthetic_filtered_large.tsv'
|
| 7 |
-
|
| 8 |
-
# load JSON data from input file
|
| 9 |
-
with open(input_file, 'r') as f:
|
| 10 |
-
data = json.load(f)
|
| 11 |
-
|
| 12 |
-
# extract header and data from JSON
|
| 13 |
-
header = data[0].keys()
|
| 14 |
-
rows = [x.values() for x in data]
|
| 15 |
-
|
| 16 |
-
# write data to TSV file
|
| 17 |
-
with open(output_file, 'w') as f:
|
| 18 |
-
writer = csv.writer(f, delimiter='\t')
|
| 19 |
-
writer.writerow(header)
|
| 20 |
-
writer.writerows(rows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset/convert_laion.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import csv
|
| 3 |
-
|
| 4 |
-
# specify input and output file paths
|
| 5 |
-
input_file = 'laion_synthetic_filtered_large.json'
|
| 6 |
-
output_file = 'laion_synthetic_filtered_large.tsv'
|
| 7 |
-
|
| 8 |
-
# load JSON data from input file
|
| 9 |
-
with open(input_file, 'r') as f:
|
| 10 |
-
data = json.load(f)
|
| 11 |
-
|
| 12 |
-
# extract header and data from JSON
|
| 13 |
-
header = data[0].keys()
|
| 14 |
-
rows = [x.values() for x in data]
|
| 15 |
-
|
| 16 |
-
# write data to TSV file
|
| 17 |
-
with open(output_file, 'w') as f:
|
| 18 |
-
writer = csv.writer(f, delimiter='\t')
|
| 19 |
-
writer.writerow(header)
|
| 20 |
-
writer.writerows(rows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset/download_cc_sbu.sh
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
img2dataset --url_list ccs_synthetic_filtered_large.tsv --input_format "tsv"\
|
| 4 |
-
--url_col "url" --caption_col "caption" --output_format webdataset\
|
| 5 |
-
--output_folder cc_sbu_dataset --processes_count 16 --thread_count 128 --image_size 224 \
|
| 6 |
-
--enable_wandb True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset/download_laion.sh
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
|
| 3 |
-
img2dataset --url_list laion_synthetic_filtered_large.tsv --input_format "tsv"\
|
| 4 |
-
--url_col "url" --caption_col "caption" --output_format webdataset\
|
| 5 |
-
--output_folder laion_dataset --processes_count 16 --thread_count 128 --image_size 224 \
|
| 6 |
-
--enable_wandb True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|