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 configuring allowed licenses for models/datasets #200

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

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Jan 26, 2025

Change log

Uses the zoo model/dataset license information introduced in voxel51/fiftyone#5438 in a backwards-compatible way to add support for optionally configuring which license(s) models and datasets must be distributed under in order to be used via core plugin's operators.

All core operators that make use of the zoo have been updated:

  • @voxel51/zoo/apply_zoo_model
  • @voxel51/zoo/load_zoo_dataset
  • @voxel51/brain/compute_visualization
  • @voxel51/brain/compute_similarity
  • @voxel51/brain/compute_uniqueness

The allowed licenses are configured by setting the following plugin secrets:

export FIFTYONE_ZOO_ALLOWED_MODEL_LICENSES="MIT,Apache 2.0"
export FIFTYONE_ZOO_ALLOWED_DATASET_LICENSES="CC-BY-SA-3.0,CC-BY-4.0"

Example usage

Limiting to valid licenses

export FIFTYONE_ZOO_ALLOWED_MODEL_LICENSES="MIT,Apache 2.0"
export FIFTYONE_ZOO_ALLOWED_DATASET_LICENSES="CC-BY-SA-3.0,CC-BY-4.0"
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
Screenshot 2025-01-26 at 2 00 48 PM Screenshot 2025-01-26 at 2 01 05 PM Screenshot 2025-01-26 at 2 03 50 PM Screenshot 2025-01-26 at 2 01 38 PM Screenshot 2025-01-26 at 1 54 43 PM

Behavior when no models/datasets match the required licenses

export FIFTYONE_ZOO_ALLOWED_MODEL_LICENSES=FOOBAR
export FIFTYONE_ZOO_ALLOWED_DATASET_LICENSES=FOOBAR
import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset)
Screenshot 2025-01-26 at 2 07 33 PM Screenshot 2025-01-26 at 2 07 44 PM Screenshot 2025-01-26 at 2 07 10 PM Screenshot 2025-01-26 at 2 07 23 PM

Note in the case below: there is no error message because the model field is optional for this workflow (FO has a default model that is used internally)

Screenshot 2025-01-26 at 2 13 15 PM

@brimoor brimoor requested review from allenleetc and a team January 26, 2025 19:41

def _get_zoo_models_with_embeddings(ctx, inputs):
# @todo can remove this if we require `fiftyone>=1.4.0`
if Version(fo.__version__) >= Version("1.4.0"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an issue here if the Brain plugin is installed in Teams? fo.__version__ can then match/exceed 1.4.0 without desired code updates, eg fozm._list_zoo_models(license=None) would error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good call, I used the wrong thing. Updated to use fiftyone.constants.VERSION

def _get_zoo_datasets(ctx, inputs):
# @todo can remove this if we require `fiftyone>=1.4.0`
if Version(fo.__version__) >= Version("1.4.0"):
licenses = _get_allowed_dataset_licenses(ctx, inputs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment re Version numbers in Teams

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

plugins/zoo/__init__.py Outdated Show resolved Hide resolved
@brimoor brimoor requested a review from allenleetc January 29, 2025 14:19
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