IlyaGusev commited on
Commit
80b4d9f
1 Parent(s): 89b9dc0

Initial commit

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +62 -0
  3. pikabu.jsonl.zst +3 -0
  4. pikabu.py +101 -0
.gitattributes CHANGED
@@ -52,3 +52,4 @@ 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
+ pikabu.jsonl.zst filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ dataset_info:
3
+ features:
4
+ - name: id
5
+ dtype: int64
6
+ - name: title
7
+ dtype: string
8
+ - name: text_markdown
9
+ dtype: string
10
+ - name: timestamp
11
+ dtype: uint64
12
+ - name: author_id
13
+ dtype: int64
14
+ - name: username
15
+ dtype: string
16
+ - name: rating
17
+ dtype: int64
18
+ - name: pluses
19
+ dtype: int64
20
+ - name: minuses
21
+ dtype: int64
22
+ - name: url
23
+ dtype: string
24
+ - name: tags
25
+ sequence: string
26
+ - name: blocks
27
+ sequence:
28
+ - name: data
29
+ dtype: string
30
+ - name: type
31
+ dtype: string
32
+ - name: comments
33
+ sequence:
34
+ - name: id
35
+ dtype: int64
36
+ - name: timestamp
37
+ dtype: uint64
38
+ - name: parent_id
39
+ dtype: int64
40
+ - name: text_markdown
41
+ dtype: string
42
+ - name: text_html
43
+ dtype: string
44
+ - name: images
45
+ sequence: string
46
+ - name: rating
47
+ dtype: int64
48
+ - name: pluses
49
+ dtype: int64
50
+ - name: minuses
51
+ dtype: int64
52
+ - name: author_id
53
+ dtype: int64
54
+ - name: username
55
+ dtype: string
56
+ splits:
57
+ - name: train
58
+ num_bytes: 96105803658
59
+ num_examples: 6907622
60
+ download_size: 20197306953
61
+ dataset_size: 96105803658
62
+ ---
pikabu.jsonl.zst ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:91e2f8a3c408e0cf14039488cada9f5f9b7a31b204240d9f2a134ba9d597dd16
3
+ size 20197306953
pikabu.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ import os
18
+ import io
19
+
20
+ import zstandard
21
+ import jsonlines
22
+ import datasets
23
+
24
+ try:
25
+ import simdjson
26
+ parser = simdjson.Parser()
27
+ def parse_json(x):
28
+ try:
29
+ return parser.parse(x).as_dict()
30
+ except ValueError:
31
+ return
32
+ except ImportError:
33
+ import json
34
+ def parse_json(x):
35
+ return json.loads(x)
36
+
37
+
38
+ _DESCRIPTION = "Pikabu dataset"
39
+ _URL = "pikabu.jsonl.zst"
40
+
41
+
42
+ class YandexQFullDataset(datasets.GeneratorBasedBuilder):
43
+ VERSION = datasets.Version("0.0.1")
44
+
45
+ BUILDER_CONFIGS = [
46
+ datasets.BuilderConfig(name="default", version=VERSION, description=""),
47
+ ]
48
+
49
+ DEFAULT_CONFIG_NAME = "default"
50
+
51
+ def _info(self):
52
+ features = datasets.Features(
53
+ {
54
+ "id": datasets.Value("int64"),
55
+ "title": datasets.Value("string"),
56
+ "text_markdown": datasets.Value("string"),
57
+ "timestamp": datasets.Value("uint64"),
58
+ "author_id": datasets.Value("int64"),
59
+ "username": datasets.Value("string"),
60
+ "rating": datasets.Value("int64"),
61
+ "pluses": datasets.Value("int64"),
62
+ "minuses": datasets.Value("int64"),
63
+ "url": datasets.Value("string"),
64
+ "tags": datasets.Sequence(datasets.Value("string")),
65
+ "blocks": datasets.Sequence(feature={
66
+ "data": datasets.Value("string"),
67
+ "type": datasets.Value("string")
68
+ }),
69
+ "comments": datasets.Sequence(feature={
70
+ "id": datasets.Value("int64"),
71
+ "timestamp": datasets.Value("uint64"),
72
+ "parent_id": datasets.Value("int64"),
73
+ "text_markdown": datasets.Value("string"),
74
+ "text_html": datasets.Value("string"),
75
+ "images": datasets.Sequence(datasets.Value("string")),
76
+ "rating": datasets.Value("int64"),
77
+ "pluses": datasets.Value("int64"),
78
+ "minuses": datasets.Value("int64"),
79
+ "author_id": datasets.Value("int64"),
80
+ "username": datasets.Value("string")
81
+ })
82
+ }
83
+ )
84
+ return datasets.DatasetInfo(
85
+ description=_DESCRIPTION,
86
+ features=features
87
+ )
88
+
89
+ def _split_generators(self, dl_manager):
90
+ downloaded_file = dl_manager.download(_URL)
91
+ return [
92
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"path": downloaded_file}),
93
+ ]
94
+
95
+ def _generate_examples(self, path):
96
+ with open(path, "rb") as f:
97
+ cctx = zstandard.ZstdDecompressor()
98
+ reader_stream = io.BufferedReader(cctx.stream_reader(f))
99
+ reader = jsonlines.Reader(reader_stream, loads=parse_json)
100
+ for id_, item in enumerate(reader):
101
+ yield id_, item