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
50c3ba88
Unverified
Commit
50c3ba88
authored
Aug 06, 2024
by
Chris Toukmaji
Committed by
GitHub
Aug 06, 2024
Browse files
Documentation: BOS token_id deprecation change for NLLB (#32443)
Update nllb.md
parent
194cf1f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
docs/source/en/model_doc/nllb.md
docs/source/en/model_doc/nllb.md
+4
-4
No files found.
docs/source/en/model_doc/nllb.md
View file @
50c3ba88
...
...
@@ -101,7 +101,7 @@ for the list of all BCP-47 in the Flores 200 dataset.
>>> inputs = tokenizer(article, return_tensors="pt")
>>> translated_tokens = model.generate(
...
**
inputs, forced_bos_token_id=tokenizer.
lang_code
_to_id
[
"fra_Latn"
]
, max_length=30
...
**
inputs, forced_bos_token_id=tokenizer.
convert_tokens
_to_id
s(
"fra_Latn"
)
, max_length=30
... )
>>> tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
Le chef de l'ONU dit qu'il n'y a pas de solution militaire en Syrie
...
...
@@ -126,7 +126,7 @@ See example below for a translation from romanian to german:
>>> inputs = tokenizer(article, return_tensors="pt")
>>> translated_tokens = model.generate(
...
**
inputs, forced_bos_token_id=tokenizer.
lang_code
_to_id
[
"deu_Latn"
]
, max_length=30
...
**
inputs, forced_bos_token_id=tokenizer.
convert_tokens
_to_id
s(
"deu_Latn"
)
, max_length=30
... )
>>> tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
UN-Chef sagt, es gibt keine militärische Lösung in Syrien
...
...
@@ -175,7 +175,7 @@ To load a model using Flash Attention 2, we can pass the argument `attn_implemen
>>> inputs = tokenizer(article, return_tensors="pt").to("cuda")
>>> translated_tokens = model.generate(
...
**
inputs, forced_bos_token_id=tokenizer.
lang_code
_to_id
[
"deu_Latn"
]
, max_length=30
...
**
inputs, forced_bos_token_id=tokenizer.
convert_tokens
_to_id
s(
"deu_Latn"
)
, max_length=30
... )
>>> tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
"UN-Chef sagt, es gibt keine militärische Lösung in Syrien"
...
...
@@ -187,4 +187,4 @@ Below is an expected speedup diagram that compares pure inference time between t
<div style="text-align: center">
<img src="https://huggingface.co/datasets/visheratin/documentation-images/resolve/main/nllb-speedup.webp">
</div>
\ No newline at end of file
</div>
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