Update README.md
Browse files
README.md
CHANGED
@@ -78,7 +78,7 @@ Anything works as long as it's a multiply of 128.
|
|
78 |
# Diffusers
|
79 |
|
80 |
```shell
|
81 |
-
pip install diffusers
|
82 |
```
|
83 |
|
84 |
```python
|
@@ -88,22 +88,7 @@ import diffusers
|
|
88 |
device = "cuda"
|
89 |
dtype = torch.float16
|
90 |
model_path = "/mnt/DataSSD/AI/SoteDiffusion/Wuerstchen3/diffusers/sotediffusion-v2"
|
91 |
-
|
92 |
-
|
93 |
-
def get_timestep_ratio_conditioning(t, alphas_cumprod):
|
94 |
-
s = torch.tensor([0.008]) # diffusers uses 0.003 while the original is 0.008
|
95 |
-
clamp_range = [0, 1]
|
96 |
-
min_var = torch.cos(s / (1 + s) * torch.pi * 0.5) ** 2
|
97 |
-
var = alphas_cumprod[t]
|
98 |
-
var = var.clamp(*clamp_range)
|
99 |
-
s, min_var = s.to(var.device), min_var.to(var.device)
|
100 |
-
ratio = (((var * min_var) ** 0.5).acos() / (torch.pi * 0.5)) * (1 + s) - s
|
101 |
-
return ratio
|
102 |
-
|
103 |
-
|
104 |
pipe = diffusers.AutoPipelineForText2Image.from_pretrained(model_path, text_encoder=None, torch_dtype=dtype)
|
105 |
-
pipe.prior_pipe.get_timestep_ratio_conditioning = get_timestep_ratio_conditioning
|
106 |
-
pipe.prior_pipe.scheduler.config.clip_sample = False
|
107 |
|
108 |
# de-dupe
|
109 |
pipe.decoder_pipe.text_encoder = pipe.text_encoder = None # nothing uses this
|
|
|
78 |
# Diffusers
|
79 |
|
80 |
```shell
|
81 |
+
pip install git+https://github.com/Disty0/diffusers@cascade_decoder_sampler
|
82 |
```
|
83 |
|
84 |
```python
|
|
|
88 |
device = "cuda"
|
89 |
dtype = torch.float16
|
90 |
model_path = "/mnt/DataSSD/AI/SoteDiffusion/Wuerstchen3/diffusers/sotediffusion-v2"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
pipe = diffusers.AutoPipelineForText2Image.from_pretrained(model_path, text_encoder=None, torch_dtype=dtype)
|
|
|
|
|
92 |
|
93 |
# de-dupe
|
94 |
pipe.decoder_pipe.text_encoder = pipe.text_encoder = None # nothing uses this
|