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
OpenDAS
diffusers
Commits
5bb38586
Unverified
Commit
5bb38586
authored
May 12, 2024
by
Sayak Paul
Committed by
GitHub
May 12, 2024
Browse files
[Core] fix offload behaviour when device_map is enabled. (#7919)
fix offload behaviour when device_map is enabled.
parent
ec9e8813
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
src/diffusers/loaders/lora.py
src/diffusers/loaders/lora.py
+1
-1
src/diffusers/loaders/textual_inversion.py
src/diffusers/loaders/textual_inversion.py
+14
-13
No files found.
src/diffusers/loaders/lora.py
View file @
5bb38586
...
...
@@ -363,7 +363,7 @@ class LoraLoaderMixin:
is_model_cpu_offload
=
False
is_sequential_cpu_offload
=
False
if
_pipeline
is
not
None
:
if
_pipeline
is
not
None
and
_pipeline
.
hf_device_map
is
None
:
for
_
,
component
in
_pipeline
.
components
.
items
():
if
isinstance
(
component
,
nn
.
Module
)
and
hasattr
(
component
,
"_hf_hook"
):
if
not
is_model_cpu_offload
:
...
...
src/diffusers/loaders/textual_inversion.py
View file @
5bb38586
...
...
@@ -419,6 +419,7 @@ class TextualInversionLoaderMixin:
# 7.1 Offload all hooks in case the pipeline was cpu offloaded before make sure, we offload and onload again
is_model_cpu_offload
=
False
is_sequential_cpu_offload
=
False
if
self
.
hf_device_map
is
None
:
for
_
,
component
in
self
.
components
.
items
():
if
isinstance
(
component
,
nn
.
Module
):
if
hasattr
(
component
,
"_hf_hook"
):
...
...
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