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
c6a928ca
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "bcd42c4af909c92da94fd5884989c56db258f12f"
Unverified
Commit
c6a928ca
authored
Oct 11, 2022
by
Partho
Committed by
GitHub
Oct 10, 2022
Browse files
wrap forward passes with torch.no_grad() (#19414)
parent
d739a707
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
tests/models/imagegpt/test_modeling_imagegpt.py
tests/models/imagegpt/test_modeling_imagegpt.py
+2
-1
No files found.
tests/models/imagegpt/test_modeling_imagegpt.py
View file @
c6a928ca
...
@@ -538,7 +538,8 @@ class ImageGPTModelIntegrationTest(unittest.TestCase):
...
@@ -538,7 +538,8 @@ class ImageGPTModelIntegrationTest(unittest.TestCase):
inputs
=
feature_extractor
(
images
=
image
,
return_tensors
=
"pt"
).
to
(
torch_device
)
inputs
=
feature_extractor
(
images
=
image
,
return_tensors
=
"pt"
).
to
(
torch_device
)
# forward pass
# forward pass
outputs
=
model
(
**
inputs
)
with
torch
.
no_grad
():
outputs
=
model
(
**
inputs
)
# verify the logits
# verify the logits
expected_shape
=
torch
.
Size
((
1
,
1024
,
512
))
expected_shape
=
torch
.
Size
((
1
,
1024
,
512
))
...
...
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