Fix typo in example (#12716)

This commit is contained in:
Will Rice 2021-07-15 02:44:03 -04:00 committed by GitHub
parent 8244c5ad4f
commit 6fb58d30b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1283,7 +1283,7 @@ class Speech2TextForConditionalGeneration(Speech2TextPreTrainedModel):
>>> import soundfile as sf
>>> model = Speech2TextForConditionalGeneration.from_pretrained("facebook/s2t-small-librispeech-asr")
>>> processor = Speech2Textprocessor.from_pretrained("facebook/s2t-small-librispeech-asr")
>>> processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
>>> def map_to_array(batch):
>>> speech, _ = sf.read(batch["file"])
@ -1293,7 +1293,7 @@ class Speech2TextForConditionalGeneration(Speech2TextPreTrainedModel):
>>> ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
>>> ds = ds.map(map_to_array)
>>> input_features = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt").input_features # Batch size 1
>>> input_features = processor(ds["speech"][0], sampling_rate=16000, return_tensors="pt").input_features # Batch size 1
>>> generated_ids = model.generate(input_ids=input_features)
>>> transcription = processor.batch_decode(generated_ids)