File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
keras_hub/src/models/whisper Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 1
1
import keras .ops as ops
2
- import numpy as np
3
2
import tensorflow as tf
4
3
5
4
from keras_hub .src .api_export import keras_hub_export
@@ -157,7 +156,7 @@ def _extract_audio_features(self, audio):
157
156
[0 , 0 ],
158
157
[self .num_fft_bins // 2 , self .num_fft_bins // 2 ],
159
158
],
160
- mode = "REFLECT " ,
159
+ mode = "reflect " ,
161
160
)
162
161
# Compute the mel spectrogram.
163
162
stft = ops .stft (
@@ -168,10 +167,7 @@ def _extract_audio_features(self, audio):
168
167
center = False ,
169
168
)
170
169
stft = ops .sum (stft , axis = 0 )
171
- # magnitudes = ops.square(ops.absolute(stft)
172
170
magnitudes = ops .square (ops .absolute (stft [:, :- 1 , :]))
173
- # magnitudes = ops.square(ops.sqrt(ops.square(stft_real) + ops.square(stft_imag)))
174
- # mel_filters_casted = ops.cast(self.mel_filters, dtype=magnitudes.dtype)
175
171
176
172
mel_spec = ops .matmul (
177
173
magnitudes ,
@@ -230,7 +226,7 @@ def call(self, audio):
230
226
audio = tf .RaggedTensor .from_tensor (audio )
231
227
232
228
# Pad audio.
233
- audio_shape = audio .shape . as_list ( )
229
+ audio_shape = list ( audio .shape )
234
230
audio_shape [- 1 ] = self .num_samples
235
231
audio = audio .to_tensor (shape = audio_shape )
236
232
You can’t perform that action at this time.
0 commit comments