Initial version
Browse files- .gitattributes +4 -0
- README.md +18 -0
- rulm.py +95 -0
- test.jsonl.zst +3 -0
- train/00.jsonl.zst +3 -0
- train/01.jsonl.zst +3 -0
- train/02.jsonl.zst +3 -0
- train/03.jsonl.zst +3 -0
- train/04.jsonl.zst +3 -0
- train/05.jsonl.zst +3 -0
- train/06.jsonl.zst +3 -0
- train/07.jsonl.zst +3 -0
- train/08.jsonl.zst +3 -0
- train/09.jsonl.zst +3 -0
- validation.jsonl.zst +3 -0
.gitattributes
CHANGED
@@ -52,3 +52,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
55 |
+
train.jsonl.zst filter=lfs diff=lfs merge=lfs -text
|
56 |
+
validation.jsonl.zst filter=lfs diff=lfs merge=lfs -text
|
57 |
+
test.jsonl.zst filter=lfs diff=lfs merge=lfs -text
|
58 |
+
train/ filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
dataset_info:
|
3 |
+
features:
|
4 |
+
- name: text
|
5 |
+
dtype: string
|
6 |
+
splits:
|
7 |
+
- name: train
|
8 |
+
num_bytes: 44765634773
|
9 |
+
num_examples: 11558373
|
10 |
+
- name: test
|
11 |
+
num_bytes: 225645511
|
12 |
+
num_examples: 58638
|
13 |
+
- name: validation
|
14 |
+
num_bytes: 227568446
|
15 |
+
num_examples: 58013
|
16 |
+
download_size: 14178680811
|
17 |
+
dataset_size: 45218848730
|
18 |
+
---
|
rulm.py
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 The HuggingFace Datasets Authors and Ilya Gusev
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
|
16 |
+
# Lint as: python3
|
17 |
+
"""RuLM: a dataset for Russian language modeling"""
|
18 |
+
|
19 |
+
|
20 |
+
import os
|
21 |
+
import io
|
22 |
+
import zstandard
|
23 |
+
import jsonlines
|
24 |
+
|
25 |
+
import datasets
|
26 |
+
|
27 |
+
try:
|
28 |
+
import simdjson as json
|
29 |
+
except ImportError:
|
30 |
+
print('Installing simdjson library')
|
31 |
+
os.system('pip install -q pysimdjson')
|
32 |
+
import simdjson as json
|
33 |
+
|
34 |
+
parser = json.Parser()
|
35 |
+
|
36 |
+
def json_parser(x):
|
37 |
+
try:
|
38 |
+
line = parser.parse(x).as_dict()
|
39 |
+
return line
|
40 |
+
except ValueError:
|
41 |
+
return
|
42 |
+
|
43 |
+
_DATASET_MODES = ["lm"]
|
44 |
+
_TRAIN_SPLITS = 10
|
45 |
+
_DESCRIPTION = "Dataset for Russian language modeling"
|
46 |
+
_URLS = {
|
47 |
+
"train": ["train/{}.jsonl.zst".format(str(i).zfill(2)) for i in range(_TRAIN_SPLITS)],
|
48 |
+
"validation": "validation.jsonl.zst",
|
49 |
+
"test": "test.jsonl.zst"
|
50 |
+
}
|
51 |
+
_TEXT = "text"
|
52 |
+
|
53 |
+
|
54 |
+
class RuLMDataset(datasets.GeneratorBasedBuilder):
|
55 |
+
"""RuLM Dataset"""
|
56 |
+
|
57 |
+
VERSION = datasets.Version("0.0.1")
|
58 |
+
|
59 |
+
BUILDER_CONFIGS = [
|
60 |
+
datasets.BuilderConfig(name="default", version=VERSION, description=""),
|
61 |
+
]
|
62 |
+
|
63 |
+
DEFAULT_CONFIG_NAME = "default"
|
64 |
+
|
65 |
+
def _info(self):
|
66 |
+
features = datasets.Features(
|
67 |
+
{
|
68 |
+
_TEXT: datasets.Value("string")
|
69 |
+
}
|
70 |
+
)
|
71 |
+
return datasets.DatasetInfo(
|
72 |
+
description=_DESCRIPTION,
|
73 |
+
features=features,
|
74 |
+
supervised_keys=(_TEXT,)
|
75 |
+
)
|
76 |
+
|
77 |
+
def _split_generators(self, dl_manager):
|
78 |
+
downloaded_files = dl_manager.download(_URLS)
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"paths": downloaded_files["train"]}),
|
81 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"paths": downloaded_files["test"]}),
|
82 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"paths": downloaded_files["validation"]}),
|
83 |
+
]
|
84 |
+
|
85 |
+
def _generate_examples(self, paths):
|
86 |
+
if not isinstance(paths, list):
|
87 |
+
paths = [paths]
|
88 |
+
for filename in paths:
|
89 |
+
with open(filename, "rb") as f:
|
90 |
+
print(filename)
|
91 |
+
cctx = zstandard.ZstdDecompressor()
|
92 |
+
reader_stream = io.BufferedReader(cctx.stream_reader(f))
|
93 |
+
reader = jsonlines.Reader(reader_stream, loads=json_parser)
|
94 |
+
for id_, item in enumerate(reader):
|
95 |
+
yield id_, {"text": item["text"]}
|
test.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:55ff35ce9acf5c4f8c9335823f9f49edd65e784d0e11c328bd75df9d7f5aec1c
|
3 |
+
size 70778806
|
train/00.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:289eb73d0ab3abdfebc81f0621dae41a85efe2abe0fda320c2cf7dc243f6d317
|
3 |
+
size 1403966055
|
train/01.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3db467ab55583ed23010ba1d3cbe63f43fc9f109ee86d482841ebaa46244cd3a
|
3 |
+
size 1403444341
|
train/02.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e7eeb1b51a7c20de60e08e2795f2b0375173598d308bb33eee75c46d0c7274c
|
3 |
+
size 1403753306
|
train/03.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bee12cf7c673bee3b5ff4c8d54ae9dd0e1e15905f6b1a21c3b8687c005e20294
|
3 |
+
size 1403232571
|
train/04.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6cd837fe047031724ed284f28bb6df933bfbafb9538f8a229068adbd9c012a9e
|
3 |
+
size 1404058088
|
train/05.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c644b66216a0f7e529c570cd5678ca0710c3cddce84ee8f0c110416259d8040
|
3 |
+
size 1404059600
|
train/06.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c9c7b9bd37d0d598ae4b485fa1bc3ce5ec9d62b33e8f3cd6328f2dfb09485b71
|
3 |
+
size 1403235848
|
train/07.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83f136a3d1d385f05046af4e60f0c838c34486472428a3cb649439bbe5f94b22
|
3 |
+
size 1403784237
|
train/08.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f79f58ad26e9eb5ad495b2705b4a89547e0f75ea108d1df0f8332a80b7344c52
|
3 |
+
size 1403377783
|
train/09.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:78627c55751e7e66f0d3998672e227fcf89fb1dab7bc1fdc8c59d6670210e373
|
3 |
+
size 1403824920
|
validation.jsonl.zst
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df4fd9badd77467fc90933fa1b8a58d47b8ca26ea34081e1e9d577a3db2a9403
|
3 |
+
size 71165256
|