andreagasparini commited on
Commit
750319d
1 Parent(s): 54074b1

Removes annoying warning: missing "sampling_rate" argument

Browse files

An annoying warning about the missing sampling_rate argument in the processor call was printed at every call of the map_to_pred function.
"It is strongly recommended to pass the ``sampling_rate`` argument to this function. Failing to do so can result in silent errors that might be hard to debug."

Files changed (1) hide show
  1. README.md +1 -1
README.md CHANGED
@@ -102,7 +102,7 @@ model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
102
  processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
103
 
104
  def map_to_pred(batch):
105
- inputs = processor(batch["audio"]["array"], return_tensors="pt", padding="longest")
106
  input_values = inputs.input_values.to("cuda")
107
  attention_mask = inputs.attention_mask.to("cuda")
108
 
 
102
  processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
103
 
104
  def map_to_pred(batch):
105
+ inputs = processor(batch["audio"]["array"], return_tensors="pt", padding="longest", sampling_rate=batch["audio"]["sampling_rate"])
106
  input_values = inputs.input_values.to("cuda")
107
  attention_mask = inputs.attention_mask.to("cuda")
108