Sieun Park
commited on
Commit
·
ced6b99
1
Parent(s):
284977b
Upload 3 files
Browse files- .gitattributes +2 -0
- new_format_data_trn.jsonl +3 -0
- new_format_data_val.jsonl +3 -0
- newstext.py +32 -0
.gitattributes
CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
new_format_data_trn.jsonl filter=lfs diff=lfs merge=lfs -text
|
57 |
+
new_format_data_val.jsonl filter=lfs diff=lfs merge=lfs -text
|
new_format_data_trn.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e865d13992ea12bd416e6a669d238ae64f98f93ca5dc30f0d7b3b1a5a2d7072d
|
3 |
+
size 628968952
|
new_format_data_val.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5764ec308e77f62879aba4ec37af0002b04821831f54b8d4c901d404dad7bfb5
|
3 |
+
size 91901760
|
newstext.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import datasets
|
3 |
+
import os
|
4 |
+
from datasets import DatasetBuilder, SplitGenerator, DownloadConfig, Split
|
5 |
+
|
6 |
+
from datasets import GeneratorBasedBuilder, SplitGenerator, Split
|
7 |
+
|
8 |
+
class TextDataset(GeneratorBasedBuilder):
|
9 |
+
VERSION = "1.0.0"
|
10 |
+
BUILDER_CONFIGS = [
|
11 |
+
datasets.BuilderConfig(name="text", version=VERSION, description="Text data"),
|
12 |
+
]
|
13 |
+
|
14 |
+
def _info(self):
|
15 |
+
return datasets.DatasetInfo(features=datasets.Features({'text': datasets.Value('string')}))
|
16 |
+
|
17 |
+
def _split_generators(self, dl_manager):
|
18 |
+
|
19 |
+
train_path = "./new_format_data_trn.jsonl"
|
20 |
+
val_path = "./new_format_data_val.jsonl"
|
21 |
+
train_path = dl_manager.download_and_extract(train_path)
|
22 |
+
val_path = dl_manager.download_and_extract(val_path)
|
23 |
+
return [
|
24 |
+
SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
25 |
+
SplitGenerator(name=Split.VALIDATION, gen_kwargs={"filepath": val_path}),
|
26 |
+
]
|
27 |
+
|
28 |
+
def _generate_examples(self, filepath):
|
29 |
+
with open(filepath, encoding="utf-8") as f:
|
30 |
+
for id_, line in enumerate(f):
|
31 |
+
yield id_, json.loads(line)
|
32 |
+
|