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
6b66999e
"...python/git@developer.sourcefind.cn:change/sglang.git" did not exist on "dc48c4c0e3848b5792039605d47f015cff26872e"
Commit
6b66999e
authored
Jun 09, 2022
by
patil-suraj
Browse files
make ALL_IMPORTABLE_CLASSES static
parent
02cdd683
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
src/diffusers/pipeline_utils.py
src/diffusers/pipeline_utils.py
+6
-8
No files found.
src/diffusers/pipeline_utils.py
View file @
6b66999e
...
@@ -46,6 +46,10 @@ LOADABLE_CLASSES = {
...
@@ -46,6 +46,10 @@ LOADABLE_CLASSES = {
},
},
}
}
ALL_IMPORTABLE_CLASSES
=
{}
for
library
in
LOADABLE_CLASSES
:
ALL_IMPORTABLE_CLASSES
.
update
(
LOADABLE_CLASSES
[
library
])
class
DiffusionPipeline
(
ConfigMixin
):
class
DiffusionPipeline
(
ConfigMixin
):
...
@@ -125,12 +129,6 @@ class DiffusionPipeline(ConfigMixin):
...
@@ -125,12 +129,6 @@ class DiffusionPipeline(ConfigMixin):
init_kwargs
=
{}
init_kwargs
=
{}
# get all importable classes to get the load method name for custom models/components
# here we enforce that custom models/components should always subclass from base classes in tansformers and diffusers
all_importable_classes
=
{}
for
library
in
LOADABLE_CLASSES
:
all_importable_classes
.
update
(
LOADABLE_CLASSES
[
library
])
for
name
,
(
library_name
,
class_name
)
in
init_dict
.
items
():
for
name
,
(
library_name
,
class_name
)
in
init_dict
.
items
():
# if the model is not in diffusers or transformers, we need to load it from the hub
# if the model is not in diffusers or transformers, we need to load it from the hub
...
@@ -138,8 +136,8 @@ class DiffusionPipeline(ConfigMixin):
...
@@ -138,8 +136,8 @@ class DiffusionPipeline(ConfigMixin):
if
library_name
==
module_candidate_name
:
if
library_name
==
module_candidate_name
:
class_obj
=
get_class_from_dynamic_module
(
cached_folder
,
module
,
class_name
,
cached_folder
)
class_obj
=
get_class_from_dynamic_module
(
cached_folder
,
module
,
class_name
,
cached_folder
)
# since it's not from a library, we need to check class candidates for all importable classes
# since it's not from a library, we need to check class candidates for all importable classes
importable_classes
=
all_importable_classes
importable_classes
=
ALL_IMPORTABLE_CLASSES
class_candidates
=
{
c
:
class_obj
for
c
in
all_importable_classes
}
class_candidates
=
{
c
:
class_obj
for
c
in
ALL_IMPORTABLE_CLASSES
.
keys
()
}
else
:
else
:
library
=
importlib
.
import_module
(
library_name
)
library
=
importlib
.
import_module
(
library_name
)
class_obj
=
getattr
(
library
,
class_name
)
class_obj
=
getattr
(
library
,
class_name
)
...
...
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