Datasets:
Delete hoyoMusic.py
Browse files- hoyoMusic.py +0 -49
hoyoMusic.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import json
|
3 |
-
import random
|
4 |
-
import datasets
|
5 |
-
|
6 |
-
_HOMEPAGE = f"https://www.modelscope.cn/datasets/Genius-Society/{os.path.basename(__file__)[:-3]}"
|
7 |
-
|
8 |
-
_URL = f"{_HOMEPAGE}/resolve/master/data/dataset.jsonl"
|
9 |
-
|
10 |
-
|
11 |
-
class hoyoMusic(datasets.GeneratorBasedBuilder):
|
12 |
-
def _info(self):
|
13 |
-
return datasets.DatasetInfo(
|
14 |
-
features=datasets.Features(
|
15 |
-
{
|
16 |
-
"prompt": datasets.Value("string"),
|
17 |
-
"data": datasets.Value("string"),
|
18 |
-
"label": datasets.Value("string"),
|
19 |
-
}
|
20 |
-
),
|
21 |
-
supervised_keys=("data", "label"),
|
22 |
-
homepage=_HOMEPAGE,
|
23 |
-
license="CC-BY-NC-ND",
|
24 |
-
version="0.0.1",
|
25 |
-
)
|
26 |
-
|
27 |
-
def _split_generators(self, dl_manager):
|
28 |
-
dataset = []
|
29 |
-
data = dl_manager.download(_URL)
|
30 |
-
with open(data, "r", encoding="utf-8") as file:
|
31 |
-
for line in file:
|
32 |
-
dataset.append(json.loads(line))
|
33 |
-
|
34 |
-
random.shuffle(dataset)
|
35 |
-
data_count = len(dataset)
|
36 |
-
p90 = int(data_count * 0.9)
|
37 |
-
|
38 |
-
return [
|
39 |
-
datasets.SplitGenerator(
|
40 |
-
name=datasets.Split.TRAIN, gen_kwargs={"files": dataset[:p90]}
|
41 |
-
),
|
42 |
-
datasets.SplitGenerator(
|
43 |
-
name=datasets.Split.TEST, gen_kwargs={"files": dataset[p90:]}
|
44 |
-
),
|
45 |
-
]
|
46 |
-
|
47 |
-
def _generate_examples(self, files):
|
48 |
-
for i, path in enumerate(files):
|
49 |
-
yield i, path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|