Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 2.93 KB

README.md

File metadata and controls

69 lines (45 loc) · 2.93 KB

ai-runner

Warning

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.

This repository hosts the AI runner for processing AI inference jobs on the Livepeer network.

Overview

The AI runner is a containerized Python application which processes inference requests on Livepeer AI's Pipelines and models. It loads models into GPU memory and exposes a REST API other programs like the Livepeer node AI worker can use to request AI inference requests. The AI runner code sits in the runner directory.

Build

To build the AI runner locally and run examples, follow these steps:

  1. Follow the instructions in this document to download model checkpoints and build the runner image.
  2. Generate Go bindings for the runner OpenAPI spec with make codegen.
  3. Run any examples in the cmd/examples directory, e.g., go run cmd/examples/text-to-image/main.go <RUNS> <PROMPT>.

Architecture

A high level sketch of how the runner is used:

Architecture

The AI runner, found in the app directory, consists of:

  • Routes: FastAPI routes in app/routes that handle requests and delegate them to the appropriate pipeline.
  • Pipelines: Modules in app/pipelines that manage model loading, request processing, and response generation for specific AI tasks.

It also includes utility scripts:

OpenAPI Specification

Regenerate the OpenAPI specification for the AI runner's API endpoints with:

python gen_openapi.py

To correspondingly generate the Go client bindings in the go-livepeer repository, you should clone livepeer/go-livepeer and run:

# in the go-livepeer repo
make ai_worker_codegen

Alternatively, if you want to test the client from a development version of ai-runner, you can specify a commit hash or branch to generate from. e.g.:

# for commit `aa7ab76`
make ai_worker_codegen REF=aa7ab76
# for branch `vg/test`
make ai_worker_codegen REF=refs/heads/vg/test

Development documentation

For more on developing and debugging the AI runner, see the development documentation.

Credits

Based off of this repo.