File size: 729 Bytes
ca60faf |
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 |
```python
import os
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
from diffusers import UnCLIPPipeline
import torch
import random
import numpy as np
def set_seed(seed: int):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
set_seed(0)
torch.backends.cuda.matmul.allow_tf32 = False
torch.use_deterministic_algorithms(True)
pipe = UnCLIPPipeline.from_pretrained("fusing/karlo_unclip", torch_dtype=torch.float16)
pipe = pipe.to('cuda')
prompt = "a high-resolution photograph of a big red frog on a green leaf."
image = pipe([prompt]).images[0]
image.save("frog.png")
```
![img](https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/frog.png) |