Datasets:
Size:
10B<n<100B
License:
Bugfix
Browse files- bertic_data.py +18 -3
bertic_data.py
CHANGED
@@ -2,6 +2,7 @@ import datasets
|
|
2 |
import gzip
|
3 |
import json
|
4 |
|
|
|
5 |
_URL = "http://nl.ijs.si/nikola/dedup_hbs/"
|
6 |
_URLS = [
|
7 |
# "macocu.hbs.translit.dedup.lines.gz",
|
@@ -67,6 +68,7 @@ class BerticDataConfig(datasets.BuilderConfig):
|
|
67 |
class BerticData(datasets.GeneratorBasedBuilder):
|
68 |
"""Bertic dataset, used for training Bertic model."""
|
69 |
|
|
|
70 |
VERSION = datasets.Version("1.0.0")
|
71 |
|
72 |
# This is an example of a dataset with multiple configurations.
|
@@ -82,14 +84,17 @@ class BerticData(datasets.GeneratorBasedBuilder):
|
|
82 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
83 |
BUILDER_CONFIGS = [
|
84 |
BerticDataConfig(
|
|
|
|
|
85 |
name="default",
|
86 |
subsets=["arxiv", "open-web-math", "algebraic-stack"],
|
87 |
version=VERSION,
|
88 |
description="All subsets",
|
89 |
)
|
90 |
]
|
91 |
-
|
92 |
-
|
|
|
93 |
|
94 |
def _info(self):
|
95 |
features = datasets.Features(
|
@@ -104,24 +109,34 @@ class BerticData(datasets.GeneratorBasedBuilder):
|
|
104 |
citation=_CITATION,
|
105 |
)
|
106 |
|
|
|
|
|
|
|
107 |
def _split_generators(
|
108 |
self, dl_manager: datasets.DownloadManager
|
109 |
) -> List[datasets.SplitGenerator]:
|
110 |
urls_to_download = self._URLS
|
111 |
-
urls_to_download = {i: url for i, url in enumerate(
|
112 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
113 |
|
114 |
return [
|
115 |
datasets.SplitGenerator(
|
116 |
name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files[i]}
|
117 |
)
|
|
|
|
|
|
|
118 |
for i in urls_to_download.keys()
|
119 |
]
|
120 |
|
121 |
def _generate_examples(self, data_files):
|
122 |
key = 0
|
|
|
|
|
|
|
123 |
for name in data_files:
|
124 |
with gzip.open(name, "rb") as f:
|
125 |
for line in f.readlines():
|
126 |
yield key, {"text": line.decode("uft-8").strip()}
|
127 |
key += 1
|
|
|
|
2 |
import gzip
|
3 |
import json
|
4 |
|
5 |
+
|
6 |
_URL = "http://nl.ijs.si/nikola/dedup_hbs/"
|
7 |
_URLS = [
|
8 |
# "macocu.hbs.translit.dedup.lines.gz",
|
|
|
68 |
class BerticData(datasets.GeneratorBasedBuilder):
|
69 |
"""Bertic dataset, used for training Bertic model."""
|
70 |
|
71 |
+
|
72 |
VERSION = datasets.Version("1.0.0")
|
73 |
|
74 |
# This is an example of a dataset with multiple configurations.
|
|
|
84 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
85 |
BUILDER_CONFIGS = [
|
86 |
BerticDataConfig(
|
87 |
+
name="default",
|
88 |
+
subsets=["arxiv", "open-web-math", "algebraic-stack"],
|
89 |
name="default",
|
90 |
subsets=["arxiv", "open-web-math", "algebraic-stack"],
|
91 |
version=VERSION,
|
92 |
description="All subsets",
|
93 |
)
|
94 |
]
|
95 |
+
description="All subsets",
|
96 |
+
)
|
97 |
+
]
|
98 |
|
99 |
def _info(self):
|
100 |
features = datasets.Features(
|
|
|
109 |
citation=_CITATION,
|
110 |
)
|
111 |
|
112 |
+
def _split_generators(
|
113 |
+
self, dl_manager: datasets.DownloadManager
|
114 |
+
) -> List[datasets.SplitGenerator]:
|
115 |
def _split_generators(
|
116 |
self, dl_manager: datasets.DownloadManager
|
117 |
) -> List[datasets.SplitGenerator]:
|
118 |
urls_to_download = self._URLS
|
119 |
+
urls_to_download = {i: url for i, url in enumerate(_URLS)}
|
120 |
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
121 |
|
122 |
return [
|
123 |
datasets.SplitGenerator(
|
124 |
name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files[i]}
|
125 |
)
|
126 |
+
for i in urls_to_download.keys()
|
127 |
+
name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files[i]}
|
128 |
+
)
|
129 |
for i in urls_to_download.keys()
|
130 |
]
|
131 |
|
132 |
def _generate_examples(self, data_files):
|
133 |
key = 0
|
134 |
+
for name in data_files:
|
135 |
+
with gzip.open(name, "rb") as f:
|
136 |
+
key = 0
|
137 |
for name in data_files:
|
138 |
with gzip.open(name, "rb") as f:
|
139 |
for line in f.readlines():
|
140 |
yield key, {"text": line.decode("uft-8").strip()}
|
141 |
key += 1
|
142 |
+
|