Datasets:
vladsaveliev
commited on
Commit
·
e6a6dbb
1
Parent(s):
e0a5cc6
Just use text, do not parse for metaparameters
Browse files- README.md +3 -29
- guitar_tab.py +4 -240
README.md
CHANGED
|
@@ -13,40 +13,14 @@ dataset_info:
|
|
| 13 |
features:
|
| 14 |
- name: text
|
| 15 |
dtype: string
|
| 16 |
-
- name: track_name
|
| 17 |
-
dtype: string
|
| 18 |
-
- name: track_number
|
| 19 |
-
dtype: int32
|
| 20 |
-
- name: instrument_name
|
| 21 |
-
dtype: string
|
| 22 |
-
- name: instrument_number
|
| 23 |
-
dtype: int32
|
| 24 |
-
- name: title
|
| 25 |
-
dtype: string
|
| 26 |
-
- name: tempo
|
| 27 |
-
dtype: int32
|
| 28 |
-
- name: tuning
|
| 29 |
-
dtype: string
|
| 30 |
-
- name: frets
|
| 31 |
-
dtype: int32
|
| 32 |
- name: file
|
| 33 |
dtype: string
|
| 34 |
-
- name: subtitle
|
| 35 |
-
dtype: string
|
| 36 |
-
- name: artist
|
| 37 |
-
dtype: string
|
| 38 |
-
- name: album
|
| 39 |
-
dtype: string
|
| 40 |
-
- name: words
|
| 41 |
-
dtype: string
|
| 42 |
-
- name: music
|
| 43 |
-
dtype: string
|
| 44 |
splits:
|
| 45 |
- name: train
|
| 46 |
-
num_bytes:
|
| 47 |
-
num_examples:
|
| 48 |
download_size: 75369951
|
| 49 |
-
dataset_size:
|
| 50 |
- config_name: all
|
| 51 |
features:
|
| 52 |
- name: file
|
|
|
|
| 13 |
features:
|
| 14 |
- name: text
|
| 15 |
dtype: string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
- name: file
|
| 17 |
dtype: string
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
splits:
|
| 19 |
- name: train
|
| 20 |
+
num_bytes: 961930414
|
| 21 |
+
num_examples: 47299
|
| 22 |
download_size: 75369951
|
| 23 |
+
dataset_size: 961930414
|
| 24 |
- config_name: all
|
| 25 |
features:
|
| 26 |
- name: file
|
guitar_tab.py
CHANGED
|
@@ -13,169 +13,17 @@ format, converted from Guitar Pro files (gp3, gp4, gp5, which are downloaded
|
|
| 13 |
from https://rutracker.org/forum/viewtopic.php?t=2888130
|
| 14 |
"""
|
| 15 |
|
| 16 |
-
INSTRUMENT_MAP = {
|
| 17 |
-
0: "Acoustic Grand Piano",
|
| 18 |
-
1: "Bright Grand Piano",
|
| 19 |
-
2: "Electric Grand Piano",
|
| 20 |
-
3: "Honky tonk Piano",
|
| 21 |
-
4: "Electric Piano 1",
|
| 22 |
-
5: "Electric Piano 2",
|
| 23 |
-
6: "Harpsichord",
|
| 24 |
-
7: "Clavinet",
|
| 25 |
-
8: "Celesta",
|
| 26 |
-
9: "Glockenspiel",
|
| 27 |
-
10: "Musicbox",
|
| 28 |
-
11: "Vibraphone",
|
| 29 |
-
12: "Marimba",
|
| 30 |
-
13: "Xylophone",
|
| 31 |
-
14: "Tubularbells",
|
| 32 |
-
15: "Dulcimer",
|
| 33 |
-
16: "Drawbar Organ",
|
| 34 |
-
17: "Percussive Organ",
|
| 35 |
-
18: "Rock Organ",
|
| 36 |
-
19: "Church Organ",
|
| 37 |
-
20: "Reed Organ",
|
| 38 |
-
21: "Accordion",
|
| 39 |
-
22: "Harmonica",
|
| 40 |
-
23: "Tango Accordion",
|
| 41 |
-
24: "Acoustic Guitar Nylon",
|
| 42 |
-
25: "Acoustic Guitar Steel",
|
| 43 |
-
26: "Electric Guitar Jazz",
|
| 44 |
-
27: "Electric Guitar Clean",
|
| 45 |
-
28: "Electric Guitar Muted",
|
| 46 |
-
29: "Overdriven Guitar",
|
| 47 |
-
30: "Distortion Guitar",
|
| 48 |
-
31: "Guitar Harmonics",
|
| 49 |
-
32: "Acoustic Bass",
|
| 50 |
-
33: "Electric Bass Finger",
|
| 51 |
-
34: "Electric Bass Pick",
|
| 52 |
-
35: "Fretless Bass",
|
| 53 |
-
36: "Slap Bass 1",
|
| 54 |
-
37: "Slap Bass 2",
|
| 55 |
-
38: "Synth Bass 1",
|
| 56 |
-
39: "Synth Bass 2",
|
| 57 |
-
40: "Violin",
|
| 58 |
-
41: "Viola",
|
| 59 |
-
42: "Cello",
|
| 60 |
-
43: "Contrabass",
|
| 61 |
-
44: "Tremolo Strings",
|
| 62 |
-
45: "Pizzicato Strings",
|
| 63 |
-
46: "Orchestral Harp",
|
| 64 |
-
47: "Timpani",
|
| 65 |
-
48: "String Ensemble 1",
|
| 66 |
-
49: "String Ensemble 2",
|
| 67 |
-
50: "Synth Strings 1",
|
| 68 |
-
51: "Synth Strings 2",
|
| 69 |
-
52: "Choir Aahs",
|
| 70 |
-
53: "Voice Oohs",
|
| 71 |
-
54: "Synth Voice",
|
| 72 |
-
55: "Orchestra Hit",
|
| 73 |
-
56: "Trumpet",
|
| 74 |
-
57: "Trombone",
|
| 75 |
-
58: "Tuba",
|
| 76 |
-
59: "Muted Trumpet",
|
| 77 |
-
60: "French Horn",
|
| 78 |
-
61: "Brass Section",
|
| 79 |
-
62: "Synth Brass 1",
|
| 80 |
-
63: "Synth Brass 2",
|
| 81 |
-
64: "Soprano Sax",
|
| 82 |
-
65: "Alto Sax",
|
| 83 |
-
66: "Tenor Sax",
|
| 84 |
-
67: "Baritone Sax",
|
| 85 |
-
68: "Oboe",
|
| 86 |
-
69: "English Horn",
|
| 87 |
-
70: "Bassoon",
|
| 88 |
-
71: "Clarinet",
|
| 89 |
-
72: "Piccolo",
|
| 90 |
-
73: "Flute",
|
| 91 |
-
74: "Recorder",
|
| 92 |
-
75: "Pan Flute",
|
| 93 |
-
76: "Blown bottle",
|
| 94 |
-
77: "Shakuhachi",
|
| 95 |
-
78: "Whistle",
|
| 96 |
-
79: "Ocarina",
|
| 97 |
-
80: "Lead 1 Square",
|
| 98 |
-
81: "Lead 2 Sawtooth",
|
| 99 |
-
82: "Lead 3 Calliope",
|
| 100 |
-
83: "Lead 4 Chiff",
|
| 101 |
-
84: "Lead 5 Charang",
|
| 102 |
-
85: "Lead 6 Voice",
|
| 103 |
-
86: "Lead 7 Fifths",
|
| 104 |
-
87: "Lead 8 Bass and Lead",
|
| 105 |
-
88: "Pad 1 newage",
|
| 106 |
-
89: "Pad 2 warm",
|
| 107 |
-
90: "Pad 3 polysynth",
|
| 108 |
-
91: "Pad 4 choir",
|
| 109 |
-
92: "Pad 5 bowed",
|
| 110 |
-
93: "Pad 6 metallic",
|
| 111 |
-
94: "Pad 7 halo",
|
| 112 |
-
95: "Pad 8 sweep",
|
| 113 |
-
96: "Fx 1 rain",
|
| 114 |
-
97: "Fx 2 soundtrack",
|
| 115 |
-
98: "Fx 3 crystal",
|
| 116 |
-
99: "Fx 4 atmosphere",
|
| 117 |
-
100: "Fx 5 brightness",
|
| 118 |
-
101: "Fx 6 goblins",
|
| 119 |
-
102: "Fx 7 echoes",
|
| 120 |
-
103: "Fx 8 scifi",
|
| 121 |
-
104: "Sitar",
|
| 122 |
-
105: "Banjo",
|
| 123 |
-
106: "Shamisen",
|
| 124 |
-
107: "Koto",
|
| 125 |
-
108: "Kalimba",
|
| 126 |
-
109: "Bag pipe",
|
| 127 |
-
110: "Fiddle",
|
| 128 |
-
111: "Shanai",
|
| 129 |
-
112: "Tinkle Bell",
|
| 130 |
-
113: "Agogo",
|
| 131 |
-
114: "Steel Drums",
|
| 132 |
-
115: "Woodblock",
|
| 133 |
-
116: "Taiko Drum",
|
| 134 |
-
117: "Melodic Tom",
|
| 135 |
-
118: "Synth Drum",
|
| 136 |
-
119: "Reverse Cymbal",
|
| 137 |
-
120: "Guitar Fret Noise",
|
| 138 |
-
121: "Breath Noise",
|
| 139 |
-
122: "Seashore",
|
| 140 |
-
123: "Bird Tweet",
|
| 141 |
-
124: "Telephone Ring",
|
| 142 |
-
125: "Helicopter",
|
| 143 |
-
126: "Applause",
|
| 144 |
-
127: "Gunshot",
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
@dataclasses.dataclass
|
| 149 |
-
class Example:
|
| 150 |
-
text: str
|
| 151 |
-
track_name: str
|
| 152 |
-
track_number: int
|
| 153 |
-
instrument_name: str
|
| 154 |
-
instrument_number: int
|
| 155 |
-
title: str = None
|
| 156 |
-
tempo: int = None
|
| 157 |
-
tuning: str = None
|
| 158 |
-
frets: int = None
|
| 159 |
-
file: str = None
|
| 160 |
-
subtitle: str = None
|
| 161 |
-
artist: str = None
|
| 162 |
-
album: str = None
|
| 163 |
-
words: str = None
|
| 164 |
-
music: str = None
|
| 165 |
-
|
| 166 |
|
| 167 |
class Builder(datasets.GeneratorBasedBuilder):
|
| 168 |
-
VERSION = datasets.Version("1.
|
| 169 |
|
| 170 |
def _info(self):
|
| 171 |
return datasets.DatasetInfo(
|
| 172 |
description=_DESCRIPTION,
|
| 173 |
features=datasets.Features(
|
| 174 |
{
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
else datasets.Value("string")
|
| 178 |
-
for field, type_ in Example.__annotations__.items()
|
| 179 |
}
|
| 180 |
),
|
| 181 |
)
|
|
@@ -199,88 +47,4 @@ class Builder(datasets.GeneratorBasedBuilder):
|
|
| 199 |
def _generate_examples(self, filepaths):
|
| 200 |
for idx, path in enumerate(filepaths):
|
| 201 |
with open(path) as f:
|
| 202 |
-
|
| 203 |
-
for example in examples:
|
| 204 |
-
example.file = path.name
|
| 205 |
-
yield f"{idx}-{example.track_number}", example.__dict__
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
def _parse_examples(tex: str) -> List[Example]:
|
| 209 |
-
"""
|
| 210 |
-
Returns a dictionary for each track
|
| 211 |
-
"""
|
| 212 |
-
examples = []
|
| 213 |
-
data = {}
|
| 214 |
-
|
| 215 |
-
def _parse_track_header_line(k, v):
|
| 216 |
-
if k == "instrument":
|
| 217 |
-
data['instrument_name'] = INSTRUMENT_MAP.get(int(v), "unknown")
|
| 218 |
-
data['instrument_number'] = int(v)
|
| 219 |
-
elif k == "tuning":
|
| 220 |
-
data['tuning'] = v.split(" ")
|
| 221 |
-
elif k == "frets":
|
| 222 |
-
data['frets'] = int(v)
|
| 223 |
-
|
| 224 |
-
lines = (l_.strip() for l_ in tex.splitlines() if l_.strip())
|
| 225 |
-
song_header_lines = list(itertools.takewhile(lambda l: l != ".", lines))
|
| 226 |
-
|
| 227 |
-
for line in song_header_lines:
|
| 228 |
-
assert line.startswith("\\")
|
| 229 |
-
line = line.lstrip("\\")
|
| 230 |
-
kv = line.split(" ", 1)
|
| 231 |
-
if len(kv) == 1:
|
| 232 |
-
continue
|
| 233 |
-
k, v = kv
|
| 234 |
-
if k in [
|
| 235 |
-
"title",
|
| 236 |
-
"subtitle",
|
| 237 |
-
"artist",
|
| 238 |
-
"album",
|
| 239 |
-
"words",
|
| 240 |
-
"music",
|
| 241 |
-
]:
|
| 242 |
-
data[k] = v.strip('"').strip("'")
|
| 243 |
-
elif k == "tempo":
|
| 244 |
-
data['tempo'] = int(v)
|
| 245 |
-
else:
|
| 246 |
-
_parse_track_header_line(k, v)
|
| 247 |
-
|
| 248 |
-
track_header_lines = []
|
| 249 |
-
track_tex_lines = []
|
| 250 |
-
|
| 251 |
-
def _new_example():
|
| 252 |
-
nonlocal data, track_header_lines, track_tex_lines
|
| 253 |
-
data['track_number'] = (track_number := len(examples) + 1)
|
| 254 |
-
data['track_name'] = v if v else f"Track {track_number}"
|
| 255 |
-
data['text'] = (
|
| 256 |
-
'\n'.join(
|
| 257 |
-
song_header_lines +
|
| 258 |
-
["."] +
|
| 259 |
-
track_header_lines +
|
| 260 |
-
[" ".join(track_tex_lines)]
|
| 261 |
-
)
|
| 262 |
-
)
|
| 263 |
-
examples.append(Example(**data))
|
| 264 |
-
data = {}
|
| 265 |
-
track_header_lines = []
|
| 266 |
-
track_tex_lines = []
|
| 267 |
-
|
| 268 |
-
for line in lines:
|
| 269 |
-
if line.startswith("\\"):
|
| 270 |
-
if len(kv := line.lstrip("\\").split(" ", 1)) == 2:
|
| 271 |
-
k = kv[0]
|
| 272 |
-
v = kv[1].strip('"').strip("'")
|
| 273 |
-
else:
|
| 274 |
-
k = kv[0]
|
| 275 |
-
v = None
|
| 276 |
-
if k == "track":
|
| 277 |
-
if track_tex_lines:
|
| 278 |
-
_new_example()
|
| 279 |
-
else:
|
| 280 |
-
_parse_track_header_line(k, v)
|
| 281 |
-
track_header_lines.append(line)
|
| 282 |
-
else:
|
| 283 |
-
track_tex_lines.append(line)
|
| 284 |
-
if track_tex_lines:
|
| 285 |
-
_new_example()
|
| 286 |
-
return [t for t in examples if t.text]
|
|
|
|
| 13 |
from https://rutracker.org/forum/viewtopic.php?t=2888130
|
| 14 |
"""
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
class Builder(datasets.GeneratorBasedBuilder):
|
| 18 |
+
VERSION = datasets.Version("1.5.0")
|
| 19 |
|
| 20 |
def _info(self):
|
| 21 |
return datasets.DatasetInfo(
|
| 22 |
description=_DESCRIPTION,
|
| 23 |
features=datasets.Features(
|
| 24 |
{
|
| 25 |
+
"text": datasets.Value("string"),
|
| 26 |
+
"file": datasets.Value("string"),
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
),
|
| 29 |
)
|
|
|
|
| 47 |
def _generate_examples(self, filepaths):
|
| 48 |
for idx, path in enumerate(filepaths):
|
| 49 |
with open(path) as f:
|
| 50 |
+
yield idx, {"file": path.name, "text": f.read()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|