Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
Show 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.
...
@@ -101,7 +101,7 @@ for the list of all BCP-47 in the Flores 200 dataset.
>>> inputs = tokenizer(article, return_tensors="pt")
>>> inputs = tokenizer(article, return_tensors="pt")
>>> translated_tokens = model.generate(
>>> 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]
>>> 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
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:
...
@@ -126,7 +126,7 @@ See example below for a translation from romanian to german:
>>> inputs = tokenizer(article, return_tensors="pt")
>>> inputs = tokenizer(article, return_tensors="pt")
>>> translated_tokens = model.generate(
>>> 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]
>>> tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
UN-Chef sagt, es gibt keine militärische Lösung in Syrien
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
...
@@ -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")
>>> inputs = tokenizer(article, return_tensors="pt").to("cuda")
>>> translated_tokens = model.generate(
>>> 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]
>>> tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
"UN-Chef sagt, es gibt keine militärische Lösung in Syrien"
"UN-Chef sagt, es gibt keine militärische Lösung in Syrien"
...
...
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