Delete ko-lima.py
Browse files- ko-lima.py +0 -102
ko-lima.py
DELETED
|
@@ -1,102 +0,0 @@
|
|
| 1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
|
| 15 |
-
import csv
|
| 16 |
-
import json
|
| 17 |
-
import os
|
| 18 |
-
import datasets
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
_CITATION = """\
|
| 22 |
-
@InProceedings{huggingface:dataset,
|
| 23 |
-
title = {Ko-LIMA: Korean LIMA Dataset},
|
| 24 |
-
author={Hahn, Taeseung},
|
| 25 |
-
year={2023}
|
| 26 |
-
}
|
| 27 |
-
"""
|
| 28 |
-
_DESCRIPTION = """\
|
| 29 |
-
A high-quality korean dataset for efficient instruction tuning.
|
| 30 |
-
"""
|
| 31 |
-
_HOMEPAGE = ""
|
| 32 |
-
_LICENSE = ""
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
class KoLima(datasets.GeneratorBasedBuilder):
|
| 36 |
-
"""A high-quality korean dataset for efficient instruction tuning."""
|
| 37 |
-
|
| 38 |
-
VERSION = datasets.Version("1.0.0")
|
| 39 |
-
|
| 40 |
-
BUILDER_CONFIGS = [
|
| 41 |
-
datasets.BuilderConfig(name="plain", version=VERSION, description="Korean LIMA dataset in a plain format"),
|
| 42 |
-
datasets.BuilderConfig(name="vicuna", version=VERSION, description="Korean LIMA dataset in Vicuna format"),
|
| 43 |
-
]
|
| 44 |
-
|
| 45 |
-
DEFAULT_CONFIG_NAME = "plain"
|
| 46 |
-
|
| 47 |
-
def _info(self):
|
| 48 |
-
if self.config.name == "vicuna":
|
| 49 |
-
features = datasets.Features(
|
| 50 |
-
{
|
| 51 |
-
'id': datasets.Value(dtype='string', id=None),
|
| 52 |
-
'conversations': [
|
| 53 |
-
{
|
| 54 |
-
'from': datasets.Value(dtype='string', id=None),
|
| 55 |
-
'value': datasets.Value(dtype='string', id=None)
|
| 56 |
-
}
|
| 57 |
-
]
|
| 58 |
-
}
|
| 59 |
-
)
|
| 60 |
-
else:
|
| 61 |
-
features = datasets.Features(
|
| 62 |
-
{
|
| 63 |
-
'conversations': datasets.Sequence(feature=datasets.Value(dtype='string', id=None), length=-1, id=None),
|
| 64 |
-
'source': datasets.Value(dtype='string', id=None)
|
| 65 |
-
}
|
| 66 |
-
)
|
| 67 |
-
return datasets.DatasetInfo(
|
| 68 |
-
description=_DESCRIPTION,
|
| 69 |
-
features=features,
|
| 70 |
-
homepage=_HOMEPAGE,
|
| 71 |
-
license=_LICENSE,
|
| 72 |
-
citation=_CITATION,
|
| 73 |
-
)
|
| 74 |
-
|
| 75 |
-
def _split_generators(self, dl_manager):
|
| 76 |
-
return [
|
| 77 |
-
datasets.SplitGenerator(
|
| 78 |
-
name=datasets.Split.TRAIN,
|
| 79 |
-
# These kwargs will be passed to _generate_examples
|
| 80 |
-
gen_kwargs={
|
| 81 |
-
"filepath": dl_manager.download(os.path.join(self.config.name, "train.jsonl")),
|
| 82 |
-
"split": "train",
|
| 83 |
-
},
|
| 84 |
-
),
|
| 85 |
-
datasets.SplitGenerator(
|
| 86 |
-
name=datasets.Split.TEST,
|
| 87 |
-
# These kwargs will be passed to _generate_examples
|
| 88 |
-
gen_kwargs={
|
| 89 |
-
"filepath": dl_manager.download(os.path.join(self.config.name, "test.jsonl")),
|
| 90 |
-
"split": "test"
|
| 91 |
-
},
|
| 92 |
-
),
|
| 93 |
-
]
|
| 94 |
-
|
| 95 |
-
def _generate_examples(self, filepath, split):
|
| 96 |
-
with open(filepath, encoding="utf-8") as f:
|
| 97 |
-
for key, row in enumerate(f):
|
| 98 |
-
instance = json.loads(row)
|
| 99 |
-
if self.config.name == "vicuna":
|
| 100 |
-
yield key, instance
|
| 101 |
-
else:
|
| 102 |
-
yield key, instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|