Rename the method test_torchscript #16693
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
class ModelTesterMixin
has attributetest_torchscript
as well as method nameddef test_torchscript
.In a few model specific test files, we have
test_torchscript = True
defined, for example,T5ModelTest
:transformers/tests/t5/test_modeling_t5.py
Line 515 in 7c5d799
DistilBertModelTest
:transformers/tests/distilbert/test_modeling_distilbert.py
Line 214 in 7c5d799
This actually makes the
test_torchscript
being a boolean value instead of a method, thereforetest_torchscript
is not run for these places. See the last section for a dummy example.Fix
Although this could be fixed just by removing
test_torchscript = True
, it would be a better idea to rename the methoddef test_torchscript
to something else likedef test_torchscript_simple
.Dummy example (to reproduce the issue)