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
e3d2bee8
"...git@developer.sourcefind.cn:chenpangpang/diffusers.git" did not exist on "342c5c02c0a12f8b0b2b180cea72178f5448b402"
Unverified
Commit
e3d2bee8
authored
Oct 19, 2020
by
Patrick von Platen
Committed by
GitHub
Oct 19, 2020
Browse files
fix t5 training docstring (#7911)
parent
df1ddced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
docs/source/model_doc/t5.rst
docs/source/model_doc/t5.rst
+6
-6
No files found.
docs/source/model_doc/t5.rst
View file @
e3d2bee8
...
@@ -62,10 +62,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash
...
@@ -62,10 +62,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash
.. code-block::
.. code-block::
input_ids = tokenizer
.encode
('The <extra_id_0> walks in <extra_id_1> park', return_tensors='pt')
input_ids = tokenizer('The <extra_id_0> walks in <extra_id_1> park', return_tensors='pt')
.input_ids
labels = tokenizer
.encode
('<extra_id_0> cute dog <extra_id_1> the <extra_id_2>
</s>
', return_tensors='pt')
labels = tokenizer('<extra_id_0> cute dog <extra_id_1> the <extra_id_2>', return_tensors='pt')
.input_ids
# the forward function automatically creates the correct decoder_input_ids
# the forward function automatically creates the correct decoder_input_ids
model(input_ids=input_ids, labels=labels
)
loss =
model(input_ids=input_ids, labels=labels
, return_dict=True).loss
- Supervised training
- Supervised training
...
@@ -75,10 +75,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash
...
@@ -75,10 +75,10 @@ token. T5 can be trained / fine-tuned both in a supervised and unsupervised fash
.. code-block::
.. code-block::
input_ids = tokenizer
.encode
('translate English to German: The house is wonderful.
</s>
', return_tensors='pt')
input_ids = tokenizer('translate English to German: The house is wonderful.', return_tensors='pt')
.input_ids
labels = tokenizer
.encode
('Das Haus ist wunderbar.
</s>
', return_tensors='pt')
labels = tokenizer('Das Haus ist wunderbar.', return_tensors='pt')
.input_ids
# the forward function automatically creates the correct decoder_input_ids
# the forward function automatically creates the correct decoder_input_ids
model(input_ids=input_ids, labels=labels
)
loss =
model(input_ids=input_ids, labels=labels
, return_dict=True).loss
T5Config
T5Config
...
...
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