Spaces:
Runtime error
Runtime error
Update gradio-app.py
Browse files- gradio-app.py +0 -39
gradio-app.py
CHANGED
@@ -36,45 +36,6 @@ pipe.vae = pipe.vae.cuda()
|
|
36 |
pipe.unet.to(memory_format=torch.channels_last)
|
37 |
pipe.set_progress_bar_config(disable=True)
|
38 |
|
39 |
-
if TORCH_COMPILE:
|
40 |
-
#optmode = 'max-autotune'
|
41 |
-
#optmode = 'reduce-overhead'
|
42 |
-
#pipe.text_encoder = torch.compile(pipe.text_encoder, mode=optmode)
|
43 |
-
#pipe.tokenizer = torch.compile(pipe.tokenizer, mode=optmode)
|
44 |
-
#pipe.unet = torch.compile(pipe.unet, mode=optmode)
|
45 |
-
#pipe.vae = torch.compile(pipe.vae, mode=optmode)
|
46 |
-
doCompile = True
|
47 |
-
if doCompile:
|
48 |
-
from sfast.compilers.diffusion_pipeline_compiler import (compile, compile_unet, compile_vae, CompilationConfig)
|
49 |
-
config = CompilationConfig.Default()
|
50 |
-
|
51 |
-
try:
|
52 |
-
import xformers
|
53 |
-
config.enable_xformers = True
|
54 |
-
except ImportError:
|
55 |
-
print('xformers not installed, skipping')
|
56 |
-
try:
|
57 |
-
import triton
|
58 |
-
config.enable_triton = True
|
59 |
-
except ImportError:
|
60 |
-
print('Triton not installed, skipping')
|
61 |
-
|
62 |
-
config.enable_cuda_graph = True
|
63 |
-
config.enable_jit = True
|
64 |
-
config.enable_jit_freeze = True
|
65 |
-
config.trace_scheduler = False#True CHECK THIS AGAIN
|
66 |
-
config.enable_cnn_optimization = True
|
67 |
-
config.preserve_parameters = False
|
68 |
-
config.prefer_lowp_gemm = True
|
69 |
-
config.enable_fused_linear_geglu = True
|
70 |
-
|
71 |
-
torch.jit.optimize_for_inference = True
|
72 |
-
torch.jit.enable_onednn_fusion = True
|
73 |
-
torch.jit.set_fusion_strategy([('STATIC', 1), ('DYNAMIC', 1)])
|
74 |
-
|
75 |
-
for p in pipe.text_encoder.parameters(): p.requires_grad=False
|
76 |
-
for p in pipe.vae.decoder.parameters(): p.requires_grad=False
|
77 |
-
for p in pipe.unet.parameters(): p.requires_grad=False
|
78 |
|
79 |
def predict(prompt1, prompt2, merge_ratio, guidance, steps, sharpness, seed=1231231):
|
80 |
torch.manual_seed(seed)
|
|
|
36 |
pipe.unet.to(memory_format=torch.channels_last)
|
37 |
pipe.set_progress_bar_config(disable=True)
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
def predict(prompt1, prompt2, merge_ratio, guidance, steps, sharpness, seed=1231231):
|
41 |
torch.manual_seed(seed)
|