mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
parent
72ec2f3eb5
commit
a57d784df5
@ -210,7 +210,7 @@ class Speech2TextFeatureExtractor(SequenceFeatureExtractor):
|
||||
raw_speech = [np.asarray(speech) for speech in raw_speech]
|
||||
elif not is_batched and not isinstance(raw_speech, np.ndarray):
|
||||
raw_speech = np.asarray(raw_speech)
|
||||
elif isinstance(raw_speech, np.ndarray) and raw_speech.dtype is np.float64:
|
||||
elif isinstance(raw_speech, np.ndarray) and raw_speech.dtype is np.dtype(np.float64):
|
||||
raw_speech = raw_speech.astype(np.float32)
|
||||
|
||||
# always return batch
|
||||
|
@ -207,10 +207,10 @@ class Wav2Vec2FeatureExtractor(SequenceFeatureExtractor):
|
||||
elif (
|
||||
not isinstance(input_values, np.ndarray)
|
||||
and isinstance(input_values[0], np.ndarray)
|
||||
and input_values[0].dtype is np.float64
|
||||
and input_values[0].dtype is np.dtype(np.float64)
|
||||
):
|
||||
padded_inputs["input_values"] = [array.astype(np.float32) for array in input_values]
|
||||
elif isinstance(input_values, np.ndarray) and input_values.dtype is np.float64:
|
||||
elif isinstance(input_values, np.ndarray) and input_values.dtype is np.dtype(np.float64):
|
||||
padded_inputs["input_values"] = input_values.astype(np.float32)
|
||||
|
||||
# convert attention_mask to correct format
|
||||
|
Loading…
Reference in New Issue
Block a user