diff --git a/SD3LongCaptioner.py b/SD3LongCaptioner.py index 96fda0d..c4f14a3 100644 --- a/SD3LongCaptioner.py +++ b/SD3LongCaptioner.py @@ -63,6 +63,9 @@ class SD3LongCaptioner: # 解码生成的文本 decoded = self.processor.decode(generation[0], skip_special_tokens=True) + # 移除开头的提示词(如果存在) + decoded = decoded.replace(prompt, "", 1).strip() + return (decoded,) NODE_CLASS_MAPPINGS = { diff --git a/SD3LongCaptioner_v2.py b/SD3LongCaptioner_v2.py index f9fe859..8e64b8d 100644 --- a/SD3LongCaptioner_v2.py +++ b/SD3LongCaptioner_v2.py @@ -11,8 +11,6 @@ from huggingface_hub import snapshot_download files_for_sd3_long_captioner_v2 = Path(os.path.join(folder_paths.models_dir, "LLavacheckpoints", "files_for_sd3_long_captioner_v2")) files_for_sd3_long_captioner_v2.mkdir(parents=True, exist_ok=True) -# ... 其余代码 ... - class SD3LongCaptionerV2: def __init__(self): self.model_id = "gokaygokay/sd3-long-captioner-v2" @@ -65,6 +63,9 @@ class SD3LongCaptionerV2: # 解码生成的文本 decoded = self.processor.decode(generation[0], skip_special_tokens=True) + # 移除开头的提示词(如果存在) + decoded = decoded.replace(prompt, "", 1).strip() + return (decoded,) NODE_CLASS_MAPPINGS = {