You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calculating pesq for a batch, if an exception is thrown for a single audio in that batch, error thrown for entire batch.
To Reproduce
Steps to reproduce the behavior...
Code sample & error trace
# Ideally attach a minimal code sample to reproduce the decried issue.# Minimal means having the shortest code but still preserving the bug.importtorchfromtorchmetrics.audioimportPerceptualEvaluationSpeechQualitytorch.manual_seed(42)
torch.cuda.manual_seed_all(42)
if__name__=="__main__":
preds=torch.randn(32, 16000*10)
target=torch.randn(32, 16000*10)
wb_pesq=PerceptualEvaluationSpeechQuality(16000, 'wb',2)
print(wb_pesq(preds, target))
Error trace
Traceback (most recent call last):
File "/data/veera/zspeech/temp/sample.py", line 11, in <module>
print(wb_pesq(preds, target))
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torchmetrics/metric.py", line 311, in forward
self._forward_cache = self._forward_reduce_state_update(*args, **kwargs)
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torchmetrics/metric.py", line 380, in _forward_reduce_state_update
self.update(*args, **kwargs)
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torchmetrics/metric.py", line 482, in wrapped_func
update(*args, **kwargs)
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torchmetrics/audio/pesq.py", line 124, in update
pesq_batch = perceptual_evaluation_speech_quality(
File "/home/veera/anaconda3/envs/zspeech/lib/python3.10/site-packages/torchmetrics/functional/audio/pesq.py", line 108, in perceptual_evaluation_speech_quality
pesq_val = torch.from_numpy(pesq_val_np)
TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
when converting the above the pesq_val_np to tensor, error is thrown. (above mentioned error trace)
either it can be replaced with 0 or with average value.
Expected behavior
Error handling
Environment
TorchMetrics version 1.4.0.post0
Python 3.10.6 & torch 2.0.0
Additional context
If an audio file encountered an error and dont have pesq value, then replacing it with 0 may affect the overall batch score, what could be the best solution ?
The text was updated successfully, but these errors were encountered:
🐛 Bug
When calculating pesq for a batch, if an exception is thrown for a single audio in that batch, error thrown for entire batch.
To Reproduce
Steps to reproduce the behavior...
Code sample & error trace
pesq_val_np
holds the value as belowpesq_val_np
to tensor, error is thrown. (above mentioned error trace)Expected behavior
Environment
Additional context
The text was updated successfully, but these errors were encountered: