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
renzhc
diffusers_dcu
Commits
3aa64128
Unverified
Commit
3aa64128
authored
Sep 14, 2023
by
Patrick von Platen
Committed by
GitHub
Sep 14, 2023
Browse files
[Import] Add missing settings / Correct some dummy imports (#5036)
* [Import] Add missing settings * up * up * up
parent
ef29b24f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
26 deletions
+37
-26
src/diffusers/pipelines/stable_diffusion_safe/__init__.py
src/diffusers/pipelines/stable_diffusion_safe/__init__.py
+29
-25
src/diffusers/pipelines/text_to_video_synthesis/__init__.py
src/diffusers/pipelines/text_to_video_synthesis/__init__.py
+2
-0
src/diffusers/pipelines/vq_diffusion/__init__.py
src/diffusers/pipelines/vq_diffusion/__init__.py
+3
-0
src/diffusers/pipelines/wuerstchen/__init__.py
src/diffusers/pipelines/wuerstchen/__init__.py
+3
-1
No files found.
src/diffusers/pipelines/stable_diffusion_safe/__init__.py
View file @
3aa64128
...
@@ -50,13 +50,26 @@ class SafetyConfig(object):
...
@@ -50,13 +50,26 @@ class SafetyConfig(object):
_dummy_objects
=
{}
_dummy_objects
=
{}
_additional_imports
=
{}
_additional_imports
=
{}
_import_structure
=
{
_import_structure
=
{}
"pipeline_output"
:
[
"StableDiffusionSafePipelineOutput"
],
"pipeline_stable_diffusion_safe"
:
[
"StableDiffusionPipelineSafe"
],
"safety_checker"
:
[
"StableDiffusionSafetyChecker"
],
}
_additional_imports
.
update
({
"SafetyConfig"
:
SafetyConfig
})
_additional_imports
.
update
({
"SafetyConfig"
:
SafetyConfig
})
try
:
if
not
(
is_transformers_available
()
and
is_torch_available
()):
raise
OptionalDependencyNotAvailable
()
except
OptionalDependencyNotAvailable
:
from
...utils
import
dummy_torch_and_transformers_objects
_dummy_objects
.
update
(
get_objects_from_module
(
dummy_torch_and_transformers_objects
))
else
:
_import_structure
.
update
(
{
"pipeline_output"
:
[
"StableDiffusionSafePipelineOutput"
],
"pipeline_stable_diffusion_safe"
:
[
"StableDiffusionPipelineSafe"
],
"safety_checker"
:
[
"StableDiffusionSafetyChecker"
],
}
)
if
TYPE_CHECKING
:
if
TYPE_CHECKING
:
try
:
try
:
...
@@ -70,25 +83,16 @@ if TYPE_CHECKING:
...
@@ -70,25 +83,16 @@ if TYPE_CHECKING:
from
.safety_checker
import
SafeStableDiffusionSafetyChecker
from
.safety_checker
import
SafeStableDiffusionSafetyChecker
else
:
else
:
try
:
import
sys
if
not
(
is_transformers_available
()
and
is_torch_available
()):
raise
OptionalDependencyNotAvailable
()
except
OptionalDependencyNotAvailable
:
from
...utils
import
dummy_torch_and_transformers_objects
_dummy_objects
.
update
(
get_objects_from_module
(
dummy_torch_and_transformers_objects
))
else
:
import
sys
sys
.
modules
[
__name__
]
=
_LazyModule
(
sys
.
modules
[
__name__
]
=
_LazyModule
(
__name__
,
__name__
,
globals
()[
"__file__"
],
globals
()[
"__file__"
],
_import_structure
,
_import_structure
,
module_spec
=
__spec__
,
module_spec
=
__spec__
,
)
)
for
name
,
value
in
_dummy_objects
.
items
():
for
name
,
value
in
_dummy_objects
.
items
():
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
for
name
,
value
in
_additional_imports
.
items
():
for
name
,
value
in
_additional_imports
.
items
():
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
src/diffusers/pipelines/text_to_video_synthesis/__init__.py
View file @
3aa64128
...
@@ -47,3 +47,5 @@ else:
...
@@ -47,3 +47,5 @@ else:
_import_structure
,
_import_structure
,
module_spec
=
__spec__
,
module_spec
=
__spec__
,
)
)
for
name
,
value
in
_dummy_objects
.
items
():
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
src/diffusers/pipelines/vq_diffusion/__init__.py
View file @
3aa64128
...
@@ -51,3 +51,6 @@ else:
...
@@ -51,3 +51,6 @@ else:
_import_structure
,
_import_structure
,
module_spec
=
__spec__
,
module_spec
=
__spec__
,
)
)
for
name
,
value
in
_dummy_objects
.
items
():
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
src/diffusers/pipelines/wuerstchen/__init__.py
View file @
3aa64128
...
@@ -41,7 +41,6 @@ if TYPE_CHECKING:
...
@@ -41,7 +41,6 @@ if TYPE_CHECKING:
from
.pipeline_wuerstchen
import
WuerstchenDecoderPipeline
from
.pipeline_wuerstchen
import
WuerstchenDecoderPipeline
from
.pipeline_wuerstchen_combined
import
WuerstchenCombinedPipeline
from
.pipeline_wuerstchen_combined
import
WuerstchenCombinedPipeline
from
.pipeline_wuerstchen_prior
import
WuerstchenPriorPipeline
from
.pipeline_wuerstchen_prior
import
WuerstchenPriorPipeline
else
:
else
:
import
sys
import
sys
...
@@ -51,3 +50,6 @@ else:
...
@@ -51,3 +50,6 @@ else:
_import_structure
,
_import_structure
,
module_spec
=
__spec__
,
module_spec
=
__spec__
,
)
)
for
name
,
value
in
_dummy_objects
.
items
():
setattr
(
sys
.
modules
[
__name__
],
name
,
value
)
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