Skip to content

Commit 7f53ae7

Browse files
committed
Fix loading of default params
1 parent 77ef923 commit 7f53ae7

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

.github/workflows/ai-runner-docker-live-streamdiffusion.yaml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,6 @@ jobs:
7474
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
7575
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
7676

77-
- name: Load params for subtype
78-
id: params_json
79-
shell: bash
80-
run: |
81-
set -ex
82-
83-
PARAM_NAME="$(echo "${{ matrix.subtype }}" | tr '-' '_')"
84-
JSON_FILE="live/streamdiffusion/default_params/${PARAM_NAME}.json"
85-
if [ ! -f "$JSON_FILE" ]; then
86-
echo "Params file missing: $JSON_FILE" >&2
87-
exit 1
88-
fi
89-
90-
JSON_COMPACT=$(tr -d '\n' < "$JSON_FILE")
91-
echo "json_compact=$JSON_COMPACT" >> "$GITHUB_OUTPUT"
92-
9377
- name: Build and push pipeline app image
9478
id: build-app
9579
uses: docker/build-push-action@v6
@@ -102,7 +86,7 @@ jobs:
10286
build-args: |
10387
GIT_SHA=${{ (github.ref_type == 'tag' && github.ref_name) || (github.event.pull_request.head.sha || github.sha) }}
10488
VERSION=${{ steps.version.outputs.version }}
105-
PIPE_INITIAL_PARAMS=${{ steps.params_json.outputs.json_compact }}
89+
SUBVARIANT=${{ matrix.subtype }}
10690
platforms: linux/amd64
10791
tags: ${{ steps.meta.outputs.tags }}
10892
annotations: ${{ steps.meta.outputs.annotations }}

live/streamdiffusion/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN uv run python -m streamdiffusion.tools.install-tensorrt
2020
COPY runner/app/ /app/runner/app/
2121
COPY runner/images/ /app/runner/images/
2222
COPY live/streamdiffusion/pipeline ./pipeline/
23+
COPY live/streamdiffusion/default_params ./default_params/
2324
COPY live/streamdiffusion/main.py ./main.py
2425

2526
# Need --inexact to keep packages installed from install-tensorrt
@@ -38,10 +39,10 @@ ENV HF_HUB_ENABLE_HF_TRANSFER=1 \
3839

3940
ARG GIT_SHA
4041
ARG VERSION="undefined"
41-
ARG PIPE_INITIAL_PARAMS
42+
ARG SUBVARIANT="sdturbo"
4243

4344
ENV GIT_SHA="${GIT_SHA}" \
4445
VERSION="${VERSION}" \
45-
PIPE_INITIAL_PARAMS="${PIPE_INITIAL_PARAMS}"
46+
SUBVARIANT="${SUBVARIANT}"
4647

4748
CMD ["uv", "run", "python", "main.py"]

live/streamdiffusion/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
import json
22
import os
3+
from pathlib import Path
34

45
from app.app import start_app
56
from app.pipelines.live_video_to_video import LiveVideoToVideoPipeline
67
from app.live.pipelines import PipelineSpec
78

8-
initial_params = json.loads(os.environ.get("PIPE_INITIAL_PARAMS", "{}"))
9+
initial_params = {}
10+
11+
subvariant = os.environ.get("SUBVARIANT")
12+
if subvariant:
13+
params_filename = subvariant.replace("-", "_") + ".json"
14+
params_path = Path(__file__).parent / "default_params" / params_filename
15+
16+
with open(params_path) as f:
17+
initial_params = json.load(f)
18+
19+
# Use subvariant as suffix unless it's sdturbo (default)
20+
name_suffix = "" if subvariant == "sdturbo" else f"-{subvariant}"
921

1022
pipeline_spec = PipelineSpec(
11-
name="streamdiffusion",
23+
name=f"streamdiffusion{name_suffix}",
1224
pipeline_cls="pipeline.pipeline:StreamDiffusion",
1325
params_cls="pipeline.params:StreamDiffusionParams",
1426
initial_params=initial_params,

runner/app/live/pipelines/spec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ class PipelineSpec(BaseModel):
2525
... )
2626
"""
2727
name: str = ""
28-
"""Identifier for the pipeline. Derived from pipeline_cls if not provided."""
28+
"""
29+
Identifier for the pipeline. Derived from pipeline_cls if not provided.
30+
This must match the MODEL_ID set by the Orchestrator for the runner container.
31+
"""
2932

3033
pipeline_cls: str
3134
"""Import path to the Pipeline subclass. e.g. "my_pipelines.module:MyPipeline" """

0 commit comments

Comments
 (0)