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
63517fdf
Unverified
Commit
63517fdf
authored
May 11, 2022
by
Suraj Patil
Committed by
GitHub
May 11, 2022
Browse files
[M2M100 doc] remove duplicate example (#17175)
* remove duplicate example * remove code block
parent
4a419d49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
17 deletions
+2
-17
src/transformers/models/m2m_100/modeling_m2m_100.py
src/transformers/models/m2m_100/modeling_m2m_100.py
+2
-17
No files found.
src/transformers/models/m2m_100/modeling_m2m_100.py
View file @
63517fdf
...
@@ -565,7 +565,7 @@ M2M_100_START_DOCSTRING = r"""
...
@@ -565,7 +565,7 @@ M2M_100_START_DOCSTRING = r"""
"""
"""
M2M_100_GENERATION_EXAMPLE
=
r
"""
M2M_100_GENERATION_EXAMPLE
=
r
"""
Translation example:
:
Translation example:
```python
```python
>>> from transformers import M2M100Tokenizer, M2M100ForConditionalGeneration
>>> from transformers import M2M100Tokenizer, M2M100ForConditionalGeneration
...
@@ -1299,22 +1299,7 @@ class M2M100ForConditionalGeneration(M2M100PreTrainedModel):
...
@@ -1299,22 +1299,7 @@ class M2M100ForConditionalGeneration(M2M100PreTrainedModel):
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
Returns:
Returns:
"""
Example:
```python
>>> from transformers import M2M100Tokenizer, M2M100ForConditionalGeneration
>>> model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
>>> tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
>>> text_to_translate = "Life is like a box of chocolates"
>>> model_inputs = tokenizer(text_to_translate, return_tensors="pt")
>>> # translate to French
>>> gen_tokens = model.generate(**model_inputs, forced_bos_token_id=tokenizer.get_lang_id("fr"))
>>> print(tokenizer.batch_decode(gen_tokens, skip_special_tokens=True))
```"""
return_dict
=
return_dict
if
return_dict
is
not
None
else
self
.
config
.
use_return_dict
return_dict
=
return_dict
if
return_dict
is
not
None
else
self
.
config
.
use_return_dict
if
labels
is
not
None
:
if
labels
is
not
None
:
...
...
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