33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from typing import Any
|
|
|
|
from ..modules.pipeline import Pipeline
|
|
|
|
|
|
class ClipProvider:
|
|
"""
|
|
Applies the merge pipeline and returns CLIP conditioning.
|
|
"""
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls) -> dict[str, object]:
|
|
return {
|
|
"required": {
|
|
"clip": ("CLIP",),
|
|
"positive": ("STRING", {"multiline": True, "dynamicPrompts": True}),
|
|
"negative": ("STRING", {"multiline": True, "dynamicPrompts": True}),
|
|
}
|
|
}
|
|
|
|
CATEGORY = "deathspike"
|
|
FUNCTION = "process"
|
|
RETURN_TYPES = ("CONDITIONING", "CONDITIONING")
|
|
RETURN_NAMES = ("positive", "negative")
|
|
|
|
def process(self, clip: Any, positive: str, negative: str):
|
|
positive = str(Pipeline.DEFAULT.run(positive, negative))
|
|
negative = ""
|
|
|
|
positive_tokens = clip.encode_from_tokens_scheduled(clip.tokenize(positive))
|
|
negative_tokens = clip.encode_from_tokens_scheduled(clip.tokenize(negative))
|
|
return (positive_tokens, negative_tokens)
|