mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-06-25 18:11:17 +08:00
gpu featurization (#824)
This commit is contained in:
parent
4872727f14
commit
c5da302fc4
@ -151,8 +151,6 @@ def log_mel_spectrogram(
|
|||||||
mx.array, shape = (80, n_frames)
|
mx.array, shape = (80, n_frames)
|
||||||
An array that contains the Mel spectrogram
|
An array that contains the Mel spectrogram
|
||||||
"""
|
"""
|
||||||
device = mx.default_device()
|
|
||||||
mx.set_default_device(mx.cpu)
|
|
||||||
if isinstance(audio, str):
|
if isinstance(audio, str):
|
||||||
audio = load_audio(audio)
|
audio = load_audio(audio)
|
||||||
elif not isinstance(audio, mx.array):
|
elif not isinstance(audio, mx.array):
|
||||||
@ -170,5 +168,4 @@ def log_mel_spectrogram(
|
|||||||
log_spec = mx.maximum(mel_spec, 1e-10).log10()
|
log_spec = mx.maximum(mel_spec, 1e-10).log10()
|
||||||
log_spec = mx.maximum(log_spec, log_spec.max() - 8.0)
|
log_spec = mx.maximum(log_spec, log_spec.max() - 8.0)
|
||||||
log_spec = (log_spec + 4.0) / 4.0
|
log_spec = (log_spec + 4.0) / 4.0
|
||||||
mx.set_default_device(device)
|
|
||||||
return log_spec
|
return log_spec
|
||||||
|
Loading…
Reference in New Issue
Block a user