Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -111,8 +111,11 @@ def transcribe_audio(audio_file, chunk_length_s=30):
|
|
111 |
# Create attention mask
|
112 |
attention_mask = torch.ones(inputs.input_features.shape[:2], dtype=torch.long, device=device)
|
113 |
|
|
|
|
|
|
|
114 |
# Set the attention mask to zero for padding tokens
|
115 |
-
attention_mask[
|
116 |
|
117 |
|
118 |
# ASR model inference on the chunk
|
|
|
111 |
# Create attention mask
|
112 |
attention_mask = torch.ones(inputs.input_features.shape[:2], dtype=torch.long, device=device)
|
113 |
|
114 |
+
# input_ids used to set attention_mask to zero for padding tokens
|
115 |
+
input_ids = inputs['input_ids']
|
116 |
+
|
117 |
# Set the attention mask to zero for padding tokens
|
118 |
+
attention_mask[input_ids == processor.tokenizer.pad_token_id] = 0
|
119 |
|
120 |
|
121 |
# ASR model inference on the chunk
|