animelover
commited on
Commit
·
569f522
1
Parent(s):
68e50d2
Update touhou-images.py
Browse files- touhou-images.py +3 -12
touhou-images.py
CHANGED
@@ -1,13 +1,8 @@
|
|
1 |
import os
|
2 |
import datasets
|
3 |
-
from huggingface_hub import HfApi
|
4 |
from datasets import DownloadManager, DatasetInfo
|
5 |
-
from datasets.data_files import DataFilesDict
|
6 |
|
7 |
_EXTENSION = [".png", ".jpg", ".jpeg"]
|
8 |
-
_NAME = "animelover/touhou-images"
|
9 |
-
_REVISION = "main"
|
10 |
-
|
11 |
|
12 |
class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
13 |
BUILDER_CONFIGS = [
|
@@ -47,14 +42,10 @@ class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
|
47 |
)
|
48 |
|
49 |
def _split_generators(self, dl_manager: DownloadManager):
|
50 |
-
|
51 |
-
|
52 |
-
{datasets.Split.TRAIN: ["**"]},
|
53 |
-
dataset_info=hfh_dataset_info,
|
54 |
-
allowed_extensions=["zip"],
|
55 |
-
)
|
56 |
gs = []
|
57 |
-
for split, files in data_files.items():
|
58 |
downloaded_files = dl_manager.download_and_extract(files)
|
59 |
gs.append(datasets.SplitGenerator(name=split, gen_kwargs={"filepath": downloaded_files}))
|
60 |
return gs
|
|
|
1 |
import os
|
2 |
import datasets
|
|
|
3 |
from datasets import DownloadManager, DatasetInfo
|
|
|
4 |
|
5 |
_EXTENSION = [".png", ".jpg", ".jpeg"]
|
|
|
|
|
|
|
6 |
|
7 |
class DanbooruDataset(datasets.GeneratorBasedBuilder):
|
8 |
BUILDER_CONFIGS = [
|
|
|
42 |
)
|
43 |
|
44 |
def _split_generators(self, dl_manager: DownloadManager):
|
45 |
+
if not self.config.data_files:
|
46 |
+
raise ValueError(f"At least one data file must be specified, but got data_files={self.config.data_files}")
|
|
|
|
|
|
|
|
|
47 |
gs = []
|
48 |
+
for split, files in self.config.data_files.items():
|
49 |
downloaded_files = dl_manager.download_and_extract(files)
|
50 |
gs.append(datasets.SplitGenerator(name=split, gen_kwargs={"filepath": downloaded_files}))
|
51 |
return gs
|