Skip to content

Commit

Permalink
runner: Add SDXL-Lightning to modal
Browse files Browse the repository at this point in the history
  • Loading branch information
yondonfu committed Feb 23, 2024
1 parent 10a6e45 commit eddeb15
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions runner/modal_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
from app.routes import health

stub = Stub("livepeer-ai-runner")
pipeline_image = Image.from_registry("livepeer/ai-runner:latest").workdir("/app")
pipeline_image = (
Image.from_registry("livepeer/ai-runner:latest")
.workdir("/app")
.env({"BFLOAT16": "true"})
)
api_image = Image.debian_slim(python_version="3.11").pip_install(
"pydantic==2.6.1", "fastapi==0.109.2", "pillow"
)
Expand All @@ -35,7 +39,7 @@ def download_model(model_id: str):

try:
# TODO: Handle case where there are no fp16 safetensors available
allow_patterns = ["*.fp16.safetensors", "*.json", "*.txt"]
allow_patterns = ["*unet.safetensors", "*.fp16.safetensors", "*.json", "*.txt"]
ignore_patterns = [".onnx", ".onnx_data"]
cache_dir = "/models"

Expand Down Expand Up @@ -112,8 +116,8 @@ def make_api(pipeline: str, model_id: str):

@stub.function(image=api_image, secrets=[Secret.from_name("api-auth-token")])
@asgi_app()
def text_to_image_sd_turbo_api():
return make_api("text-to-image", "stabilityai/sd-turbo")
def text_to_image_sdxl_lightning_api():
return make_api("text-to-image", "ByteDance/SDXL-Lightning")


@stub.function(image=api_image, secrets=[Secret.from_name("api-auth-token")])
Expand Down

0 comments on commit eddeb15

Please sign in to comment.