Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sfast_optimization'
Browse files Browse the repository at this point in the history
  • Loading branch information
JJassonn69 committed Sep 20, 2024
2 parents a6d233c + 3de64b3 commit 10fcadd
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build ai-runner base Docker image

on:
check_run:
pull_request:
paths:
- "runner/**"
- "!runner/.devcontainer/**"
Expand All @@ -13,7 +13,6 @@ on:
paths:
- "runner/**"
- "!runner/.devcontainer/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -22,7 +21,7 @@ concurrency:
jobs:
docker:
name: Docker image generation
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
permissions:
packages: write
contents: read
Expand Down Expand Up @@ -50,7 +49,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
jjassonn69/ai-runner
livepeer/ai-runner
tags: |
type=sha
type=ref,event=pr
Expand All @@ -75,5 +74,5 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
file: "Dockerfile"
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=jjassonn69/build:cache
cache-to: type=registry,ref=jjassonn69/build:cache,mode=max
cache-from: type=registry,ref=livepeerci/build:cache
cache-to: type=registry,ref=livepeerci/build:cache,mode=max
30 changes: 30 additions & 0 deletions .github/workflows/trigger-upstream-openapi-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Trigger upstream OpenAPI sync

on:
push:
paths:
- "runner/openapi.json"
workflow_dispatch:

jobs:
trigger-upstream-openapi-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Trigger docs AI OpenAPI spec update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.DOCS_TRIGGER_PAT }}
repository: livepeer/docs
event-type: update-ai-openapi
client-payload: '{"sha": "${{ github.sha }}"}'

- name: Trigger SDK generation
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.SDKS_TRIGGER_PAT }}
repository: livepeer/livepeer-ai-sdks
event-type: update-ai-openapi
client-payload: '{"sha": "${{ github.sha }}"}'
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Check OpenAPI spec and Golang bindings

on:
push:
branches:
- main
pull_request:

jobs:
Expand Down Expand Up @@ -46,4 +43,4 @@ jobs:
if ! git diff --exit-code; then
echo "::error::Go bindings have changed. Please run 'make' at the root of the repository and commit the changes."
exit 1
fi
fi
4 changes: 2 additions & 2 deletions runner/app/pipelines/optim/sfast.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This module provides a function to enable StableFast optimization for the pipeline.
For more information, see the DeepCache project on GitHub: https://github.com/chengzeyi/stable-fast
""" # noqa: E501
For more information, see the Stable Fast project on GitHub: https://github.com/chengzeyi/stable-fast
"""

import logging

Expand Down
6 changes: 3 additions & 3 deletions runner/app/pipelines/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ def __init__(self, model_id: str):
# TODO: Retrieve defaults from Pydantic class in route.
warmup_kwargs = {
"prompt": "Upscaling the pipeline with sfast enabled",
"image": PIL.Image.new("RGB", (576, 1024)),
"image": PIL.Image.new("RGB", (400, 400)), # anything higher than this size cause the model to OOM
}

logger.info("Warming up ImageToVideoPipeline pipeline...")
logger.info("Warming up Upscale pipeline...")
total_time = 0
for ii in range(SFAST_WARMUP_ITERATIONS):
t = time.time()
try:
self.ldm(**warmup_kwargs).images
except Exception as e:
# FIXME: When out of memory, pipeline is corrupted.
logger.error(f"ImageToVideoPipeline warmup error: {e}")
logger.error(f"Upscale pipeline warmup error: {e}")
raise e
iteration_time = time.time() - t
total_time += iteration_time
Expand Down

0 comments on commit 10fcadd

Please sign in to comment.