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
847b47c0
Unverified
Commit
847b47c0
authored
Jun 09, 2023
by
Yih-Dar
Committed by
GitHub
Jun 09, 2023
Browse files
Fix XGLM OOM on CI (#24123)
fix Co-authored-by:
ydshieh
<
ydshieh@users.noreply.github.com
>
parent
b8fe259f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
tests/models/xglm/test_modeling_tf_xglm.py
tests/models/xglm/test_modeling_tf_xglm.py
+6
-0
tests/models/xglm/test_modeling_xglm.py
tests/models/xglm/test_modeling_xglm.py
+7
-0
No files found.
tests/models/xglm/test_modeling_tf_xglm.py
View file @
847b47c0
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
from
__future__
import
annotations
from
__future__
import
annotations
import
gc
import
unittest
import
unittest
from
transformers
import
XGLMConfig
,
XGLMTokenizer
,
is_tf_available
from
transformers
import
XGLMConfig
,
XGLMTokenizer
,
is_tf_available
...
@@ -190,6 +191,11 @@ class TFXGLMModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCase
...
@@ -190,6 +191,11 @@ class TFXGLMModelTest(TFModelTesterMixin, PipelineTesterMixin, unittest.TestCase
@
require_tf
@
require_tf
class
TFXGLMModelLanguageGenerationTest
(
unittest
.
TestCase
):
class
TFXGLMModelLanguageGenerationTest
(
unittest
.
TestCase
):
def
tearDown
(
self
):
super
().
tearDown
()
# clean-up as much as possible GPU memory occupied by PyTorch
gc
.
collect
()
@
slow
@
slow
def
test_lm_generate_xglm
(
self
,
verify_outputs
=
True
):
def
test_lm_generate_xglm
(
self
,
verify_outputs
=
True
):
model
=
TFXGLMForCausalLM
.
from_pretrained
(
"facebook/xglm-564M"
)
model
=
TFXGLMForCausalLM
.
from_pretrained
(
"facebook/xglm-564M"
)
...
...
tests/models/xglm/test_modeling_xglm.py
View file @
847b47c0
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
# limitations under the License.
# limitations under the License.
import
datetime
import
datetime
import
gc
import
math
import
math
import
unittest
import
unittest
...
@@ -349,6 +350,12 @@ class XGLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
...
@@ -349,6 +350,12 @@ class XGLMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin
@
require_torch
@
require_torch
class
XGLMModelLanguageGenerationTest
(
unittest
.
TestCase
):
class
XGLMModelLanguageGenerationTest
(
unittest
.
TestCase
):
def
tearDown
(
self
):
super
().
tearDown
()
# clean-up as much as possible GPU memory occupied by PyTorch
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
def
_test_lm_generate_xglm_helper
(
def
_test_lm_generate_xglm_helper
(
self
,
self
,
gradient_checkpointing
=
False
,
gradient_checkpointing
=
False
,
...
...
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