mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-28 03:12:31 +08:00
Translate think tokens
This commit is contained in:
parent
387e8d8a4c
commit
c857b6c657
@ -71,7 +71,15 @@ class TextGenerate(io.ComfyNode):
|
|||||||
seed=seed
|
seed=seed
|
||||||
)
|
)
|
||||||
|
|
||||||
generated_text = clip.decode(generated_ids, skip_special_tokens=True)
|
generated_text = clip.decode(generated_ids, skip_special_tokens=not thinking)
|
||||||
|
|
||||||
|
if thinking:
|
||||||
|
# Translate Gemma4 thinking channel markers to standard <think>/</think> tags
|
||||||
|
generated_text = generated_text.replace("<|channel>thought\n", "<think>\n")
|
||||||
|
generated_text = generated_text.replace("<channel|>", "</think>")
|
||||||
|
# Strip remaining special tokens
|
||||||
|
generated_text = generated_text.replace("<turn|>", "").replace("<eos>", "").strip()
|
||||||
|
|
||||||
return io.NodeOutput(generated_text)
|
return io.NodeOutput(generated_text)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user