Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
055ed78f
Unverified
Commit
055ed78f
authored
Mar 11, 2021
by
Suraj Patil
Committed by
GitHub
Mar 11, 2021
Browse files
[S2T] fix example in docs (#10667)
parent
89693e17
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
docs/source/model_doc/speech_to_text.rst
docs/source/model_doc/speech_to_text.rst
+4
-4
No files found.
docs/source/model_doc/speech_to_text.rst
View file @
055ed78f
...
@@ -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
_feature
s = 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
_feature
s = 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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment