bastienp commited on
Commit
41f1c8a
1 Parent(s): e8c8ada

feat: text config

Browse files
data/{train.zip → text/train.zip} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:61378ec4eed5bf3c71a91dcfb464a34ab6b74028f80e1e5a6e042f6e91dd0295
3
  size 1586223
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6624dd926f957843f14e56443308b2904c95707ccf2eed16849381f2f819635
3
  size 1586223
data/{valid.zip → text/valid.zip} RENAMED
File without changes
visible-watermark-pita.py CHANGED
@@ -11,46 +11,41 @@ _DESCRIPTION = """\
11
 
12
  _VERSION = datasets.Version("1.0.0")
13
 
14
- _REPO = "data"
15
- _URLS = {"train": f"{_REPO}/train.zip", "valid": f"{_REPO}/valid.zip"}
16
 
17
- _CATEGORIES = ["text"]
 
18
 
19
-
20
- # class WatermarkPitaConfig(datasets.BuilderConfig):
21
- # """Builder Config for Food-101"""
22
-
23
- # def __init__(self, repository, urls, categories, **kwargs):
24
- # """BuilderConfig for Food-101.
25
 
26
- # Args:
27
- # repository: `string`, the name of the repository.
28
- # urls: `dict<string, string>`, the urls to the data.
29
- # categories: `list<string>`, the categories of the data.
30
 
31
- # **kwargs: keyword arguments forwarded to super.
32
- # """
33
- # VERSION = datasets.Version("1.0.0")
34
 
35
- # super(WatermarkPitaConfig, self).__init__(version=VERSION, **kwargs)
36
- # self.repository = repository
37
- # self.urls = categories
38
- # self.categories = categories
39
 
40
 
41
  class WatermarkPita(datasets.GeneratorBasedBuilder):
42
  """Watermark Dataset"""
43
 
44
- # BUILDER_CONFIGS = [
45
- # WatermarkPitaConfig(
46
- # name="text",
47
- # repository=_REPO,
48
- # urls=_URLS,
49
- # categories=_CATEGORIES,
50
- # )
51
- # ]
52
 
53
- # _DEFAULT_CONFIG_NAME = "text"
54
 
55
  def _info(self):
56
  return datasets.DatasetInfo(
@@ -59,7 +54,7 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
59
  "image": datasets.Image(),
60
  "objects": datasets.Sequence(
61
  {
62
- "label": datasets.ClassLabel(names=_CATEGORIES),
63
  "bbox": datasets.Sequence(
64
  datasets.Value("int32"), length=4
65
  ),
@@ -71,7 +66,7 @@ class WatermarkPita(datasets.GeneratorBasedBuilder):
71
  )
72
 
73
  def _split_generators(self, dl_manager):
74
- data_dir = dl_manager.download_and_extract(_URLS)
75
 
76
  return [
77
  datasets.SplitGenerator(
 
11
 
12
  _VERSION = datasets.Version("1.0.0")
13
 
 
 
14
 
15
+ class WatermarkPitaConfig(datasets.BuilderConfig):
16
+ """Builder Config for Food-101"""
17
 
18
+ def __init__(self, repository, urls, categories, **kwargs):
19
+ """BuilderConfig for Food-101.
 
 
 
 
20
 
21
+ Args:
22
+ repository: `string`, the name of the repository.
23
+ urls: `dict<string, string>`, the urls to the data.
24
+ categories: `list<string>`, the categories of the data.
25
 
26
+ **kwargs: keyword arguments forwarded to super.
27
+ """
28
+ _VERSION = datasets.Version("1.0.0")
29
 
30
+ super(WatermarkPitaConfig, self).__init__(version=_VERSION, **kwargs)
31
+ self.repository = repository
32
+ self.urls = categories
33
+ self.categories = categories
34
 
35
 
36
  class WatermarkPita(datasets.GeneratorBasedBuilder):
37
  """Watermark Dataset"""
38
 
39
+ BUILDER_CONFIGS = [
40
+ WatermarkPitaConfig(
41
+ name="text",
42
+ repository="data",
43
+ urls={"train": "data/train.zip", "valid": "data/valid.zip"},
44
+ categories=["text"],
45
+ )
46
+ ]
47
 
48
+ _DEFAULT_CONFIG_NAME = "text"
49
 
50
  def _info(self):
51
  return datasets.DatasetInfo(
 
54
  "image": datasets.Image(),
55
  "objects": datasets.Sequence(
56
  {
57
+ "label": datasets.ClassLabel(names=self.config.categories),
58
  "bbox": datasets.Sequence(
59
  datasets.Value("int32"), length=4
60
  ),
 
66
  )
67
 
68
  def _split_generators(self, dl_manager):
69
+ data_dir = dl_manager.download_and_extract(self.config.urls)
70
 
71
  return [
72
  datasets.SplitGenerator(