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
12726f85
Commit
12726f85
authored
Dec 20, 2019
by
Aymeric Augustin
Browse files
Remove redundant torch.jit.trace in tests.
This looks like it could be expensive, so don't run it twice.
parent
ac1b449c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
transformers/tests/modeling_common_test.py
transformers/tests/modeling_common_test.py
+1
-2
No files found.
transformers/tests/modeling_common_test.py
View file @
12726f85
...
@@ -218,12 +218,11 @@ class CommonTestCases:
...
@@ -218,12 +218,11 @@ class CommonTestCases:
inputs
=
inputs_dict
[
'input_ids'
]
# Let's keep only input_ids
inputs
=
inputs_dict
[
'input_ids'
]
# Let's keep only input_ids
try
:
try
:
torch
.
jit
.
trace
(
model
,
inputs
)
traced_gpt2
=
torch
.
jit
.
trace
(
model
,
inputs
)
except
RuntimeError
:
except
RuntimeError
:
self
.
fail
(
"Couldn't trace module."
)
self
.
fail
(
"Couldn't trace module."
)
try
:
try
:
traced_gpt2
=
torch
.
jit
.
trace
(
model
,
inputs
)
torch
.
jit
.
save
(
traced_gpt2
,
"traced_model.pt"
)
torch
.
jit
.
save
(
traced_gpt2
,
"traced_model.pt"
)
except
RuntimeError
:
except
RuntimeError
:
self
.
fail
(
"Couldn't save module."
)
self
.
fail
(
"Couldn't save module."
)
...
...
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