modified the photomaker_v2 node.

This commit is contained in:
zhangsongbo 2024-09-11 09:53:56 +08:00
parent 1ed629a567
commit 890355989f

View File

@ -213,14 +213,14 @@ class PhotoMakerEncodeV2:
special_token = "photomaker" special_token = "photomaker"
pixel_values = comfy.clip_vision.clip_preprocess(image.to(photomaker.load_device)).float() pixel_values = comfy.clip_vision.clip_preprocess(image.to(photomaker.load_device)).float()
try: try:
if "photomaker" in text: if special_token in text:
text = text.replace("photomaker"," photomaker ") text = text.replace(special_token, " " + special_token + " ")
index = text.split(" ").index(special_token) + 1 index = text.split(" ").index(special_token) + 1
except ValueError: except ValueError:
index = -1 index = -1
tokens = clip.tokenize(text, return_word_ids=True) tokens = clip.tokenize(text, return_word_ids=True)
logger.debug(f"photomaker in prompt index:{index}, photomaker is running:{index>0}") logger.info(f"photomaker index in prompt:{index},alarm: It's will failure when index >= 77, photomaker embeds id:{index >0 and index < 77}")
out_tokens = {} out_tokens = {}
for k in tokens: for k in tokens: