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
1d2b57b8
Unverified
Commit
1d2b57b8
authored
Jun 01, 2022
by
Yih-Dar
Committed by
GitHub
Jun 01, 2022
Browse files
Fix CTRL tests (#17508)
* fix Co-authored-by:
ydshieh
<
ydshieh@users.noreply.github.com
>
parent
693720e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tests/models/ctrl/test_modeling_ctrl.py
tests/models/ctrl/test_modeling_ctrl.py
+13
-0
No files found.
tests/models/ctrl/test_modeling_ctrl.py
View file @
1d2b57b8
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
gc
import
unittest
from
transformers
import
CTRLConfig
,
is_torch_available
...
...
@@ -181,6 +182,12 @@ class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
self
.
model_tester
=
CTRLModelTester
(
self
)
self
.
config_tester
=
ConfigTester
(
self
,
config_class
=
CTRLConfig
,
n_embd
=
37
)
def
tearDown
(
self
):
super
().
tearDown
()
# clean-up as much as possible GPU memory occupied by PyTorch
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
def
test_config
(
self
):
self
.
config_tester
.
run_common_tests
()
...
...
@@ -201,6 +208,12 @@ class CTRLModelTest(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase):
@
require_torch
class
CTRLModelLanguageGenerationTest
(
unittest
.
TestCase
):
def
tearDown
(
self
):
super
().
tearDown
()
# clean-up as much as possible GPU memory occupied by PyTorch
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
@
slow
def
test_lm_generate_ctrl
(
self
):
model
=
CTRLLMHeadModel
.
from_pretrained
(
"ctrl"
)
...
...
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