Skip to content

Commit bde42d3

Browse files
committed
fix graceful import
1 parent da2577c commit bde42d3

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

encoding/features/speech_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def _pool_time(self, x: torch.Tensor) -> torch.Tensor:
119119
return x[0, -1, :] if self.pool == "last" else x[0].mean(dim=0)
120120

121121
def _load_and_resample(self, wav_path: str) -> torch.Tensor:
122+
torchaudio = import_torchaudio_gracefully()
122123
wav, sr = torchaudio.load(wav_path)
123124
if wav.shape[0] != 1:
124125
wav = wav.mean(0, keepdim=True)

0 commit comments

Comments
 (0)