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
ed6ba939
Commit
ed6ba939
authored
Dec 19, 2019
by
patrickvonplaten
Committed by
Lysandre Debut
Dec 19, 2019
Browse files
corrected typo in example for t5 model input argument
parent
8efc6dd5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
transformers/modeling_t5.py
transformers/modeling_t5.py
+2
-2
transformers/modeling_tf_t5.py
transformers/modeling_tf_t5.py
+2
-2
No files found.
transformers/modeling_t5.py
View file @
ed6ba939
...
...
@@ -693,7 +693,7 @@ class T5Model(T5PreTrainedModel):
tokenizer = T5Tokenizer.from_pretrained('t5-small')
model = T5Model.from_pretrained('t5-small')
input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute")).unsqueeze(0) # Batch size 1
outputs = model(input_ids)
outputs = model(input_ids
=input_ids
)
last_hidden_states = outputs[0] # The last hidden-state is the first element of the output tuple
"""
...
...
@@ -798,7 +798,7 @@ class T5WithLMHeadModel(T5PreTrainedModel):
tokenizer = T5Tokenizer.from_pretrained('t5-small')
model = T5WithLMHeadModel.from_pretrained('t5-small')
input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute")).unsqueeze(0) # Batch size 1
outputs = model(input_ids, lm_labels=input_ids)
outputs = model(input_ids
=input_ids
, lm_labels=input_ids)
loss, prediction_scores = outputs[:2]
"""
...
...
transformers/modeling_tf_t5.py
View file @
ed6ba939
...
...
@@ -610,7 +610,7 @@ class TFT5Model(TFT5PreTrainedModel):
tokenizer = T5Tokenizer.from_pretrained('t5-small')
model = TFT5Model.from_pretrained('t5-small')
input_ids = tf.constant(tokenizer.encode("Hello, my dog is cute"))[None, :] # Batch size 1
outputs = model(input_ids)
outputs = model(input_ids
=input_ids
)
last_hidden_states = outputs[0] # The last hidden-state is the first element of the output tuple
"""
...
...
@@ -701,7 +701,7 @@ class TFT5WithLMHeadModel(TFT5PreTrainedModel):
tokenizer = T5Tokenizer.from_pretrained('t5-small')
model = TFT5WithLMHeadModel.from_pretrained('t5-small')
input_ids = tf.constant(tokenizer.encode("Hello, my dog is cute"))[None, :] # Batch size 1
outputs = model(input_ids)
outputs = model(input_ids
=input_ids
)
prediction_scores = outputs[0]
"""
...
...
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