lhotse_issue_1478 / debug.py
yuekai's picture
Update debug.py
a097882 verified
raw
history blame contribute delete
802 Bytes
from lhotse import CutSet, load_manifest_lazy
import torch
manifest_path = "data/fbank/cuts_debug.jsonl.gz" # many inf values
manifest_path = "data/fbank_voice_assistant_cosy2_hdf5/cuts_debug_h5py.jsonl.gz" # few inf values
cuts_manifest = load_manifest_lazy(manifest_path)
for i, cut in enumerate(cuts_manifest):
feats = cut.load_features()
feats = torch.from_numpy(feats)
if torch.isnan(feats).any() or torch.isinf(feats).any():
print("cut.load_features() nan or inf, index: ", i)
nan_indices = torch.where(torch.isnan(feats))
inf_indices = torch.where(torch.isinf(feats))
print(feats[nan_indices])
print(feats[inf_indices])
print("fbank nan or inf")
print(f"nan_indices: {nan_indices}, inf_indices: {inf_indices}")
exit()