Spaces:
Running
Running
call supers
Browse files
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: Speech analysis
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
|
|
|
| 1 |
---
|
| 2 |
title: Speech analysis
|
| 3 |
+
emoji:
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: gray
|
| 6 |
sdk: gradio
|
app.py
CHANGED
|
@@ -89,15 +89,13 @@ def _forward(
|
|
| 89 |
hidden_states, mask_time_indices=mask_time_indices, attention_mask=attention_mask
|
| 90 |
)
|
| 91 |
|
| 92 |
-
|
| 93 |
hidden_states,
|
| 94 |
attention_mask=attention_mask,
|
| 95 |
output_attentions=output_attentions,
|
| 96 |
output_hidden_states=output_hidden_states,
|
| 97 |
return_dict=return_dict,
|
| 98 |
-
)
|
| 99 |
-
|
| 100 |
-
hidden_states = encoder_outputs[0]
|
| 101 |
|
| 102 |
if self.adapter is not None:
|
| 103 |
raise ValueError
|
|
@@ -111,29 +109,27 @@ def _forward_and_cnn7(
|
|
| 111 |
input_values,
|
| 112 |
attention_mask=None):
|
| 113 |
|
| 114 |
-
frozen_cnn7 = self.feature_extractor(input_values)
|
| 115 |
frozen_cnn7 = frozen_cnn7.transpose(1, 2)
|
| 116 |
|
| 117 |
if attention_mask is not None:
|
| 118 |
# compute reduced attention_mask corresponding to feature vectors
|
| 119 |
-
attention_mask = self._get_feature_vector_attention_mask(
|
| 120 |
frozen_cnn7.shape[1], attention_mask, add_adapter=False
|
| 121 |
)
|
| 122 |
|
| 123 |
-
hidden_states, _ = self.feature_projection(frozen_cnn7) # grad=True non frozen
|
| 124 |
-
hidden_states = self._mask_hidden_states(
|
| 125 |
hidden_states, mask_time_indices=mask_time_indices, attention_mask=attention_mask
|
| 126 |
)
|
| 127 |
|
| 128 |
-
|
| 129 |
hidden_states,
|
| 130 |
attention_mask=attention_mask,
|
| 131 |
output_attentions=output_attentions,
|
| 132 |
output_hidden_states=output_hidden_states,
|
| 133 |
return_dict=return_dict,
|
| 134 |
-
)
|
| 135 |
-
|
| 136 |
-
hidden_states = encoder_outputs[0]
|
| 137 |
|
| 138 |
if self.adapter is not None:
|
| 139 |
raise ValueError
|
|
|
|
| 89 |
hidden_states, mask_time_indices=mask_time_indices, attention_mask=attention_mask
|
| 90 |
)
|
| 91 |
|
| 92 |
+
hidden_states = self.wav2vec2.encoder(
|
| 93 |
hidden_states,
|
| 94 |
attention_mask=attention_mask,
|
| 95 |
output_attentions=output_attentions,
|
| 96 |
output_hidden_states=output_hidden_states,
|
| 97 |
return_dict=return_dict,
|
| 98 |
+
)[0]
|
|
|
|
|
|
|
| 99 |
|
| 100 |
if self.adapter is not None:
|
| 101 |
raise ValueError
|
|
|
|
| 109 |
input_values,
|
| 110 |
attention_mask=None):
|
| 111 |
|
| 112 |
+
frozen_cnn7 = self.wav2vec2.feature_extractor(input_values)
|
| 113 |
frozen_cnn7 = frozen_cnn7.transpose(1, 2)
|
| 114 |
|
| 115 |
if attention_mask is not None:
|
| 116 |
# compute reduced attention_mask corresponding to feature vectors
|
| 117 |
+
attention_mask = self.wav2vec2._get_feature_vector_attention_mask(
|
| 118 |
frozen_cnn7.shape[1], attention_mask, add_adapter=False
|
| 119 |
)
|
| 120 |
|
| 121 |
+
hidden_states, _ = self.wav2vec2.feature_projection(frozen_cnn7) # grad=True non frozen
|
| 122 |
+
hidden_states = self.wav2vec2._mask_hidden_states(
|
| 123 |
hidden_states, mask_time_indices=mask_time_indices, attention_mask=attention_mask
|
| 124 |
)
|
| 125 |
|
| 126 |
+
hidden_states = self.wav2vec2.encoder(
|
| 127 |
hidden_states,
|
| 128 |
attention_mask=attention_mask,
|
| 129 |
output_attentions=output_attentions,
|
| 130 |
output_hidden_states=output_hidden_states,
|
| 131 |
return_dict=return_dict,
|
| 132 |
+
)[0]
|
|
|
|
|
|
|
| 133 |
|
| 134 |
if self.adapter is not None:
|
| 135 |
raise ValueError
|