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

DATA-3467: Cloud Inference CLI #4748

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vpandiarajan20
Copy link
Member

@vpandiarajan20 vpandiarajan20 commented Jan 27, 2025

Adds CLI command for running cloud inference.

Use with commands of the following form

viam infer --org-id=0fbe951e-d4c6-427f-985f-784b7b85842c --file-org-id=0fbe951e-d4c6-427f-985f-784b7b85842c --file-id=p5jysh0TSjQgSAHBJ2R0A9iZ9EuHT6fZE03TCDZChcitjsU25b2OZTeW9V0hLi4S --file-location-id=nihu6z0k8c --model-org-id=0fbe951e-d4c6-427f-985f-784b7b85842c --model-name=vig-dense-ret --model-version=2025-01-27T15-28-38

Tested manually with sample data:
image
Screenshot 2025-02-04 at 3 38 33 PM

@vpandiarajan20 vpandiarajan20 requested a review from a team as a code owner January 27, 2025 20:39
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jan 27, 2025
@vpandiarajan20 vpandiarajan20 marked this pull request as draft January 27, 2025 20:41
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 28, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 28, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 30, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 31, 2025
@vpandiarajan20 vpandiarajan20 marked this pull request as ready for review January 31, 2025 16:36

// printInferenceResponse prints a neat representation of the GetInferenceResponse.
func (c *viamClient) printInferenceResponse(resp *mlinferencepb.GetInferenceResponse) {
printf(c.c.App.Writer, "Inference Response:")
Copy link
Member

Choose a reason for hiding this comment

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

You would know better than I would but is this the kind of format that you would want? Meaning, normally from a CLI I would expect JSON or something configurable that I can do programmatically. But I also know absolutely nothing about ML and this could be the way ML people want the response.

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, this format isn't very good for most usecases, but it's readable. I think the primary use case of this command will be to debug / easily check if the service is functioning.

Copy link
Member

@etai-shuchatowitz etai-shuchatowitz left a comment

Choose a reason for hiding this comment

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

This LGTM! I'm going to approve but I would recommend waiting for @tahiyasalam to give a review as she almost certainly will have more insight than I about the response type and just wanna make sure we're matching what is expected.

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

good from sdk-land

Copy link
Member

@tahiyasalam tahiyasalam left a comment

Choose a reason for hiding this comment

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

Wooh! Thanks so much for doing this! 2 Qs/comments from me.

cli/app.go Outdated
Required: true,
},
&cli.StringFlag{
Name: inferenceFlagModelID,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should try to have parity with the training CLI, where we specify model-org-ID and model-name to uniquely identify the registry ID https://github.com/viamrobotics/rdk/blob/main/cli/ml_training.go#L22

I think we should either have both training and inference require:

  • model org ID + name + version OR
  • registry ID + version

I'll leave it up to you decide what makes the most sense.

printf(c.c.App.Writer, " No output tensors.")
}

printf(c.c.App.Writer, "Annotations:")
Copy link
Member

Choose a reason for hiding this comment

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

Can we just include here the format [x_min, y_min, x_max, y_max]

@viambot viambot removed the safe to test This pull request is marked safe to test from a trusted zone label Feb 4, 2025
@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Feb 4, 2025
Copy link
Member

@tahiyasalam tahiyasalam left a comment

Choose a reason for hiding this comment

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

One more q! But otherwise looks great, thank you

cli/app.go Outdated Show resolved Hide resolved
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 5, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Feb 5, 2025
Copy link
Member

@tahiyasalam tahiyasalam left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants