Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
diffusers
Commits
484c8ef3
Unverified
Commit
484c8ef3
authored
Mar 26, 2024
by
Sayak Paul
Committed by
GitHub
Mar 26, 2024
Browse files
[tests] skip dynamo tests when python is 3.12. (#7458)
skip dynamo tests when python is 3.12.
parent
0dd05288
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
src/diffusers/utils/testing_utils.py
src/diffusers/utils/testing_utils.py
+7
-2
tests/models/test_modeling_common.py
tests/models/test_modeling_common.py
+5
-0
tests/pipelines/controlnet/test_controlnet.py
tests/pipelines/controlnet/test_controlnet.py
+5
-0
tests/pipelines/test_pipelines.py
tests/pipelines/test_pipelines.py
+5
-0
No files found.
src/diffusers/utils/testing_utils.py
View file @
484c8ef3
...
...
@@ -339,10 +339,15 @@ def deprecate_after_peft_backend(test_case):
return
unittest
.
skipUnless
(
not
USE_PEFT_BACKEND
,
"test skipped in favor of PEFT backend"
)(
test_case
)
def
require_python39_or_higher
(
test_case
):
def
python39_available
():
def
get_python_version
():
sys_info
=
sys
.
version_info
major
,
minor
=
sys_info
.
major
,
sys_info
.
minor
return
major
,
minor
def
require_python39_or_higher
(
test_case
):
def
python39_available
():
major
,
minor
=
get_python_version
()
return
major
==
3
and
minor
>=
9
return
unittest
.
skipUnless
(
python39_available
(),
"test requires Python 3.9 or higher"
)(
test_case
)
...
...
tests/models/test_modeling_common.py
View file @
484c8ef3
...
...
@@ -34,6 +34,7 @@ from diffusers.training_utils import EMAModel
from
diffusers.utils
import
is_xformers_available
,
logging
from
diffusers.utils.testing_utils
import
(
CaptureLogger
,
get_python_version
,
require_python39_or_higher
,
require_torch_2
,
require_torch_accelerator_with_training
,
...
...
@@ -431,6 +432,10 @@ class ModelTesterMixin:
@
require_python39_or_higher
@
require_torch_2
@
unittest
.
skipIf
(
get_python_version
==
(
3
,
12
),
reason
=
"Torch Dynamo isn't yet supported for Python 3.12."
,
)
def
test_from_save_pretrained_dynamo
(
self
):
init_dict
,
_
=
self
.
prepare_init_args_and_inputs_for_common
()
inputs
=
[
init_dict
,
self
.
model_class
]
...
...
tests/pipelines/controlnet/test_controlnet.py
View file @
484c8ef3
...
...
@@ -35,6 +35,7 @@ from diffusers.pipelines.controlnet.pipeline_controlnet import MultiControlNetMo
from
diffusers.utils.import_utils
import
is_xformers_available
from
diffusers.utils.testing_utils
import
(
enable_full_determinism
,
get_python_version
,
load_image
,
load_numpy
,
numpy_cosine_similarity_distance
,
...
...
@@ -992,6 +993,10 @@ class ControlNetPipelineSlowTests(unittest.TestCase):
@
require_python39_or_higher
@
require_torch_2
@
unittest
.
skipIf
(
get_python_version
==
(
3
,
12
),
reason
=
"Torch Dynamo isn't yet supported for Python 3.12."
,
)
def
test_stable_diffusion_compile
(
self
):
run_test_in_subprocess
(
test_case
=
self
,
target_func
=
_test_stable_diffusion_compile
,
inputs
=
None
)
...
...
tests/pipelines/test_pipelines.py
View file @
484c8ef3
...
...
@@ -66,6 +66,7 @@ from diffusers.utils.testing_utils import (
CaptureLogger
,
enable_full_determinism
,
floats_tensor
,
get_python_version
,
get_tests_dir
,
load_numpy
,
nightly
,
...
...
@@ -1748,6 +1749,10 @@ class PipelineSlowTests(unittest.TestCase):
@
require_python39_or_higher
@
require_torch_2
@
unittest
.
skipIf
(
get_python_version
==
(
3
,
12
),
reason
=
"Torch Dynamo isn't yet supported for Python 3.12."
,
)
def
test_from_save_pretrained_dynamo
(
self
):
run_test_in_subprocess
(
test_case
=
self
,
target_func
=
_test_from_save_pretrained_dynamo
,
inputs
=
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