-
Notifications
You must be signed in to change notification settings - Fork 3
Using Other OpenCLIP Models
John Bradley edited this page Sep 10, 2024
·
4 revisions
By default pybioclip uses the bioclip model at hf-hub:imageomics/bioclip.
Other OpenCLIP models can be used but only when predicting with a list of custom classes.
The bioclip
command line tool provides --model
and --pretrained
arguments to specify an alternate model to use.
See open_clip model loading documentation for more details about values that can be used for the --model
and --pretrained
arguments.
Download an image from the bioclip-demo.
wget https://huggingface.co/spaces/imageomics/bioclip-demo/resolve/main/examples/Ursus-arctos.jpeg
bioclip list-models
Output:
...
ViT-B-16
ViT-B-16-plus
...
Next we will see what pretrained models are available for the ViT-B-16
model.
bioclip list-models --model ViT-B-16
Output:
...
laion2b_s34b_b88k
...
bioclip predict --cls duck,fish,bear --model ViT-B-16 --pretrained laion2b_s34b_b88k Ursus-arctos.jpeg
from bioclip import CustomLabelsClassifier
classifier = CustomLabelsClassifier(
cls_ary = ["duck","fish","bear"],
model_str='ViT-B-16',
pretrained_str='laion2b_s34b_b88k')
print(classifier.predict("Ursus-arctos.jpeg"))