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

Merged

Conversation

RUFFY-369
Copy link
Contributor

@RUFFY-369 RUFFY-369 commented Nov 28, 2024

What does this pull request do? Explain your changes. (required)
Towards closing 'livepeer/bounties/#69

This PR improves the aiRunnerImage flag to accept both string and JSON string inputs by adding the doc. Functionality is on the ai-worker side.

Usage: aiRunnerImage="{'segment-anything-2': 'livepeer/ai-runner:segment-anything-2-v1.0'}"

Specific updates (required)

  • Usage doc has been added for the flag

How did you test each of these updates (required)

Test was performed by starting go-livepeer as aiWorker with aiRunnerImage="{'segment-anything-2': 'livepeer/ai-runner:segment-anything-2-v1.0'}" and verified launch version.

Does this pull request close any open issues?

Checklist:

cc @rickstaa

Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 8.33333% with 22 lines in your changes missing coverage. Please review.

Project coverage is 33.68632%. Comparing base (ede7d21) to head (d771df4).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/livepeer/starter/starter.go 0.00000% 22 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3284         +/-   ##
===================================================
- Coverage   33.69623%   33.68632%   -0.00991%     
===================================================
  Files            141         141                 
  Lines          37476       37490         +14     
===================================================
+ Hits           12628       12629          +1     
- Misses         24126       24139         +13     
  Partials         722         722                 
Files with missing lines Coverage Δ
cmd/livepeer/livepeer.go 55.84416% <100.00000%> (+0.19199%) ⬆️
cmd/livepeer/starter/starter.go 7.45342% <0.00000%> (-0.06067%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ede7d21...d771df4. Read the comment docs.

Files with missing lines Coverage Δ
cmd/livepeer/livepeer.go 55.84416% <100.00000%> (+0.19199%) ⬆️
cmd/livepeer/starter/starter.go 7.45342% <0.00000%> (-0.06067%) ⬇️

@@ -160,7 +160,7 @@ 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, "Set the docker image for the AI runner: Example - livepeer/ai-runner:0.0.1 . You can also provide a JSON string to map specific pipeline names to custom images, allowing for pipeline-specific image overrides: Example - '{\"segment-anything-2\": \"livepeer/ai-runner:segment-anything-2-v1.0\", \"another-pipeline\": \"livepeer/ai-runner:another-pipeline-v2.0\"}'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cfg.AIRunnerImage = flag.String("aiRunnerImage", *cfg.AIRunnerImage, "Set the docker image for the AI runner: Example - livepeer/ai-runner:0.0.1 . You can also provide a JSON string to map specific pipeline names to custom images, allowing for pipeline-specific image overrides: Example - '{\"segment-anything-2\": \"livepeer/ai-runner:segment-anything-2-v1.0\", \"another-pipeline\": \"livepeer/ai-runner:another-pipeline-v2.0\"}'")
cfg.AIRunnerImage = flag.String("aiRunnerImage", *cfg.AIRunnerImage, `Set the docker image for the AI runner: Example - livepeer/ai-runner:0.0.1 . You can also provide a JSON string to map specific pipeline names to custom images, allowing for pipeline-specific image overrides: Example - '{"segment-anything-2": "livepeer/ai-runner:segment-anything-2-v1.0", "another-pipeline": "livepeer/ai-runner:another-pipeline-v2.0"}'`)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RUFFY-369 looks good! However, maybe we can use raw string literals to cleanup the code a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rickstaa Just pushed the commit for the suggestion. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks approved!

Copy link
Member

@rickstaa rickstaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙏🏻.

@ad-astra-video
Copy link
Collaborator

@rickstaa @RUFFY-369 Are we waiting on anything to merge this PR?

@RUFFY-369
Copy link
Contributor Author

@rickstaa @RUFFY-369 Are we waiting on anything to merge this PR?

@ad-astra-video In my opinion, I don't think so. We can have @rickstaa 's thought if he has something in mind before this merge

cmd/livepeer/livepeer.go Outdated Show resolved Hide resolved
@rickstaa rickstaa requested a review from victorges January 22, 2025 20:36
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just a small fix otherwise i think startup will fail without the overrides flag

cmd/livepeer/starter/starter.go Outdated Show resolved Hide resolved
@rickstaa rickstaa force-pushed the update/ai-runner-image-flag-support branch from 629570b to d401b46 Compare January 27, 2025 13:47
RUFFY-369 and others added 4 commits January 28, 2025 10:28
…des`

This commit introduces deprecation logic for the `aiRunnerImage` flag, replacing
it with a new `aiRunnerImageOverrides` flag. The new flag is designed to support
enhanced image override functionality as implemented in the worker logic
in [ai-worker PR livepeer#293](livepeer/ai-runner#293).
This commit ensures that the software functions correctly when imageOverrides
is empty. It also updates the description of the `aiRunnerImageOverrides` command
line flag.
@rickstaa rickstaa force-pushed the update/ai-runner-image-flag-support branch from d401b46 to 35c4ca9 Compare January 28, 2025 09:29
This commit ensures that the right ai-worker version is linked.
@rickstaa rickstaa merged commit 3f3aef3 into livepeer:master Jan 28, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants