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
5e6bc824
Commit
5e6bc824
authored
Jul 03, 2023
by
comfyanonymous
Browse files
Allow passing custom path to clip-g and clip-h.
parent
dc9d1f31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
comfy/sd2_clip.py
comfy/sd2_clip.py
+2
-2
comfy/sdxl_clip.py
comfy/sdxl_clip.py
+2
-2
No files found.
comfy/sd2_clip.py
View file @
5e6bc824
...
@@ -3,9 +3,9 @@ import torch
...
@@ -3,9 +3,9 @@ import torch
import
os
import
os
class
SD2ClipModel
(
sd1_clip
.
SD1ClipModel
):
class
SD2ClipModel
(
sd1_clip
.
SD1ClipModel
):
def
__init__
(
self
,
arch
=
"ViT-H-14"
,
device
=
"cpu"
,
max_length
=
77
,
freeze
=
True
,
layer
=
"penultimate"
,
layer_idx
=
None
):
def
__init__
(
self
,
arch
=
"ViT-H-14"
,
device
=
"cpu"
,
max_length
=
77
,
freeze
=
True
,
layer
=
"penultimate"
,
layer_idx
=
None
,
textmodel_path
=
None
):
textmodel_json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"sd2_clip_config.json"
)
textmodel_json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"sd2_clip_config.json"
)
super
().
__init__
(
device
=
device
,
freeze
=
freeze
,
textmodel_json_config
=
textmodel_json_config
)
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
]
if
layer
==
"last"
:
if
layer
==
"last"
:
pass
pass
...
...
comfy/sdxl_clip.py
View file @
5e6bc824
...
@@ -3,9 +3,9 @@ import torch
...
@@ -3,9 +3,9 @@ import torch
import
os
import
os
class
SDXLClipG
(
sd1_clip
.
SD1ClipModel
):
class
SDXLClipG
(
sd1_clip
.
SD1ClipModel
):
def
__init__
(
self
,
device
=
"cpu"
,
max_length
=
77
,
freeze
=
True
,
layer
=
"penultimate"
,
layer_idx
=
None
):
def
__init__
(
self
,
device
=
"cpu"
,
max_length
=
77
,
freeze
=
True
,
layer
=
"penultimate"
,
layer_idx
=
None
,
textmodel_path
=
None
):
textmodel_json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_config_bigg.json"
)
textmodel_json_config
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"clip_config_bigg.json"
)
super
().
__init__
(
device
=
device
,
freeze
=
freeze
,
textmodel_json_config
=
textmodel_json_config
)
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
.
layer_norm_hidden_state
=
False
self
.
layer_norm_hidden_state
=
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