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
chenpangpang
PhotoMaker
Commits
42ea6dbf
Commit
42ea6dbf
authored
Jul 29, 2024
by
chenpangpang
Browse files
feat: 避免重复下载模型
parent
9a73404f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
PhotoMaker/gradio_demo/app_v2.py
PhotoMaker/gradio_demo/app_v2.py
+2
-3
No files found.
PhotoMaker/gradio_demo/app_v2.py
View file @
42ea6dbf
...
@@ -40,7 +40,6 @@ ASPECT_RATIO_LABELS = list(aspect_ratios)
...
@@ -40,7 +40,6 @@ ASPECT_RATIO_LABELS = list(aspect_ratios)
DEFAULT_ASPECT_RATIO
=
ASPECT_RATIO_LABELS
[
0
]
DEFAULT_ASPECT_RATIO
=
ASPECT_RATIO_LABELS
[
0
]
enable_doodle_arg
=
False
enable_doodle_arg
=
False
photomaker_ckpt
=
hf_hub_download
(
repo_id
=
"TencentARC/PhotoMaker-V2"
,
filename
=
"photomaker-v2.bin"
,
repo_type
=
"model"
)
torch_dtype
=
torch
.
bfloat16
if
torch
.
cuda
.
is_bf16_supported
()
else
torch
.
float16
torch_dtype
=
torch
.
bfloat16
if
torch
.
cuda
.
is_bf16_supported
()
else
torch
.
float16
if
device
==
"mps"
:
if
device
==
"mps"
:
...
@@ -60,9 +59,9 @@ pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_pretrained(
...
@@ -60,9 +59,9 @@ pipe = PhotoMakerStableDiffusionXLAdapterPipeline.from_pretrained(
).
to
(
device
)
).
to
(
device
)
pipe
.
load_photomaker_adapter
(
pipe
.
load_photomaker_adapter
(
os
.
path
.
dirname
(
p
hoto
m
aker
_ckpt
)
,
"TencentARC/P
hoto
M
aker
-V2"
,
subfolder
=
""
,
subfolder
=
""
,
weight_name
=
os
.
path
.
basename
(
photomaker
_ckpt
)
,
weight_name
=
"
photomaker
-v2.bin"
,
trigger_word
=
"img"
,
trigger_word
=
"img"
,
pm_version
=
"v2"
,
pm_version
=
"v2"
,
)
)
...
...
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