Dataset Viewer
Auto-converted to Parquet Duplicate
audio_tokens
sequencelengths
64
3.01k
genre_id
int64
0
18
genre
stringclasses
19 values
song_id
int64
0
25k
[ 569, 1834, 2459, 7787, 2947, 3779, 288, 4151, 288, 4245, 288, 493, 708, 3028, 873, 3168, 902, 1295, 3270, 6808, 1132, 2185, 3344, 1745, 3301, 7344, 490, 5469, 1080, 5853, 40, 636, 711, 5759, 970, 5761, 1132, 2378, 3820, 7700, 693, 586...
0
Electronic
0
[ 1633, 6381, 2793, 6385, 1035, 429, 3132, 1388, 3222, 7374, 1331, 1455, 3007, 6419, 3283, 7895, 2088, 937, 3562, 1917, 1783, 3202, 3991, 1958, 1167, 8175, 1331, 4389, 1981, 5864, 1114, 6751, 1673, 4389, 3322, 7025, 2013, 6959, 3132, 3487, ...
9
International
1
[ 2636, 7165, 2223, 6240, 2175, 721, 1853, 2300, 2962, 66, 3316, 3447, 1740, 2071, 1770, 7988, 2088, 859, 2626, 1790, 3808, 471, 3005, 7602, 3364, 7410, 1311, 1712, 2836, 3846, 3648, 4324, 1673, 2245, 3214, 6410, 3029, 237, 3635, 6722, 15...
6
Chiptune / Glitch
2
[ 1287, 7427, 2676, 1153, 2993, 4972, 2255, 4483, 2318, 3963, 1195, 7716, 1505, 3525, 1999, 6531, 1302, 2908, 2000, 2635, 3546, 5038, 1447, 7011, 1968, 1966, 1934, 464, 3409, 2810, 3138, 1846, 3560, 7092, 2000, 897, 2893, 878, 1447, 1623, ...
4
Hip-Hop
4
[ 2012, 838, 2012, 4268, 1470, 4890, 1809, 587, 2020, 7961, 1647, 5088, 1786, 7284, 2242, 4325, 1692, 1360, 1434, 5276, 1355, 6022, 1204, 2081, 1204, 207, 1575, 4261, 1921, 3531, 3474, 5978, 1692, 5348, 1525, 1339, 1720, 809, 1541, 7015, ...
14
Country
5
[ 2783, 4287, 2826, 1172, 2702, 7043, 2702, 6287, 2826, 5083, 2826, 1620, 2826, 3063, 2826, 5392, 2783, 4171, 3677, 2393, 3747, 1343, 2518, 4457, 3460, 6689, 3647, 1021, 2641, 1960, 2599, 8076, 2783, 7497, 2497, 6531, 1844, 6004, 3107, 7726...
12
Old-Time / Historic
7
[ 1691, 7207, 880, 6933, 825, 4741, 1470, 5301, 606, 3377, 286, 5675, 141, 3316, 517, 547, 1184, 3502, 145, 1689, 3883, 4778, 208, 7400, 606, 4881, 1646, 4986, 1934, 1153, 517, 6135, 3162, 6767, 1932, 6260, 3883, 6719, 474, 7042, 3798, ...
4
Hip-Hop
9
[ 1416, 4748, 2016, 4546, 1074, 1706, 2399, 7558, 1532, 6109, 1381, 3634, 3770, 8182, 3728, 5238, 1424, 3698, 3293, 2584, 3319, 3213, 2613, 6737, 3357, 2798, 2418, 6842, 3770, 3405, 1237, 2625, 1657, 2735, 2603, 3240, 3319, 1878, 2613, 2040...
2
Punk
10
[ 1405, 1593, 2716, 515, 4056, 5544, 3922, 4070, 1034, 4650, 2557, 562, 2321, 574, 3038, 2196, 2556, 5982, 2716, 5263, 3619, 7228, 2769, 205, 3480, 6752, 2489, 1027, 2171, 2330, 3485, 5177, 3917, 3171, 2716, 5057, 2464, 7119, 3096, 621, 3...
0
Electronic
12
[ 1880, 3951, 2310, 7174, 3686, 520, 2133, 3057, 2555, 6257, 2090, 4877, 3574, 7387, 3182, 7481, 1880, 4430, 3362, 6982, 1476, 2430, 1476, 2255, 2511, 3345, 723, 5986, 2224, 1747, 598, 3646, 2331, 1556, 3767, 2069, 2077, 1626, 2399, 8100, ...
7
Instrumental
13
[ 2728, 3967, 2279, 5815, 3860, 4260, 3337, 7949, 2921, 7474, 2407, 8068, 2192, 3061, 3188, 6434, 2728, 883, 3341, 654, 3860, 5029, 3337, 4386, 2921, 461, 2407, 4951, 2140, 3294, 3188, 4390, 2728, 7594, 3341, 3195, 1694, 7421, 3337, 8138, ...
3
Experimental
14
[ 2669, 2463, 2826, 1259, 2119, 7063, 2669, 5950, 984, 1674, 2669, 6908, 2826, 6833, 2826, 1101, 2704, 86, 2550, 983, 2119, 3883, 2932, 1321, 2673, 5369, 3089, 791, 3339, 2256, 2109, 205, 4061, 5245, 3744, 30, 2119, 7145, 2435, 2107, 3405...
17
Blues
15
[ 3555, 6205, 3203, 7594, 1133, 7005, 1175, 5983, 1679, 5373, 1679, 4993, 2485, 3942, 1060, 7794, 1493, 7956, 1629, 2298, 1133, 3547, 1175, 2661, 1557, 7532, 1679, 4219, 2018, 3054, 1576, 1223, 3555, 8146, 1253, 6610, 1133, 2425, 1175, 7702...
4
Hip-Hop
16
End of preview. Expand in Data Studio

This dataset contains tokenized audio from lewtun/music_genres using SemantiCodec for performing experiments on AR music generation

The following script is used for tokenization

from datasets import load_dataset, Dataset, DatasetDict

model_id = ""
repo_name = ""
user_name = ""
token = ""
cache_dir = "cache"
vocab_size = 4096

dataset = load_dataset(model_id, cache_dir=cache_dir, trust_remote_code=True)

from semanticodec import SemantiCodec

semanticodec = SemantiCodec(token_rate=100, semantic_vocab_size=vocab_size)

import soundfile as sf
from tqdm import tqdm
import math

dd = {
    "train": 0,
    "test": 0
}

for split in ["train", "test"]:
    tkns = []
    for idx in tqdm(range(len(dataset[split]))):
        sample = dataset[split][idx]["audio"]
        array = sample["array"]
        sr = sample["sampling_rate"]
        
        sf.write("output.wav", array, sr)
        
        tokens = semanticodec.encode("output.wav").detach().cpu().numpy().flatten()
        tkns.append(tokens)
        
    ds = Dataset.from_dict({
        "audio_tokens": tkns,
        "genre_id": list(dataset[split]["genre_id"]),
        "genre": list(dataset[split]["genre"]),
        "song_id": list(dataset[split]["song_id"])
    })
    dd[split] = ds

dd = DatasetDict(dd)
dd.save_to_disk(repo_name)
dd.push_to_hub(f"{user_name}/{repo_name}", token=token)
Downloads last month
4

Paper for darshanmakwana/music_genre_tokenized