zhiweili
commited on
Commit
Β·
5333034
1
Parent(s):
8b0a7fe
test stable fast
Browse files- app_onediff.py +14 -4
- requirements.txt +3 -1
app_onediff.py
CHANGED
|
@@ -12,7 +12,9 @@ from diffusers import (
|
|
| 12 |
AutoencoderKL,
|
| 13 |
)
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
def runcmd(cmd, verbose = False, *args, **kwargs):
|
| 18 |
|
|
@@ -41,9 +43,9 @@ def runcmd(cmd, verbose = False, *args, **kwargs):
|
|
| 41 |
|
| 42 |
# from onediffx import compile_pipe, save_pipe
|
| 43 |
|
| 44 |
-
def nexfort_compile(torch_module: torch.nn.Module):
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
BASE_MODEL = "stabilityai/sdxl-turbo"
|
| 49 |
device = "cuda"
|
|
@@ -67,6 +69,14 @@ base_pipe.to(device)
|
|
| 67 |
|
| 68 |
# base_pipe = nexfort_compile(base_pipe)
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
from gfpgan.utils import GFPGANer
|
| 71 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
| 72 |
from realesrgan.utils import RealESRGANer
|
|
|
|
| 12 |
AutoencoderKL,
|
| 13 |
)
|
| 14 |
|
| 15 |
+
import xformers
|
| 16 |
+
import triton
|
| 17 |
+
from sfast.compilers.diffusion_pipeline_compiler import (compile, CompilationConfig)
|
| 18 |
|
| 19 |
def runcmd(cmd, verbose = False, *args, **kwargs):
|
| 20 |
|
|
|
|
| 43 |
|
| 44 |
# from onediffx import compile_pipe, save_pipe
|
| 45 |
|
| 46 |
+
# def nexfort_compile(torch_module: torch.nn.Module):
|
| 47 |
+
# options = json.loads('{"mode": "max-optimize:max-autotune:low-precision", "memory_format": "channels_last", "dynamic": true}')
|
| 48 |
+
# return compile_pipe(torch_module, backend="nexfort", options=options, fuse_qkv_projections=True)
|
| 49 |
|
| 50 |
BASE_MODEL = "stabilityai/sdxl-turbo"
|
| 51 |
device = "cuda"
|
|
|
|
| 69 |
|
| 70 |
# base_pipe = nexfort_compile(base_pipe)
|
| 71 |
|
| 72 |
+
ccnf = CompilationConfig.Default()
|
| 73 |
+
|
| 74 |
+
ccnf.enable_xformers = True
|
| 75 |
+
ccnf.enable_triton = True
|
| 76 |
+
ccnf.enable_cuda_graph = True
|
| 77 |
+
|
| 78 |
+
base_pipe = compile(base_pipe, ccnf)
|
| 79 |
+
|
| 80 |
from gfpgan.utils import GFPGANer
|
| 81 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
| 82 |
from realesrgan.utils import RealESRGANer
|
requirements.txt
CHANGED
|
@@ -9,4 +9,6 @@ git+https://github.com/XPixelGroup/BasicSR@master
|
|
| 9 |
gfpgan
|
| 10 |
facexlib
|
| 11 |
realesrgan
|
| 12 |
-
|
|
|
|
|
|
|
|
|
| 9 |
gfpgan
|
| 10 |
facexlib
|
| 11 |
realesrgan
|
| 12 |
+
stable-fast
|
| 13 |
+
triton
|
| 14 |
+
xformers
|