Spaces:
Build error
Build error
pass COMPILE to build-run.sh
Browse files- build-run.sh +5 -1
- pipelines/controlnetSDTurbo.py +10 -0
- pipelines/img2imgSDTurbo.py +1 -0
build-run.sh
CHANGED
|
@@ -12,5 +12,9 @@ cd ../
|
|
| 12 |
if [ -z ${PIPELINE+x} ]; then
|
| 13 |
PIPELINE="controlnet"
|
| 14 |
fi
|
|
|
|
|
|
|
|
|
|
| 15 |
echo -e "\033[1;32m\npipeline: $PIPELINE \033[0m"
|
| 16 |
-
|
|
|
|
|
|
| 12 |
if [ -z ${PIPELINE+x} ]; then
|
| 13 |
PIPELINE="controlnet"
|
| 14 |
fi
|
| 15 |
+
if [ -z ${COMPILE+x} ]; then
|
| 16 |
+
COMPILE="--sfast"
|
| 17 |
+
fi
|
| 18 |
echo -e "\033[1;32m\npipeline: $PIPELINE \033[0m"
|
| 19 |
+
echo -e "\033[1;32m\ncompile: $COMPILE \033[0m"
|
| 20 |
+
python3 run.py --port 7860 --host 0.0.0.0 --pipeline $PIPELINE $COMPILE
|
pipelines/controlnetSDTurbo.py
CHANGED
|
@@ -182,6 +182,7 @@ class Pipeline:
|
|
| 182 |
).to(device)
|
| 183 |
|
| 184 |
if args.sfast:
|
|
|
|
| 185 |
from sfast.compilers.stable_diffusion_pipeline_compiler import (
|
| 186 |
compile,
|
| 187 |
CompilationConfig,
|
|
@@ -193,6 +194,15 @@ class Pipeline:
|
|
| 193 |
config.enable_cuda_graph = True
|
| 194 |
self.pipe = compile(self.pipe, config=config)
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
self.canny_torch = SobelOperator(device=device)
|
| 197 |
|
| 198 |
self.pipe.scheduler = LCMScheduler.from_config(self.pipe.scheduler.config)
|
|
|
|
| 182 |
).to(device)
|
| 183 |
|
| 184 |
if args.sfast:
|
| 185 |
+
print("\nRunning sfast compile\n")
|
| 186 |
from sfast.compilers.stable_diffusion_pipeline_compiler import (
|
| 187 |
compile,
|
| 188 |
CompilationConfig,
|
|
|
|
| 194 |
config.enable_cuda_graph = True
|
| 195 |
self.pipe = compile(self.pipe, config=config)
|
| 196 |
|
| 197 |
+
if args.oneflow:
|
| 198 |
+
print("\nRunning oneflow compile\n")
|
| 199 |
+
from onediff.infer_compiler import oneflow_compile
|
| 200 |
+
|
| 201 |
+
self.pipe.unet = oneflow_compile(self.pipe.unet)
|
| 202 |
+
self.pipe.vae.encoder = oneflow_compile(self.pipe.vae.encoder)
|
| 203 |
+
self.pipe.vae.decoder = oneflow_compile(self.pipe.vae.decoder)
|
| 204 |
+
self.pipe.controlnet = oneflow_compile(self.pipe.controlnet)
|
| 205 |
+
|
| 206 |
self.canny_torch = SobelOperator(device=device)
|
| 207 |
|
| 208 |
self.pipe.scheduler = LCMScheduler.from_config(self.pipe.scheduler.config)
|
pipelines/img2imgSDTurbo.py
CHANGED
|
@@ -125,6 +125,7 @@ class Pipeline:
|
|
| 125 |
print("\nRunning oneflow compile\n")
|
| 126 |
from onediff.infer_compiler import oneflow_compile
|
| 127 |
|
|
|
|
| 128 |
self.pipe.vae.encoder = oneflow_compile(self.pipe.vae.encoder)
|
| 129 |
self.pipe.vae.decoder = oneflow_compile(self.pipe.vae.decoder)
|
| 130 |
|
|
|
|
| 125 |
print("\nRunning oneflow compile\n")
|
| 126 |
from onediff.infer_compiler import oneflow_compile
|
| 127 |
|
| 128 |
+
self.pipe.unet = oneflow_compile(self.pipe.unet)
|
| 129 |
self.pipe.vae.encoder = oneflow_compile(self.pipe.vae.encoder)
|
| 130 |
self.pipe.vae.decoder = oneflow_compile(self.pipe.vae.decoder)
|
| 131 |
|