camparchimedes commited on
Commit
e8e4ced
·
verified ·
1 Parent(s): 6e9c279

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
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[input_features == processor.tokenizer.pad_token_id] = 0
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