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
9709ab11
Unverified
Commit
9709ab11
authored
Sep 13, 2023
by
Maria Khalusova
Committed by
GitHub
Sep 13, 2023
Browse files
[docs] last hidden state vs hidden_states[-1] (#26142)
* last hidden state clarification * feedback addressed
parent
e52f1cb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
docs/source/en/main_classes/output.md
docs/source/en/main_classes/output.md
+7
-0
No files found.
docs/source/en/main_classes/output.md
View file @
9709ab11
...
...
@@ -40,6 +40,13 @@ an optional `attentions` attribute. Here we have the `loss` since we passed alon
`hidden_states`
and
`attentions`
because we didn't pass
`output_hidden_states=True`
or
`output_attentions=True`
.
<Tip>
When passing
`output_hidden_states=True`
you may expect the
`outputs.hidden_states[-1]`
to match
`outputs.last_hidden_states`
exactly.
However, this is not always the case. Some models apply normalization or subsequent process to the last hidden state when it's returned.
</Tip>
You can access each attribute as you would usually do, and if that attribute has not been returned by the model, you
will get
`None`
. Here for instance
`outputs.loss`
is the loss computed by the model, and
`outputs.attentions`
is
`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