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
2403dbd6
Unverified
Commit
2403dbd6
authored
Oct 04, 2022
by
Partho
Committed by
GitHub
Oct 04, 2022
Browse files
wrap forward passes with torch.no_grad() (#19278)
parent
f134d385
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
tests/models/deberta_v2/test_modeling_deberta_v2.py
tests/models/deberta_v2/test_modeling_deberta_v2.py
+2
-1
No files found.
tests/models/deberta_v2/test_modeling_deberta_v2.py
View file @
2403dbd6
...
...
@@ -299,7 +299,8 @@ class DebertaV2ModelIntegrationTest(unittest.TestCase):
input_ids
=
torch
.
tensor
([[
0
,
31414
,
232
,
328
,
740
,
1140
,
12695
,
69
,
46078
,
1588
,
2
]])
attention_mask
=
torch
.
tensor
([[
0
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]])
output
=
model
(
input_ids
,
attention_mask
=
attention_mask
)[
0
]
with
torch
.
no_grad
():
output
=
model
(
input_ids
,
attention_mask
=
attention_mask
)[
0
]
# compare the actual values for a slice.
expected_slice
=
torch
.
tensor
(
[[[
0.2356
,
0.1948
,
0.0369
],
[
-
0.1063
,
0.3586
,
-
0.5152
],
[
-
0.6399
,
-
0.0259
,
-
0.2525
]]]
...
...
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