-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runner: Support stable-fast using env var
- Loading branch information
Showing
7 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from sfast.compilers.diffusion_pipeline_compiler import compile, CompilationConfig | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def compile_model(model): | ||
config = CompilationConfig.Default() | ||
|
||
# xformers and Triton are suggested for achieving best performance. | ||
# It might be slow for Triton to generate, compile and fine-tune kernels. | ||
try: | ||
import xformers | ||
|
||
config.enable_xformers = True | ||
except ImportError: | ||
logger.info("xformers not installed, skip") | ||
# NOTE: | ||
# When GPU VRAM is insufficient or the architecture is too old, Triton might be slow. | ||
# Disable Triton if you encounter this problem. | ||
try: | ||
import triton | ||
|
||
config.enable_triton = True | ||
except ImportError: | ||
logger.info("Triton not installed, skip") | ||
|
||
model = compile(model, config) | ||
return model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ pydantic | |
Pillow | ||
python-multipart | ||
uvicorn | ||
huggingface_hub | ||
huggingface_hub | ||
xformers==0.0.23 | ||
triton>=2.1.0 |