python LibsndfileError: Error opening が解決できない

error

1--------------------------------------------------------------------------- 2LibsndfileError Traceback (most recent call last) 3/content/drive/MyDrive/fairseq-main/examples/hubert/simple_kmeans/dump_mfcc_feature.py in <module> 4 72 logger.info(args) 5 73 6---> 74 main(**vars(args)) 7 88 frames 9/content/drive/MyDrive/fairseq-main/examples/hubert/simple_kmeans/dump_mfcc_feature.py in main(tsv_dir, split, nshard, rank, feat_dir, sample_rate) 10 56 reader = MfccFeatureReader(sample_rate) 11 57 generator, num = get_path_iterator(f"{tsv_dir}/{split}.tsv", nshard, rank) 12---> 58 dump_feature(reader, generator, num, split, nshard, rank, feat_dir) 13 59 14 60 15 16/content/drive/MyDrive/fairseq-main/examples/hubert/simple_kmeans/feature_utils.py in dump_feature(reader, generator, num, split, nshard, rank, feat_dir) 17 59 with open(leng_path, "w") as leng_f: 18 60 for path, nsample in tqdm.tqdm(iterator, total=num): 19---> 61 feat = reader.get_feats(path, nsample) 20 62 feat_f.append(feat.cpu().numpy()) 21 63 leng_f.write(f"{len(feat)}\n") 22 23/content/drive/MyDrive/fairseq-main/examples/hubert/simple_kmeans/dump_mfcc_feature.py in get_feats(self, path, ref_len) 24 35 25 36 def get_feats(self, path, ref_len=None): 26---> 37 x = self.read_audio(path, ref_len=ref_len) 27 38 with torch.no_grad(): 28 39 x = torch.from_numpy(x).float() 29 30/content/drive/MyDrive/fairseq-main/examples/hubert/simple_kmeans/dump_mfcc_feature.py in read_audio(self, path, ref_len) 31 29 32 30 def read_audio(self, path, ref_len=None): 33---> 31 wav = get_features_or_waveform(path, need_waveform=True, use_sample_rate=self.sample_rate) 34 32 if ref_len is not None and abs(ref_len - len(wav)) > 160: 35 33 logging.warning(f"ref {ref_len} != read {len(wav)} ({path})") 36 37/usr/local/lib/python3.10/dist-packages/fairseq/data/audio/audio_utils.py in get_features_or_waveform(path, need_waveform, use_sample_rate) 38 166 if len(slice_ptr) == 0: 39 167 if need_waveform: 40--> 168 return get_waveform( 41 169 _path, always_2d=False, output_sample_rate=use_sample_rate 42 170 )[0] 43 44/usr/local/lib/python3.10/dist-packages/fairseq/data/audio/audio_utils.py in get_waveform(path_or_fp, normalization, mono, frames, start, always_2d, output_sample_rate, normalize_volume) 45 100 raise ImportError("Please install soundfile: pip install soundfile") 46 101 47--> 102 waveform, sample_rate = sf.read( 48 103 path_or_fp, dtype="float32", always_2d=True, frames=frames, start=start 49 104 ) 50 51/usr/local/lib/python3.10/dist-packages/soundfile.py in read(file, frames, start, stop, dtype, always_2d, fill_value, out, samplerate, channels, format, subtype, endian, closefd) 52 283 53 284 """ 54--> 285 with SoundFile(file, 'r', samplerate, channels, 55 286 subtype, endian, format, closefd) as f: 56 287 frames = f._prepare_read(start, stop, frames) 57 58/usr/local/lib/python3.10/dist-packages/soundfile.py in __init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd) 59 656 self._info = _create_info_struct(file, mode, samplerate, channels, 60 657 format, subtype, endian) 61--> 658 self._file = self._open(file, mode_int, closefd) 62 659 if set(mode).issuperset('r+') and self.seekable(): 63 660 # Move write position to 0 (like in Python file objects) 64 65/usr/local/lib/python3.10/dist-packages/soundfile.py in _open(self, file, mode_int, closefd) 66 1214 # get the actual error code 67 1215 err = _snd.sf_error(file_ptr) 68-> 1216 raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name)) 69 1217 if mode_int == _snd.SFM_WRITE: 70 1218 # Due to a bug in libsndfile version <= 1.0.25, frames != 0 71 72LibsndfileError: Error opening '/content/drive/MyDrive/HuBERT_DIV/reaction251.wav': System error.

コメントを投稿

0 コメント