Skip to content

Commit

Permalink
Merge pull request #1691 from Rusteam/clip
Browse files Browse the repository at this point in the history
Add CLIP to the model zoo
  • Loading branch information
brimoor committed Sep 8, 2022
2 parents 6e6d389 + aff70ef commit e60f96a
Show file tree
Hide file tree
Showing 7 changed files with 1,022 additions and 1 deletion.
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 %}
# 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

0 comments on commit e60f96a

Please sign in to comment.