jonatasgrosman commited on
Commit
b5a7d40
1 Parent(s): 08a76a0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +6 -6
README.md CHANGED
@@ -133,14 +133,14 @@ test_dataset = test_dataset.map(speech_file_to_array_fn)
133
  # Preprocessing the datasets.
134
  # We need to read the audio files as arrays
135
  def evaluate(batch):
136
- \\tinputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
137
 
138
- \\twith torch.no_grad():
139
- \\t\\tlogits = model(inputs.input_values.to(DEVICE), attention_mask=inputs.attention_mask.to(DEVICE)).logits
140
 
141
- \\tpred_ids = torch.argmax(logits, dim=-1)
142
- \\tbatch["pred_strings"] = processor.batch_decode(pred_ids)
143
- \\treturn batch
144
 
145
  result = test_dataset.map(evaluate, batched=True, batch_size=8)
146
 
133
  # Preprocessing the datasets.
134
  # We need to read the audio files as arrays
135
  def evaluate(batch):
136
+ inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
137
 
138
+ with torch.no_grad():
139
+ logits = model(inputs.input_values.to(DEVICE), attention_mask=inputs.attention_mask.to(DEVICE)).logits
140
 
141
+ pred_ids = torch.argmax(logits, dim=-1)
142
+ batch["pred_strings"] = processor.batch_decode(pred_ids)
143
+ return batch
144
 
145
  result = test_dataset.map(evaluate, batched=True, batch_size=8)
146