Files
MIDIFoundationModel/data_representation/test.py
2025-10-29 17:14:33 +08:00

14 lines
367 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import numpy as np
# 读取 npz 文件
data = np.load("dataset/represented_data/tuneidx/tuneidx_Melody/octuple8/AIDemo-recuKqEwVxsfij.npz", allow_pickle=True)
# 查看保存的键
print(data.files)
# 输出:['filename', 'sequence']
# 访问数据
sequence = data["arr_0"]
print("token 序列长度:", len(sequence))
print("前 20 个 token", sequence[:20])