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
73175cf5
Commit
73175cf5
authored
Apr 13, 2023
by
BlenderNeko
Browse files
split tokenizer from encoder
parent
8489cba1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
comfy/sd.py
comfy/sd.py
+4
-2
nodes.py
nodes.py
+2
-1
No files found.
comfy/sd.py
View file @
73175cf5
...
...
@@ -372,10 +372,12 @@ class CLIP:
def
clip_layer
(
self
,
layer_idx
):
self
.
layer_idx
=
layer_idx
def
encode
(
self
,
text
):
def
tokenize
(
self
,
text
):
return
self
.
tokenizer
.
tokenize_with_weights
(
text
)
def
encode
(
self
,
tokens
):
if
self
.
layer_idx
is
not
None
:
self
.
cond_stage_model
.
clip_layer
(
self
.
layer_idx
)
tokens
=
self
.
tokenizer
.
tokenize_with_weights
(
text
)
try
:
self
.
patcher
.
patch_model
()
cond
=
self
.
cond_stage_model
.
encode_token_weights
(
tokens
)
...
...
nodes.py
View file @
73175cf5
...
...
@@ -44,7 +44,8 @@ class CLIPTextEncode:
CATEGORY
=
"conditioning"
def
encode
(
self
,
clip
,
text
):
return
([[
clip
.
encode
(
text
),
{}]],
)
tokens
=
clip
.
tokenize
(
text
)
return
([[
clip
.
encode
(
tokens
),
{}]],
)
class
ConditioningCombine
:
@
classmethod
...
...
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