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

feat: detach resources from providers #53

Merged
merged 22 commits into from
Apr 15, 2024

Conversation

eloy-encord
Copy link
Contributor

Types and definitions of models and datasets are now dynamically fetched from a sources folder. With this change, previously built-in resources can be modified, silenced or eliminated if the user wants to. Also, enables seamless addition of new models and datasets by just adding the corresponding implementation (new type) or definition (instance of an existing type).

On the side, refactored the naming convention of several components that were moved with the previous changes, so they share the same patterns. E.g. the model base class went from CLIPModel to Model as the class itself is related to a higher abstraction than the one of clip.

Also, added the singleton pattern and some minor changes to the dataset and model providers in order to avoid partially initialised module errors that appeared when dynamic resources were (tried) loaded before all local resources were successfully imported. The singleton pattern is specifically used to avoid the creation of several provider instances as the original global provider couldn't be loaded on initialisation.

Uses an internal project json to record the label rows that have been completely downloaded, thus avoiding any further check on their images. Also, label rows' contents that are already up-to-date won't be downloaded again, even when `overwrite_annotations` is set to `True` (via last edited datetime comparison).
Reduce list_label_rows_v2 calls on already downloaded projects while keeping a small overhead on unseen datasets.
Add singleton pattern to providers in order to ensure that loading data from sources is performed after all built-in imports have been resolved. Otherwise, we will find partially initialised module errors.
@eloy-encord eloy-encord force-pushed the eloy/feat-detach-resources-from-providers branch from 9621488 to 1b3d592 Compare April 12, 2024 09:02
Providers not longer need to call the prepare method as it's now embedded in the remaining methods.
sources/models/model-definition-template.json Outdated Show resolved Hide resolved
clip_eval/models/provider.py Show resolved Hide resolved
clip_eval/dataset/provider.py Show resolved Hide resolved
@eloy-encord eloy-encord merged commit 354a5a0 into main Apr 15, 2024
1 check passed
@eloy-encord eloy-encord deleted the eloy/feat-detach-resources-from-providers branch April 15, 2024 08:58
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