Views
No views yet
1import os
2os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
3
4from diffusers import UnCLIPPipeline
5import torch
6import random
7import numpy as np
8
9def set_seed(seed: int):
10 random.seed(seed)
11 np.random.seed(seed)
12 torch.manual_seed(seed)
13 torch.cuda.manual_seed_all(seed)
14
15set_seed(0)
16
17torch.backends.cuda.matmul.allow_tf32 = False
18torch.use_deterministic_algorithms(True)
19
20pipe = UnCLIPPipeline.from_pretrained("fusing/karlo_unclip", torch_dtype=torch.float16)
21pipe = pipe.to('cuda')
22
23prompt = "a high-resolution photograph of a big red frog on a green leaf."
24
25image = pipe([prompt]).images[0]
26
27image.save("frog.png")