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
cbbad0af
Commit
cbbad0af
authored
Mar 08, 2023
by
Patrick von Platen
Browse files
correct example
parent
00132de3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
3 deletions
+0
-3
examples/research_projects/lora/train_text_to_image_lora.py
examples/research_projects/lora/train_text_to_image_lora.py
+0
-3
No files found.
examples/research_projects/lora/train_text_to_image_lora.py
View file @
cbbad0af
...
@@ -479,7 +479,6 @@ def main():
...
@@ -479,7 +479,6 @@ def main():
weight_dtype
=
torch
.
bfloat16
weight_dtype
=
torch
.
bfloat16
if
args
.
use_peft
:
if
args
.
use_peft
:
from
peft
import
LoraConfig
,
LoraModel
,
get_peft_model_state_dict
,
set_peft_model_state_dict
from
peft
import
LoraConfig
,
LoraModel
,
get_peft_model_state_dict
,
set_peft_model_state_dict
UNET_TARGET_MODULES
=
[
"to_q"
,
"to_v"
,
"query"
,
"value"
]
UNET_TARGET_MODULES
=
[
"to_q"
,
"to_v"
,
"query"
,
"value"
]
...
@@ -496,7 +495,6 @@ def main():
...
@@ -496,7 +495,6 @@ def main():
vae
.
requires_grad_
(
False
)
vae
.
requires_grad_
(
False
)
if
args
.
train_text_encoder
:
if
args
.
train_text_encoder
:
config
=
LoraConfig
(
config
=
LoraConfig
(
r
=
args
.
lora_text_encoder_r
,
r
=
args
.
lora_text_encoder_r
,
lora_alpha
=
args
.
lora_text_encoder_alpha
,
lora_alpha
=
args
.
lora_text_encoder_alpha
,
...
@@ -506,7 +504,6 @@ def main():
...
@@ -506,7 +504,6 @@ def main():
)
)
text_encoder
=
LoraModel
(
config
,
text_encoder
)
text_encoder
=
LoraModel
(
config
,
text_encoder
)
else
:
else
:
# freeze parameters of models to save more memory
# freeze parameters of models to save more memory
unet
.
requires_grad_
(
False
)
unet
.
requires_grad_
(
False
)
vae
.
requires_grad_
(
False
)
vae
.
requires_grad_
(
False
)
...
...
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