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
OpenDAS
diffusers
Commits
9062b284
Unverified
Commit
9062b284
authored
Mar 30, 2023
by
Alon Burg
Committed by
GitHub
Mar 30, 2023
Browse files
Support fp16 in conversion from original ckpt (#2733)
add --half to convert_original_stable_diffusion_to_diffusers.py
parent
b3d5cc4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
scripts/convert_original_stable_diffusion_to_diffusers.py
scripts/convert_original_stable_diffusion_to_diffusers.py
+5
-0
No files found.
scripts/convert_original_stable_diffusion_to_diffusers.py
View file @
9062b284
...
...
@@ -14,6 +14,7 @@
# limitations under the License.
""" Conversion script for the LDM checkpoints. """
import
torch
import
argparse
from
diffusers.pipelines.stable_diffusion.convert_from_ckpt
import
download_from_original_stable_diffusion_ckpt
...
...
@@ -123,6 +124,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--controlnet"
,
action
=
"store_true"
,
default
=
None
,
help
=
"Set flag if this is a controlnet checkpoint."
)
parser
.
add_argument
(
"--half"
,
action
=
"store_true"
,
help
=
"Save weights in half precision."
)
args
=
parser
.
parse_args
()
pipe
=
download_from_original_stable_diffusion_ckpt
(
...
...
@@ -143,6 +145,9 @@ if __name__ == "__main__":
controlnet
=
args
.
controlnet
,
)
if
args
.
half
:
pipe
.
to
(
torch_dtype
=
torch
.
float16
)
if
args
.
controlnet
:
# only save the controlnet model
pipe
.
controlnet
.
save_pretrained
(
args
.
dump_path
,
safe_serialization
=
args
.
to_safetensors
)
...
...
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