Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,6 +24,7 @@ import paramiko
|
|
24 |
import gc
|
25 |
import time
|
26 |
import datetime
|
|
|
27 |
|
28 |
#os.system("chmod +x ./cusparselt.sh")
|
29 |
#os.system("./cusparselt.sh")
|
@@ -97,7 +98,8 @@ DEFAULT_STYLE_NAME = "Style Zero"
|
|
97 |
STYLE_NAMES = list(styles.keys())
|
98 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
99 |
|
100 |
-
|
|
|
101 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
102 |
if style_name in styles:
|
103 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
@@ -118,9 +120,9 @@ def load_and_prepare_model(model_id):
|
|
118 |
# vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors",safety_checker=None).to(torch.bfloat16)
|
119 |
# vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
|
120 |
#sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/Juggernaut-XI-v11-fp32', subfolder='scheduler',beta_schedule="scaled_linear",use_karras_sigmas=True)
|
121 |
-
#sched = EulerAncestralDiscreteScheduler.from_pretrained("SG161222/RealVisXL_V5.0", subfolder='scheduler',beta_schedule="scaled_linear", steps_offset=1)
|
122 |
-
|
123 |
-
sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True)
|
124 |
# sched = EulerAncestralDiscreteScheduler.from_config('ford442/RealVisXL_V5.0_BF16', beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
125 |
pipeX = StableDiffusionXLPipeline.from_pretrained("SG161222/RealVisXL_V5.0")
|
126 |
|
@@ -237,6 +239,7 @@ def generate_30(
|
|
237 |
"guidance_scale": guidance_scale,
|
238 |
"num_inference_steps": num_inference_steps,
|
239 |
"generator": generator,
|
|
|
240 |
"output_type": "pil",
|
241 |
}
|
242 |
if use_resolution_binning:
|
@@ -303,6 +306,7 @@ def generate_60(
|
|
303 |
"guidance_scale": guidance_scale,
|
304 |
"num_inference_steps": num_inference_steps,
|
305 |
"generator": generator,
|
|
|
306 |
"output_type": "pil",
|
307 |
}
|
308 |
if use_resolution_binning:
|
@@ -369,6 +373,7 @@ def generate_90(
|
|
369 |
"guidance_scale": guidance_scale,
|
370 |
"num_inference_steps": num_inference_steps,
|
371 |
"generator": generator,
|
|
|
372 |
"output_type": "pil",
|
373 |
}
|
374 |
if use_resolution_binning:
|
|
|
24 |
import gc
|
25 |
import time
|
26 |
import datetime
|
27 |
+
from diffusers.schedulers import AysSchedules
|
28 |
|
29 |
#os.system("chmod +x ./cusparselt.sh")
|
30 |
#os.system("./cusparselt.sh")
|
|
|
98 |
STYLE_NAMES = list(styles.keys())
|
99 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
100 |
|
101 |
+
sampling_schedule = AysSchedules["StableDiffusionXLTimesteps"]
|
102 |
+
|
103 |
def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
|
104 |
if style_name in styles:
|
105 |
p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
|
|
|
120 |
# vae = AutoencoderKL.from_pretrained("BeastHF/MyBack_SDXL_Juggernaut_XL_VAE/MyBack_SDXL_Juggernaut_XL_VAE_V10(version_X).safetensors",safety_checker=None).to(torch.bfloat16)
|
121 |
# vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None).to('cuda')
|
122 |
#sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/Juggernaut-XI-v11-fp32', subfolder='scheduler',beta_schedule="scaled_linear",use_karras_sigmas=True)
|
123 |
+
#sched = EulerAncestralDiscreteScheduler.from_pretrained("SG161222/RealVisXL_V5.0", subfolder='scheduler',beta_schedule="scaled_linear", steps_offset=1,timestep_spacing="trailing"))
|
124 |
+
sched = EulerAncestralDiscreteScheduler(timestep_spacing="trailing",steps_offset=1)
|
125 |
+
#sched = EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1,use_karras_sigmas=True)
|
126 |
# sched = EulerAncestralDiscreteScheduler.from_config('ford442/RealVisXL_V5.0_BF16', beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
|
127 |
pipeX = StableDiffusionXLPipeline.from_pretrained("SG161222/RealVisXL_V5.0")
|
128 |
|
|
|
239 |
"guidance_scale": guidance_scale,
|
240 |
"num_inference_steps": num_inference_steps,
|
241 |
"generator": generator,
|
242 |
+
"timesteps": sampling_schedule,
|
243 |
"output_type": "pil",
|
244 |
}
|
245 |
if use_resolution_binning:
|
|
|
306 |
"guidance_scale": guidance_scale,
|
307 |
"num_inference_steps": num_inference_steps,
|
308 |
"generator": generator,
|
309 |
+
"timesteps": sampling_schedule,
|
310 |
"output_type": "pil",
|
311 |
}
|
312 |
if use_resolution_binning:
|
|
|
373 |
"guidance_scale": guidance_scale,
|
374 |
"num_inference_steps": num_inference_steps,
|
375 |
"generator": generator,
|
376 |
+
"timesteps": sampling_schedule,
|
377 |
"output_type": "pil",
|
378 |
}
|
379 |
if use_resolution_binning:
|