Datasets:
Update tutorials/metadata.md
Browse filesGive specific examples of how to download things
- tutorials/metadata.md +20 -0
tutorials/metadata.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1 |
# Working with the Metadata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
The metadata files are in parquet format, and contain the following attributes:
|
3 |
- `id`: A unique identifier for the image.
|
4 |
- `url`: The URL of the image.
|
@@ -24,3 +33,14 @@ Once you have opened a maetadata file with pandas, you can get the URLs of the i
|
|
24 |
urls = df['url']
|
25 |
```
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Working with the Metadata
|
2 |
+
|
3 |
+
## Downloading all the metadata files at once
|
4 |
+
|
5 |
+
Install the huggingface-cli utility (via pip). You may then use the following command:
|
6 |
+
|
7 |
+
huggingface-cli download Spawning/PD12M --repo-type dataset --local-dir metadata --include "metadata/*"
|
8 |
+
|
9 |
+
## metadata format
|
10 |
+
|
11 |
The metadata files are in parquet format, and contain the following attributes:
|
12 |
- `id`: A unique identifier for the image.
|
13 |
- `url`: The URL of the image.
|
|
|
33 |
urls = df['url']
|
34 |
```
|
35 |
|
36 |
+
### Download all files mentioned in metadata
|
37 |
+
|
38 |
+
If you want to just grab all files referenced by a metadata collection, you may try this (adjust to taste):
|
39 |
+
|
40 |
+
img2dataset --url_list $file --input_format "parquet" \
|
41 |
+
--url_col "url" --caption_col "caption" --output_format files \
|
42 |
+
--output_folder $dir --processes_count 16 --thread_count 64 \
|
43 |
+
--skip_reencode true --min_image_sizel 654 --max_aspect_ratio=1.77
|
44 |
+
|
45 |
+
|
46 |
+
|