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 CLIP to the model zoo #1691

Merged
merged 6 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/scripts/make_model_zoo_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@
dataset.apply_model(model, label_field="predictions")

session = fo.launch_app(dataset)

{% if 'zero-shot' in tags %}
Rusteam marked this conversation as resolved.
Show resolved Hide resolved
# Make zero-shot label predictions with custom class labels

custom_labels = ["person", "dog", "cat", "bird", "car", "tree", "chair"] # can be any list of strings
text_prompt = "A photo of a" # will be prepended to each class label

model = foz.load_zoo_model("{{ name }}", class_labels=custom_labels, text_prompt=text_prompt)

dataset.apply_model(model, label_field="predictions")

session = fo.launch_app(dataset)
{% endif %}
"""


Expand Down
6 changes: 6 additions & 0 deletions fiftyone/utils/clip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""CLIP model utils.
"""

from .model import build_model
from .tokenizer import SimpleTokenizer
from .zoo import TorchCLIPModelConfig, TorchCLIPModel