Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Allow custom templates with Ideogram4 TE (#14374)

Jukka Seppänen8ed7f458d055
diff --git a/comfy/text_encoders/ideogram4.py b/comfy/text_encoders/ideogram4.py
index 55e655d67..84243772d 100644
--- a/comfy/text_encoders/ideogram4.py
+++ b/comfy/text_encoders/ideogram4.py
@@ -32,7 +32,9 @@ class Ideogram4Tokenizer(sd1_clip.SD1Tokenizer):
self.llama_template = "<|im_start|>user\n{}<|im_end|>\n<|im_start|>assistant\n"
def tokenize_with_weights(self, text, return_word_ids=False, llama_template=None, **kwargs):
- if llama_template is None:
+ if text.startswith('<|im_start|>'):
+ llama_text = text
+ elif llama_template is None:
llama_text = self.llama_template.format(text)
else:
llama_text = llama_template.format(text)