patrickvonplaten commited on
Commit
ca60faf
1 Parent(s): f084fef

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+ import os
3
+ os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
4
+
5
+ from diffusers import UnCLIPPipeline
6
+ import torch
7
+ import random
8
+ import numpy as np
9
+
10
+ def set_seed(seed: int):
11
+ random.seed(seed)
12
+ np.random.seed(seed)
13
+ torch.manual_seed(seed)
14
+ torch.cuda.manual_seed_all(seed)
15
+
16
+ set_seed(0)
17
+
18
+ torch.backends.cuda.matmul.allow_tf32 = False
19
+ torch.use_deterministic_algorithms(True)
20
+
21
+ pipe = UnCLIPPipeline.from_pretrained("fusing/karlo_unclip", torch_dtype=torch.float16)
22
+ pipe = pipe.to('cuda')
23
+
24
+ prompt = "a high-resolution photograph of a big red frog on a green leaf."
25
+
26
+ image = pipe([prompt]).images[0]
27
+
28
+ image.save("frog.png")
29
+ ```
30
+
31
+ ![img](https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/frog.png)