Unverified Commit 055ed78f authored by Suraj Patil's avatar Suraj Patil Committed by GitHub
Browse files

[S2T] fix example in docs (#10667)

parent 89693e17
...@@ -68,8 +68,8 @@ be installed as follows: ``apt install libsndfile1-dev`` ...@@ -68,8 +68,8 @@ be installed as follows: ``apt install libsndfile1-dev``
>>> ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation") >>> ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
>>> ds = ds.map(map_to_array) >>> ds = ds.map(map_to_array)
>>> input_features = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt").input_features # Batch size 1 >>> inputs = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt")
>>> generated_ids = model.generate(input_ids=input_features) >>> generated_ids = model.generate(input_ids=inputs["input_features"], attention_mask=inputs["attention_mask])
>>> transcription = processor.batch_decode(generated_ids) >>> transcription = processor.batch_decode(generated_ids)
...@@ -100,8 +100,8 @@ be installed as follows: ``apt install libsndfile1-dev`` ...@@ -100,8 +100,8 @@ be installed as follows: ``apt install libsndfile1-dev``
>>> ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation") >>> ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation")
>>> ds = ds.map(map_to_array) >>> ds = ds.map(map_to_array)
>>> input_features = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt").input_features # Batch size 1 >>> inputs = processor(ds["speech"][0], sampling_rate=16_000, return_tensors="pt")
>>> generated_ids = model.generate(input_ids=input_features, forced_bos_token_id=processor.tokenizer.lang_code_to_id["fr"]) >>> generated_ids = model.generate(input_ids=inputs["input_features"], attention_mask=inputs["attention_mask], forced_bos_token_id=processor.tokenizer.lang_code_to_id["fr"])
>>> translation = processor.batch_decode(generated_ids) >>> translation = processor.batch_decode(generated_ids)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment