Instructions to use bbbboiwow/cocccck with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use bbbboiwow/cocccck with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("bbbboiwow/cocccck", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
File size: 4,033 Bytes
edb09f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | class ConditionTextMulti:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"clip": ("CLIP",),
},
"optional": {
"first": (
"STRING",
{"default": "", "multiline": False, "forceInput": True},
),
"second": (
"STRING",
{"default": "", "multiline": False, "forceInput": True},
),
"third": (
"STRING",
{"default": "", "multiline": False, "forceInput": True},
),
"fourth": (
"STRING",
{"default": "", "multiline": False, "forceInput": True},
),
},
}
RETURN_TYPES = (
"CLIP",
"CONDITIONING",
"CONDITIONING",
"CONDITIONING",
"CONDITIONING",
)
RETURN_NAMES = (
"CLIP",
"first",
"second",
"third",
"fourth",
)
FUNCTION = "conditiontext"
CATEGORY = "Chibi-Nodes/Text"
def conditiontext(
self,
clip,
first="",
second="",
third="",
fourth="",
):
emptystring = ""
returnedcond = []
# TODO: I probably want to fix this mess at some point.
if first != "":
firstraw = clip.tokenize(first)
first_cond, first_pooled = clip.encode_from_tokens(
firstraw, return_pooled=True
)
returnedcond.append(
[[first_cond, {"pooled_output": first_pooled}]])
else:
emptyraw = clip.tokenize(emptystring)
empty_cond, empty_pooled = clip.encode_from_tokens(
emptyraw, return_pooled=True
)
returnedcond.append(
[[empty_cond, {"pooled_output": empty_pooled}]])
if second != "":
secondraw = clip.tokenize(second)
second_cond, second_pooled = clip.encode_from_tokens(
secondraw, return_pooled=True
)
returnedcond.append(
[[second_cond, {"pooled_output": second_pooled}]])
else:
emptyraw = clip.tokenize(emptystring)
empty_cond, empty_pooled = clip.encode_from_tokens(
emptyraw, return_pooled=True
)
returnedcond.append(
[[empty_cond, {"pooled_output": empty_pooled}]])
if third != "":
thirdraw = clip.tokenize(third)
third_cond, third_pooled = clip.encode_from_tokens(
thirdraw, return_pooled=True
)
returnedcond.append(
[[third_cond, {"pooled_output": third_pooled}]])
else:
emptyraw = clip.tokenize(emptystring)
empty_cond, empty_pooled = clip.encode_from_tokens(
emptyraw, return_pooled=True
)
returnedcond.append(
[[empty_cond, {"pooled_output": empty_pooled}]])
if fourth != "":
fourthraw = clip.tokenize(fourth)
fourth_cond, fourth_pooled = clip.encode_from_tokens(
fourthraw, return_pooled=True
)
returnedcond.append(
[[fourth_cond, {"pooled_output": fourth_pooled}]])
else:
emptyraw = clip.tokenize(emptystring)
empty_cond, empty_pooled = clip.encode_from_tokens(
emptyraw, return_pooled=True
)
returnedcond.append(
[[empty_cond, {"pooled_output": empty_pooled}]])
return (
clip,
returnedcond[0],
returnedcond[1],
returnedcond[2],
returnedcond[3],
)
|