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
ComfyUI
Commits
f81b1929
Commit
f81b1929
authored
Jul 04, 2023
by
comfyanonymous
Browse files
Add logit scale parameter so it's present when saving the checkpoint.
parent
acf95191
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
comfy/sdxl_clip.py
comfy/sdxl_clip.py
+1
-0
comfy/supported_models.py
comfy/supported_models.py
+2
-0
No files found.
comfy/sdxl_clip.py
View file @
f81b1929
...
@@ -8,6 +8,7 @@ class SDXLClipG(sd1_clip.SD1ClipModel):
...
@@ -8,6 +8,7 @@ class SDXLClipG(sd1_clip.SD1ClipModel):
super
().
__init__
(
device
=
device
,
freeze
=
freeze
,
textmodel_json_config
=
textmodel_json_config
,
textmodel_path
=
textmodel_path
)
super
().
__init__
(
device
=
device
,
freeze
=
freeze
,
textmodel_json_config
=
textmodel_json_config
,
textmodel_path
=
textmodel_path
)
self
.
empty_tokens
=
[[
49406
]
+
[
49407
]
+
[
0
]
*
75
]
self
.
empty_tokens
=
[[
49406
]
+
[
49407
]
+
[
0
]
*
75
]
self
.
text_projection
=
torch
.
nn
.
Parameter
(
torch
.
empty
(
1280
,
1280
))
self
.
text_projection
=
torch
.
nn
.
Parameter
(
torch
.
empty
(
1280
,
1280
))
self
.
logit_scale
=
torch
.
nn
.
Parameter
(
torch
.
tensor
(
4.6055
))
self
.
layer_norm_hidden_state
=
False
self
.
layer_norm_hidden_state
=
False
if
layer
==
"last"
:
if
layer
==
"last"
:
pass
pass
...
...
comfy/supported_models.py
View file @
f81b1929
...
@@ -118,6 +118,7 @@ class SDXLRefiner(supported_models_base.BASE):
...
@@ -118,6 +118,7 @@ class SDXLRefiner(supported_models_base.BASE):
state_dict
=
utils
.
transformers_convert
(
state_dict
,
"conditioner.embedders.0.model."
,
"cond_stage_model.clip_g.transformer.text_model."
,
32
)
state_dict
=
utils
.
transformers_convert
(
state_dict
,
"conditioner.embedders.0.model."
,
"cond_stage_model.clip_g.transformer.text_model."
,
32
)
keys_to_replace
[
"conditioner.embedders.0.model.text_projection"
]
=
"cond_stage_model.clip_g.text_projection"
keys_to_replace
[
"conditioner.embedders.0.model.text_projection"
]
=
"cond_stage_model.clip_g.text_projection"
keys_to_replace
[
"conditioner.embedders.0.model.logit_scale"
]
=
"cond_stage_model.clip_g.logit_scale"
state_dict
=
supported_models_base
.
state_dict_key_replace
(
state_dict
,
keys_to_replace
)
state_dict
=
supported_models_base
.
state_dict_key_replace
(
state_dict
,
keys_to_replace
)
return
state_dict
return
state_dict
...
@@ -153,6 +154,7 @@ class SDXL(supported_models_base.BASE):
...
@@ -153,6 +154,7 @@ class SDXL(supported_models_base.BASE):
replace_prefix
[
"conditioner.embedders.0.transformer.text_model"
]
=
"cond_stage_model.clip_l.transformer.text_model"
replace_prefix
[
"conditioner.embedders.0.transformer.text_model"
]
=
"cond_stage_model.clip_l.transformer.text_model"
state_dict
=
utils
.
transformers_convert
(
state_dict
,
"conditioner.embedders.1.model."
,
"cond_stage_model.clip_g.transformer.text_model."
,
32
)
state_dict
=
utils
.
transformers_convert
(
state_dict
,
"conditioner.embedders.1.model."
,
"cond_stage_model.clip_g.transformer.text_model."
,
32
)
keys_to_replace
[
"conditioner.embedders.1.model.text_projection"
]
=
"cond_stage_model.clip_g.text_projection"
keys_to_replace
[
"conditioner.embedders.1.model.text_projection"
]
=
"cond_stage_model.clip_g.text_projection"
keys_to_replace
[
"conditioner.embedders.1.model.logit_scale"
]
=
"cond_stage_model.clip_g.logit_scale"
state_dict
=
supported_models_base
.
state_dict_prefix_replace
(
state_dict
,
replace_prefix
)
state_dict
=
supported_models_base
.
state_dict_prefix_replace
(
state_dict
,
replace_prefix
)
state_dict
=
supported_models_base
.
state_dict_key_replace
(
state_dict
,
keys_to_replace
)
state_dict
=
supported_models_base
.
state_dict_key_replace
(
state_dict
,
keys_to_replace
)
...
...
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