Datasets:
File size: 1,506 Bytes
4a3121a cbcb7a0 db69b55 4a3121a db69b55 4099dd0 db69b55 4a3121a db69b55 e6a6dbb db69b55 e6a6dbb db69b55 cefd971 b9cefee db69b55 4099dd0 db69b55 63e7ca3 db69b55 4099dd0 cbcb7a0 e6a6dbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
import dataclasses
import itertools
from pathlib import Path
from typing import List
import datasets
datasets.logging.set_verbosity_info()
_DESCRIPTION = """\
Dataset of music tablature, in alphaTex (https://alphatab.net/docs/alphatex)
format, converted from Guitar Pro files (gp3, gp4, gp5, which are downloaded
from https://rutracker.org/forum/viewtopic.php?t=2888130
"""
class Builder(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("1.5.0")
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"text": datasets.Value("string"),
"file": datasets.Value("string"),
}
),
)
def _split_generators(self, dl_manager: datasets.DownloadManager):
data_dir = dl_manager.download_and_extract("data.zip")
if paths := list(Path(data_dir).glob("**/*.tex")):
print(f"Found {len(paths)} AlphaTex files")
else:
raise ValueError(f"No GP files found in {data_dir}")
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
gen_kwargs={
"filepaths": paths,
},
),
]
def _generate_examples(self, filepaths):
for idx, path in enumerate(filepaths):
with open(path) as f:
yield idx, {"file": path.name, "text": f.read()}
|