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
4390151b
Unverified
Commit
4390151b
authored
Jun 01, 2022
by
Sylvain Gugger
Committed by
GitHub
Jun 01, 2022
Browse files
Fix MP and CPU offload tests for Funnel and GPT-Neo (#17503)
parent
6813439f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
tests/test_modeling_common.py
tests/test_modeling_common.py
+15
-6
No files found.
tests/test_modeling_common.py
View file @
4390151b
...
...
@@ -2217,9 +2217,12 @@ class ModelTesterMixin:
@
require_accelerate
@
require_torch_gpu
def
test_disk_offload
(
self
):
if
all
([
model_class
.
_no_split_modules
is
None
for
model_class
in
self
.
all_model_classes
]):
return
config
,
inputs_dict
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
5
:
config
.
num_hidden_layers
=
5
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
4
:
config
.
num_hidden_layers
=
4
for
model_class
in
self
.
all_model_classes
:
if
model_class
.
_no_split_modules
is
None
:
...
...
@@ -2253,9 +2256,12 @@ class ModelTesterMixin:
@
require_accelerate
@
require_torch_gpu
def
test_cpu_offload
(
self
):
if
all
([
model_class
.
_no_split_modules
is
None
for
model_class
in
self
.
all_model_classes
]):
return
config
,
inputs_dict
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
5
:
config
.
num_hidden_layers
=
5
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
4
:
config
.
num_hidden_layers
=
4
for
model_class
in
self
.
all_model_classes
:
if
model_class
.
_no_split_modules
is
None
:
...
...
@@ -2286,9 +2292,12 @@ class ModelTesterMixin:
@
require_accelerate
@
require_torch_multi_gpu
def
test_model_parallelism
(
self
):
if
all
([
model_class
.
_no_split_modules
is
None
for
model_class
in
self
.
all_model_classes
]):
return
config
,
inputs_dict
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
5
:
config
.
num_hidden_layers
=
5
if
isinstance
(
getattr
(
config
,
"num_hidden_layers"
,
None
),
int
)
and
config
.
num_hidden_layers
<
4
:
config
.
num_hidden_layers
=
4
for
model_class
in
self
.
all_model_classes
:
if
model_class
.
_no_split_modules
is
None
:
...
...
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