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
41cd52a7
"tests/vscode:/vscode.git/clone" did not exist on "cec773345aeffce3c04e8891303a3f748de7141e"
Unverified
Commit
41cd52a7
authored
Sep 08, 2021
by
Mohan Zhang
Committed by
GitHub
Sep 08, 2021
Browse files
fixed document (#13414)
parent
330d83fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
docs/source/main_classes/trainer.rst
docs/source/main_classes/trainer.rst
+2
-2
No files found.
docs/source/main_classes/trainer.rst
View file @
41cd52a7
...
...
@@ -64,9 +64,9 @@ classification:
class MultilabelTrainer(Trainer):
def compute_loss(self, model, inputs, return_outputs=False):
labels = inputs.
pop
("labels")
labels = inputs.
get
("labels")
outputs = model(**inputs)
logits = outputs.logits
logits = outputs.
get('
logits
')
loss_fct = nn.BCEWithLogitsLoss()
loss = loss_fct(logits.view(-1, self.model.config.num_labels),
labels.float().view(-1, self.model.config.num_labels))
...
...
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