Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import numpy as np
|
| 4 |
import spaces
|
| 5 |
import torch
|
| 6 |
-
from diffusers import AutoPipelineForText2Image,
|
| 7 |
|
| 8 |
if not torch.cuda.is_available():
|
| 9 |
DESCRIPTION += "\n<p>你现在运行在CPU上 但是只支持GPU.</p>"
|
|
@@ -18,20 +18,7 @@ if torch.cuda.is_available():
|
|
| 18 |
use_safetensors=True,
|
| 19 |
add_watermarker=False
|
| 20 |
)
|
| 21 |
-
pipe.scheduler =
|
| 22 |
-
pipe.scheduler.register_to_config(
|
| 23 |
-
rescale_betas_zero_snr=True,
|
| 24 |
-
clip_sample=False,
|
| 25 |
-
interpolation_type=linear,
|
| 26 |
-
prediction_type=epsilon,
|
| 27 |
-
sample_max_value=1.0,
|
| 28 |
-
set_alpha_to_one=False,
|
| 29 |
-
skip_prk_steps=True,
|
| 30 |
-
steps_offset=1,
|
| 31 |
-
timestep_spacing=leading,
|
| 32 |
-
trained_betas=null,
|
| 33 |
-
use_karras_sigmas=False
|
| 34 |
-
)
|
| 35 |
pipe.to("cuda")
|
| 36 |
|
| 37 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import spaces
|
| 5 |
import torch
|
| 6 |
+
from diffusers import AutoPipelineForText2Image, EulerDiscreteScheduler
|
| 7 |
|
| 8 |
if not torch.cuda.is_available():
|
| 9 |
DESCRIPTION += "\n<p>你现在运行在CPU上 但是只支持GPU.</p>"
|
|
|
|
| 18 |
use_safetensors=True,
|
| 19 |
add_watermarker=False
|
| 20 |
)
|
| 21 |
+
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", prediction_type="sample" if num_inference_steps==1 else "epsilon")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
pipe.to("cuda")
|
| 23 |
|
| 24 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|