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

Add support for remote zoo model parameters #201

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

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Jan 27, 2025

Requires voxel51/fiftyone#5439

Change log

The @voxel51/zoo/apply_zoo_model operator now automatically injects any custom parameters defined by remote zoo models into the operator's input form.

Example usage

Applying a CLIP model from voxel51/openai-clip

Screenshot 2025-01-26 at 7 45 45 PM

Applying a YOLO world model from ultralytics-models

Screenshot 2025-01-26 at 7 46 16 PM

Output

Screenshot 2025-01-26 at 7 46 40 PM

if Version(fo.__version__) >= Version("1.4.0"):
if isinstance(zoo_model, foz.RemoteZooModel):
obj = types.Object()
zoo_model._get_parameters(ctx, obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why _get_parameters() instead of get_parameters() mostly curious...?

I would rather have:

zoo_inputs = zoo_model.resolve_input(ctx) # returns a types.Property()

Which would be more consistent IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd love to have consistency too, but the issue is that resolve_input() returns a types.Property while in this situation, we don't want to define an entire form but rather inject a few parameters into an existing form.

Note that we just shipped a similar pattern for EvaluationMetric operators. Example usage here.

I'm definitely open to alternatives here, including changing the interface for evaluation metrics. Just not sure what to do! What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'm an idiot, we could just do this couldn't we 🤦

prop = zoo_model.resolve_input(ctx)
inputs.add_property("remote_params", prop)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ritch okay switched to using resolve_input() here and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants