mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-20 03:13:30 +00:00
split tokenizer from encoder
This commit is contained in:
parent
8489cba140
commit
73175cf58c
@ -372,10 +372,12 @@ class CLIP:
|
|||||||
def clip_layer(self, layer_idx):
|
def clip_layer(self, layer_idx):
|
||||||
self.layer_idx = 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:
|
if self.layer_idx is not None:
|
||||||
self.cond_stage_model.clip_layer(self.layer_idx)
|
self.cond_stage_model.clip_layer(self.layer_idx)
|
||||||
tokens = self.tokenizer.tokenize_with_weights(text)
|
|
||||||
try:
|
try:
|
||||||
self.patcher.patch_model()
|
self.patcher.patch_model()
|
||||||
cond = self.cond_stage_model.encode_token_weights(tokens)
|
cond = self.cond_stage_model.encode_token_weights(tokens)
|
||||||
|
3
nodes.py
3
nodes.py
@ -44,7 +44,8 @@ class CLIPTextEncode:
|
|||||||
CATEGORY = "conditioning"
|
CATEGORY = "conditioning"
|
||||||
|
|
||||||
def encode(self, clip, text):
|
def encode(self, clip, text):
|
||||||
return ([[clip.encode(text), {}]], )
|
tokens = clip.tokenize(text)
|
||||||
|
return ([[clip.encode(tokens), {}]], )
|
||||||
|
|
||||||
class ConditioningCombine:
|
class ConditioningCombine:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user