Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance aiRunnerImage flag #3284

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ func parseLivepeerConfig() starter.LivepeerConfig {
cfg.AIWorker = flag.Bool("aiWorker", *cfg.AIWorker, "Set to true to run an AI worker")
cfg.AIModels = flag.String("aiModels", *cfg.AIModels, "Set models (pipeline:model_id) for AI worker to load upon initialization")
cfg.AIModelsDir = flag.String("aiModelsDir", *cfg.AIModelsDir, "Set directory where AI model weights are stored")
cfg.AIRunnerImage = flag.String("aiRunnerImage", *cfg.AIRunnerImage, "Set the docker image for the AI runner: Example - livepeer/ai-runner:0.0.1")
cfg.AIRunnerImage = flag.String("aiRunnerImage", *cfg.AIRunnerImage, "[Deprecated] Specify the base Docker image for the AI runner. Example: livepeer/ai-runner:0.0.1. Use -aiRunnerImageOverrides instead.")
cfg.AIRunnerImageOverrides = flag.String("aiRunnerImageOverrides", *cfg.AIRunnerImageOverrides, `Specify overrides for the Docker images used by the AI runner. Example: '{"default": "livepeer/ai-runner:v1.0", "batch": {"text-to-speech": "livepeer/ai-runner:text-to-speech-v1.0"}, "live": {"another-pipeline": "livepeer/ai-runner:another-pipeline-v1.0"}}'`)

// Live AI:
cfg.MediaMTXApiPassword = flag.String("mediaMTXApiPassword", "", "HTTP basic auth password for MediaMTX API requests")
Expand Down
38 changes: 29 additions & 9 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
OrchMinLivepeerVersion *string
TestOrchAvail *bool
AIRunnerImage *string
AIRunnerImageOverrides *string
KafkaBootstrapServers *string
KafkaUsername *string
KafkaPassword *string
Expand Down Expand Up @@ -214,6 +215,7 @@
defaultAIModels := ""
defaultAIModelsDir := ""
defaultAIRunnerImage := "livepeer/ai-runner:latest"
defaultAIRunnerImageOverrides := ""
defaultLiveAIAuthWebhookURL := ""
defaultLivePaymentInterval := 5 * time.Second
defaultGatewayHost := ""
Expand Down Expand Up @@ -318,14 +320,15 @@
TestTranscoder: &defaultTestTranscoder,

// AI:
AIServiceRegistry: &defaultAIServiceRegistry,
AIWorker: &defaultAIWorker,
AIModels: &defaultAIModels,
AIModelsDir: &defaultAIModelsDir,
AIRunnerImage: &defaultAIRunnerImage,
LiveAIAuthWebhookURL: &defaultLiveAIAuthWebhookURL,
LivePaymentInterval: &defaultLivePaymentInterval,
GatewayHost: &defaultGatewayHost,
AIServiceRegistry: &defaultAIServiceRegistry,
AIWorker: &defaultAIWorker,
AIModels: &defaultAIModels,
AIModelsDir: &defaultAIModelsDir,
AIRunnerImage: &defaultAIRunnerImage,
AIRunnerImageOverrides: &defaultAIRunnerImageOverrides,
LiveAIAuthWebhookURL: &defaultLiveAIAuthWebhookURL,
LivePaymentInterval: &defaultLivePaymentInterval,
GatewayHost: &defaultGatewayHost,

// Onchain:
EthAcctAddr: &defaultEthAcctAddr,
Expand Down Expand Up @@ -1211,7 +1214,24 @@
return
}

n.AIWorker, err = worker.NewWorker(*cfg.AIRunnerImage, gpus, modelsDir)
// Retrieve image overrides from the config.
var imageOverrides worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-cpu-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-cpu-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-gpu-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-gpu-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for windows-cpu-amd64

undefined: worker.ImageOverrides
if *cfg.AIRunnerImageOverrides != "" {
if err := json.Unmarshal([]byte(*cfg.AIRunnerImageOverrides), &imageOverrides); err != nil {
glog.Errorf("Error unmarshaling image overrides: %v", err)
return
}
}

// Backwards compatibility for deprecated flags.
if *cfg.AIRunnerImage != "" {
glog.Warning("-aiRunnerImage flag is deprecated and will be removed in a future release. Please use -aiWorkerImageOverrides instead")
if imageOverrides.Default == "" {
imageOverrides.Default = *cfg.AIRunnerImage
}
}

n.AIWorker, err = worker.NewWorker(imageOverrides, gpus, modelsDir)
if err != nil {
glog.Errorf("Error starting AI worker: %v", err)
return
Expand Down
Loading