AVE_Dataset / check_thinksound_latent.py
Helios1208's picture
Upload folder using huggingface_hub
61b6880 verified
import torch
from pathlib import Path
# 要遍历的目录
dir_path = Path("AVE_Dataset/test/video") # 也可以改成 audio
# 遍历所有 .pth 文件(按文件名排序)
for file_path in sorted(dir_path.glob("*.pth")):
data = torch.load(file_path, map_location="cpu")
if len(data['timing_plan']) > 1:
pass
print(f"Loaded {file_path}, keys: {list(data.keys())}")
file_path = "AVE_Dataset/train/video/0vWh6Knoer8.pth"
# file_path = "AVE_Dataset/train/audio/09o2OwlUCGI.pth"
data = torch.load(file_path, map_location="cpu")
print(type(data))
# 如果是张量
if isinstance(data, torch.Tensor):
print(data.shape)
print(data)
# 如果是字典
elif isinstance(data, dict):
for k, v in data.items():
print(f"{k}: {type(v)}, shape={getattr(v, 'shape', None)}")
# 如果是列表
elif isinstance(data, list):
print(f"List length: {len(data)}")
for i, item in enumerate(data[:3]): # 只看前三个
print(f"[{i}] {type(item)}, shape={getattr(item, 'shape', None)}")