Datasets:

Modalities:
Text
Formats:
json
Languages:
Korean
ArXiv:
Libraries:
Datasets
pandas
License:
taeshahn commited on
Commit
252a7da
1 Parent(s): 6bf4d88

Upload ko-lima.py

Browse files
Files changed (1) hide show
  1. ko-lima.py +68 -0
ko-lima.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+ # TODO: Add description of the dataset here
5
+ # You can copy an official description
6
+ _DESCRIPTION = """\
7
+ A high-quality dataset for efficient instruction tuning.
8
+ """
9
+
10
+ # TODO: Add a link to an official homepage for the dataset here
11
+ _HOMEPAGE = ""
12
+
13
+ # TODO: Add the licence for the dataset here if you can find it
14
+ _LICENSE = "other"
15
+
16
+ # TODO: Add link to the official dataset URLs here
17
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
18
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
19
+ _URLS = {
20
+ }
21
+
22
+
23
+ class LimaConfig(datasets.BuilderConfig):
24
+ """BuilderConfig"""
25
+
26
+ def __init__(self, **kwargs):
27
+ """BuilderConfig
28
+ Args:
29
+ **kwargs: keyword arguments forwarded to super.
30
+ """
31
+ super(LimaConfig, self).__init__(**kwargs)
32
+
33
+
34
+ class Lima(datasets.GeneratorBasedBuilder):
35
+
36
+ BUILDER_CONFIGS = [
37
+ LimaConfig(
38
+ name="plain_text",
39
+ version=datasets.Version("0.0.1", ""),
40
+ description="Plain text",
41
+ ),
42
+ ]
43
+
44
+ def _info(self):
45
+ return datasets.DatasetInfo(
46
+ description=_DESCRIPTION,
47
+ features=datasets.Features(
48
+ {
49
+ "conversations": datasets.features.Sequence(datasets.Value("string")),
50
+ "source": datasets.Value("string"),
51
+ }
52
+ ),
53
+ )
54
+
55
+ def _split_generators(self, dl_manager):
56
+ return [
57
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": dl_manager.download("lima_train_deepl_ko.jsonl")}),
58
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath":dl_manager.download("lima_test_deepl_ko.jsonl")})
59
+ ]
60
+
61
+ def _generate_examples(self, filepath):
62
+ """This function returns the examples in the raw (text) form."""
63
+ key = 0
64
+ with open(filepath) as f:
65
+ for line in f.readlines():
66
+ instance = json.loads(line)
67
+ yield key, instance
68
+ key += 1