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: 1,325 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 | import random
import torch
class RandomResolutionLatent:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}),
},
}
RETURN_TYPES = (
"LATENT",
"INT",
"INT",
)
RETURN_NAMES = (
"LATENT",
"width",
"height",
)
OUTPUT_NODE = True
FUNCTION = "random_resolution"
CATEGORY = "Chibi-Nodes/Numbers"
@classmethod
def IS_CHANGED(s, **kwargs):
random.seed()
return float("NaN")
def random_resolution(self, batch_size):
resolutions = [512, 768, 1024]
res_list = []
for x in resolutions:
for y in resolutions:
a = (x, y)
b = (y, x)
if a not in res_list:
res_list.append(a)
if b not in res_list:
res_list.append(b)
rand_res = random.choice(res_list)
latent = torch.zeros(
[batch_size, 4, rand_res[0] // 8, rand_res[1] // 8])
return (
{"samples": latent},
rand_res[0],
rand_res[1],
)
|