Skip to content

Commit

Permalink
Merge branch 'main' into frame-interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
JJassonn69 committed Sep 20, 2024
2 parents a8222ff + a6d233c commit a0de82a
Show file tree
Hide file tree
Showing 52 changed files with 3,692 additions and 1,620 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[flake8]
max-line-length = 88
extend-ignore = E203,E701
per-file-ignores =
__init__.py: F401
101 changes: 101 additions & 0 deletions .github/workflows/ai-runner-pipelines-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Build ai-runner pipeline Docker images

on:
pull_request:
paths:
- "runner/**"
- "!runner/.devcontainer/**"
push:
branches:
- main
tags:
- '*'
paths:
- "runner/**"
- "!runner/.devcontainer/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
sam2-docker:
name: SAM2 Docker image generation
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
permissions:
packages: write
contents: read
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Cleanup hosted runner
run: |
sudo apt purge -yqq dotnet-* mono-* llvm-* libllvm* powershell* openjdk-* \
temurin-* mongodb-* firefox mysql-* \
hhvm google-chrome-stable \
libgl1-mesa-dri microsoft-edge-stable azure-cli || true
sudo apt autoremove -y
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.CI_DOCKERHUB_USERNAME }}
password: ${{ secrets.CI_DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
livepeer/ai-runner
tags: |
type=raw,value=sam2
type=raw,value=segment-anything-2
type=sha,prefix=sam2-
type=ref,event=pr,prefix=sam2-
type=ref,event=tag,prefix=sam2-
type=sha,format=long,prefix=sam2-
type=ref,event=branch,prefix=sam2-
type=semver,pattern={{version}},prefix=sam2-
type=semver,pattern={{major}}.{{minor}},prefix=sam2-
type=semver,pattern={{version}},prefix=sam2-v
type=semver,pattern={{major}}.{{minor}},prefix=sam2-v
type=raw,value=latest,enable={{is_default_branch}},prefix=sam2-
type=raw,value=${{ github.event.pull_request.head.ref }},enable=${{ github.event_name == 'pull_request' }},prefix=sam2-
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }},prefix=sam2-
- name: Build and push runner docker image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:runner"
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: "Dockerfile"
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=livepeerci/build:cache
cache-to: type=registry,ref=livepeerci/build:cache,mode=max

- name: Build and push runner docker image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:runner"
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
file: "docker/Dockerfile.segment_anything_2"
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=livepeerci/build:cache
cache-to: type=registry,ref=livepeerci/build:cache,mode=max
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Docker image for ai-runner
name: Build ai-runner base Docker image

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

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -21,7 +22,7 @@ concurrency:
jobs:
docker:
name: Docker image generation
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch'
permissions:
packages: write
contents: read
Expand Down Expand Up @@ -49,7 +50,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
livepeer/ai-runner
jjassonn69/ai-runner
tags: |
type=sha
type=ref,event=pr
Expand All @@ -61,6 +62,7 @@ jobs:
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=base,enable={{is_default_branch}}
type=raw,value=${{ github.event.pull_request.head.ref }}
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }}
Expand All @@ -73,5 +75,5 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
file: "Dockerfile"
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=livepeerci/build:cache
cache-to: type=registry,ref=livepeerci/build:cache,mode=max
cache-from: type=registry,ref=jjassonn69/build:cache
cache-to: type=registry,ref=jjassonn69/build:cache,mode=max
30 changes: 0 additions & 30 deletions .github/workflows/trigger-upstream-openapi-sync.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Check OpenAPI spec and Golang bindings

on:
push:
branches:
- main
pull_request:

jobs:
Expand All @@ -9,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ codegen:
go run github.com/deepmap/oapi-codegen/v2/cmd/[email protected] \
-package worker \
-generate types,client,chi-server,spec \
runner/openapi.json \
runner/openapi.yaml \
| awk '!/WARNING/' > worker/runner.gen.go
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# ai-worker

> [!NOTE]
> This branch will explore adding AI inference to realtime video streams. Majority of the commits here will likely change significantly and not intended for production purposes.
> [!WARNING]
> This is a prototype repository undergoing rapid changes. It's not intended for production use yet.
> The AI network is in it's **Beta** phase and although it is ready for production it is still under development. Please report any issues you encounter to the [Livepeer Discord](https://discord.gg/7nbPbTK).
This repository hosts the AI worker and runner for processing inference requests on the Livepeer AI subnet.

Expand Down
2 changes: 1 addition & 1 deletion cmd/examples/image-to-image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func main() {
imageFile := types.File{}
imageFile.InitFromBytes(imageBytes, imagePath)

req := worker.ImageToImageMultipartRequestBody{
req := worker.GenImageToImageMultipartRequestBody{
Image: imageFile,
ModelId: &modelID,
Prompt: prompt,
Expand Down
2 changes: 1 addition & 1 deletion cmd/examples/image-to-video/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
imageFile := types.File{}
imageFile.InitFromBytes(imageBytes, imagePath)

req := worker.ImageToVideoMultipartRequestBody{
req := worker.GenImageToVideoMultipartRequestBody{
Image: imageFile,
ModelId: &modelID,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/examples/text-to-image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func main() {

prompt := args[1]

req := worker.TextToImageJSONRequestBody{
req := worker.GenTextToImageJSONRequestBody{
ModelId: &modelID,
Prompt: prompt,
}
Expand Down
20 changes: 12 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.5
require (
github.com/deepmap/oapi-codegen/v2 v2.2.0
github.com/docker/cli v24.0.5+incompatible
github.com/docker/docker v24.0.7+incompatible
github.com/docker/docker v26.1.5+incompatible
github.com/docker/go-connections v0.4.0
github.com/getkin/kin-openapi v0.124.0
github.com/go-chi/chi/v5 v5.0.12
Expand All @@ -16,16 +16,20 @@ require (
require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/swag v0.22.8 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/morikuni/aec v1.0.0 // indirect
Expand All @@ -34,11 +38,11 @@ require (
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/tools v0.21.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
)
Loading

0 comments on commit a0de82a

Please sign in to comment.