Create chunk-t1.py
Browse files- chunk-t1.py +45 -0
chunk-t1.py
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
|
3 |
+
_TAR_FILES=[
|
4 |
+
"part0.tar.gz",
|
5 |
+
"part1.tar.gz",
|
6 |
+
"part2.tar.gz",
|
7 |
+
"part3.tar.gz",
|
8 |
+
"part4.tar.gz",
|
9 |
+
"part5.tar.gz",
|
10 |
+
"part6.tar.gz",
|
11 |
+
]
|
12 |
+
|
13 |
+
class Food101(datasets.GeneratorBasedBuilder):
|
14 |
+
"""Food-101 Images dataset."""
|
15 |
+
|
16 |
+
def _info(self):
|
17 |
+
return datasets.DatasetInfo(
|
18 |
+
description="TMP description",
|
19 |
+
homepage="google it",
|
20 |
+
citation="lmao"
|
21 |
+
license="dunno, tbh, assume the worst, k thx."
|
22 |
+
)
|
23 |
+
|
24 |
+
def _split_generators(self, dl_manager):
|
25 |
+
archive_path = dl_manager.download(_TAR_FILES[0])
|
26 |
+
return [
|
27 |
+
datasets.SplitGenerator(
|
28 |
+
name=datasets.Split.TRAIN,
|
29 |
+
gen_kwargs={
|
30 |
+
"images": dl_manager.iter_archive(archive_path),
|
31 |
+
},
|
32 |
+
),
|
33 |
+
]
|
34 |
+
|
35 |
+
def _generate_examples(self, images):
|
36 |
+
"""Generate images and labels for splits."""
|
37 |
+
for file_path, file_obj in images:
|
38 |
+
yield file_path, {
|
39 |
+
"image": {"path": file_path, "bytes": file_obj.read()},
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
#https://huggingface.co/datasets/oscar-corpus/OSCAR-2201/blob/main/OSCAR-2201.py
|
45 |
+
#https://huggingface.co/datasets/food101
|