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
8f2d13c6
Unverified
Commit
8f2d13c6
authored
Feb 29, 2024
by
Dhruv Nair
Committed by
GitHub
Feb 29, 2024
Browse files
Fix setting fp16 dtype in AnimateDiff convert script. (#7127)
* update * update
parent
fcfa270f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
scripts/convert_animatediff_motion_module_to_diffusers.py
scripts/convert_animatediff_motion_module_to_diffusers.py
+4
-1
No files found.
scripts/convert_animatediff_motion_module_to_diffusers.py
View file @
8f2d13c6
...
@@ -30,6 +30,7 @@ def get_args():
...
@@ -30,6 +30,7 @@ def get_args():
parser
.
add_argument
(
"--output_path"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
"--output_path"
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
"--use_motion_mid_block"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--use_motion_mid_block"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--motion_max_seq_length"
,
type
=
int
,
default
=
32
)
parser
.
add_argument
(
"--motion_max_seq_length"
,
type
=
int
,
default
=
32
)
parser
.
add_argument
(
"--save_fp16"
,
action
=
"store_true"
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
...
@@ -48,4 +49,6 @@ if __name__ == "__main__":
...
@@ -48,4 +49,6 @@ if __name__ == "__main__":
# skip loading position embeddings
# skip loading position embeddings
adapter
.
load_state_dict
(
conv_state_dict
,
strict
=
False
)
adapter
.
load_state_dict
(
conv_state_dict
,
strict
=
False
)
adapter
.
save_pretrained
(
args
.
output_path
)
adapter
.
save_pretrained
(
args
.
output_path
)
adapter
.
save_pretrained
(
args
.
output_path
,
variant
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
if
args
.
save_fp16
:
adapter
.
to
(
torch
.
float16
).
save_pretrained
(
args
.
output_path
,
variant
=
"fp16"
)
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