Skip to content

examples: Add test run for lv2v #4

examples: Add test run for lv2v

examples: Add test run for lv2v #4

name: FPS check for live-video-to-video pipelines
on:
pull_request:
paths:
- "runner/**"
- "!runner/.devcontainer/**"
push:
branches:
- main
tags:
- '*'
paths:
- "runner/**"
- "!runner/.devcontainer/**"
workflow_dispatch:
jobs:
run-fps-test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
model_config:
- { id: noop, input_fps: 30, exp_output_fps: 28 }
- { id: liveportrait, input_fps: 30, exp_output_fps: 28 }
- { id: streamdiffusion, input_fps: 30, exp_output_fps: 28 }
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.3'
- name: Build Docker images
env:
MODEL_ID: ${{ matrix.model_config.id }}
run: |
cd runner
docker build -t livepeer/ai-runner:live-base -f docker/Dockerfile.live-base .
if [ "${MODEL_ID}" = "noop" ]; then
docker build -t livepeer/ai-runner:live-app-noop -f docker/Dockerfile.live-app-noop .
else
docker build -t livepeer/ai-runner:live-base-${MODEL_ID} -f docker/Dockerfile.live-base-${MODEL_ID} .
docker build -t livepeer/ai-runner:live-app-${MODEL_ID} -f docker/Dockerfile.live-app__PIPELINE__ --build-arg PIPELINE=${MODEL_ID} .
fi
cd ..
- name: Install packages
run: |
apt-get update && apt-get install -y libzmq3-dev
rm -rf /var/lib/apt/lists/*
- name: Clean up runner dockers
run: |
CONTAINERS=$(docker ps -aq --filter name=live-video-to-video_${MODEL_ID}*)
if [ -n "$CONTAINERS" ]; then
echo "Removing containers: $CONTAINERS"
echo "$CONTAINERS" | xargs -r docker rm -f
else
echo "No containers to remove for model ${MODEL_ID}"
fi
- name: Run FPS test
env:
MODEL_ID: ${{ matrix.model_config.id }}
INPUT_FPS: ${{ matrix.model_config.input_fps }}
EXP_OUTPUT_FPS: ${{ matrix.model_config.exp_output_fps }}
run: |
# Redirect both stdout and stderr to a file and tee to console
go run cmd/examples/live-video-to-video/main.go \
-modelid=${MODEL_ID} \
-inputfps=${INPUT_FPS} \
-expoutputfps=${EXP_OUTPUT_FPS} 2>&1 | tee output.log
# Use grep with the timestamp pattern to find the TEST PASSED/FAILED message
if grep -q "INFO TEST PASSED!" output.log; then
echo "Test for ${MODEL_ID} pipeline PASSED"
exit 0
elif grep -q "INFO TEST FAILED!" output.log; then
echo "Test for ${MODEL_ID} pipeline FAILED"
exit 1
else
echo "Test for ${MODEL_ID} pipeline had an unknown result"
echo "Full log output:"
cat output.log
exit 1
fi