polodealvarado commited on
Commit
99abccf
1 Parent(s): 2485928

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -59,7 +59,7 @@ def remove_extra_chars(batch):
59
  # Preparing dataset
60
  def prepare_dataset(batch):
61
  audio = batch["audio"]
62
- batch["input_values"] = processor(audio["array"], sampling_rate=audio["sampling_rate"]).input_values[0]
63
  with processor.as_target_processor():
64
  batch["labels"] = processor(batch["sentence"]).input_ids
65
  return batch
@@ -72,10 +72,10 @@ common_voice_test = common_voice_test.map(remove_extra_chars, remove_columns=dat
72
  common_voice_test = common_voice_test.map(prepare_dataset)
73
 
74
  # Testing first sample
75
- input = common_voice_test["input_values"]
76
 
77
  with torch.no_grad():
78
- logits = model(**inputs).logits
79
 
80
  pred_ids = torch.argmax(logits, dim=-1)
81
  text = processor.batch_decode(logits.numpy()).text
 
59
  # Preparing dataset
60
  def prepare_dataset(batch):
61
  audio = batch["audio"]
62
+ batch["input_values"] = processor(audio["array"], sampling_rate=audio["sampling_rate"],return_tensors="pt",padding=True).input_values[0]
63
  with processor.as_target_processor():
64
  batch["labels"] = processor(batch["sentence"]).input_ids
65
  return batch
 
72
  common_voice_test = common_voice_test.map(prepare_dataset)
73
 
74
  # Testing first sample
75
+ inputs = torch_tensor(common_voice_test[0]["input_values"])
76
 
77
  with torch.no_grad():
78
+ logits = model(inputs).logits
79
 
80
  pred_ids = torch.argmax(logits, dim=-1)
81
  text = processor.batch_decode(logits.numpy()).text