Edit model card

CLIP Variants

The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.

See the original CLIP Model Card for more details on limitations and biases.

This repository holds OpenAI's CLIP models converted into many other variants, see below for more details.

Disclaimer & License

I haven't done many tests on these conversions. I've briefly tried the float16 versions, which seem very similar to the original float32, however the similarity seems to drop more with the qint8/quint8 versions as expected. I couldn't try qint8 as it seemed unsupported for some operations, but I'm including it for completeness. From a brief test the quint8 version seemed to work fine.

The license for the conversion code is MIT, the license for the models is the same as the original license for the OpenAI models (πŸ€·β€β™‚οΈ). I have no affiliation with OpenAI.

Acknowledgements

Example

See example.py

❯ python .\example.py
Loading visual model: models/clip-vit-base-patch32-visual-float16.onnx
Visual inference ready, input size 224, type tensor(float16)
Images shape: (2, 3, 224, 224)
Embeddings shape: (2, 512)

Loading textual model: models/clip-vit-base-patch32-textual-float16.onnx
Textual inference ready, input size 77, type tensor(int32)
Texts shape: (14, 77)
Embeddings shape: (14, 512)

flowers.jpg
  similarity  bar chart    text
------------  -----------  ---------------------------------------------------------------
    0.294922  >>>>>>>>     a close up photo of a cherry blossom
    0.267578  >>>>>>>>     cherry blossom
    0.249878  >>>>>>>      flowers
    0.242554  >>>>>>>      a photo taken on a bright and sunny day
    0.228882  >>>>>>       bees
    0.222778  >>>>>>       plant
    0.216187  >>>>>>       a photo taken on a dark and cloudy day
    0.201538  >>>>>>       ruhrgebiet
    0.196655  >>>>>        processing plant
    0.192139  >>>>>        a photo taken at midnight
    0.18689   >>>>>        industry
    0.177856  >>>>>        cars
    0.176636  >>>>>        dogs and cats
    0.111267  >>>          a large industrial plant with many pipes, walkways and railings

heavy-industry.jpg
  similarity  bar chart    text
------------  -----------  ---------------------------------------------------------------
    0.336182  >>>>>>>>>>   a large industrial plant with many pipes, walkways and railings
    0.316895  >>>>>>>>>    processing plant
    0.302002  >>>>>>>>>    industry
    0.27417   >>>>>>>>     ruhrgebiet
    0.254883  >>>>>>>      plant
    0.22876   >>>>>>       a photo taken on a dark and cloudy day
    0.219482  >>>>>>       a photo taken on a bright and sunny day
    0.211304  >>>>>>       a photo taken at midnight
    0.198608  >>>>>        cars
    0.190552  >>>>>        flowers
    0.181885  >>>>>        bees
    0.180542  >>>>>        cherry blossom
    0.174438  >>>>>        dogs and cats
    0.14917   >>>>         a close up photo of a cherry blossom

Parameters

The only format supported right now is Open Neural Network Exchange (ONNX).

All the currently available OpenAI models have been converted. Some of the IDs were taken from Open AI models on Hugging Face, others were made up following the same format.

Model name Model ID
RN50 resnet-50
RN101 resnet-101
RN50x4 resnet-50x4
RN50x16 resnet-50x16
RN50x64 resnet-50x64
RN50 resnet-50
RN50 resnet-50
RN50 resnet-50
ViT-B/16 vit-base-patch16
ViT-B/32 vit-base-patch32
ViT-L/14 vit-large-patch14
ViT-L/14@336px vit-large-patch14-336

As CLIP is a multimodal model, the original models are split into two separate "modes", one for processing images and the other for processing text.

Mode
visual
textual

The models were converted into multiple data types as well.

Data Type
float16
qint8
quint8

Variants

Path Model ID Mode Data Type Available Size (MB)
models/clip-resnet-50-visual-float32.onnx resnet-50 visual float32 βœ… 153
models/clip-resnet-50-visual-float16.onnx resnet-50 visual float16 βœ… 77
models/clip-resnet-50-visual-qint8.onnx resnet-50 visual qint8 βœ… 39
models/clip-resnet-50-visual-quint8.onnx resnet-50 visual quint8 βœ… 39
models/clip-resnet-50-textual-float32.onnx resnet-50 textual float32 βœ… 255
models/clip-resnet-50-textual-float16.onnx resnet-50 textual float16 βœ… 128
models/clip-resnet-50-textual-qint8.onnx resnet-50 textual qint8 βœ… 64
models/clip-resnet-50-textual-quint8.onnx resnet-50 textual quint8 βœ… 64
models/clip-resnet-101-visual-float32.onnx resnet-101 visual float32 βœ… 225
models/clip-resnet-101-visual-float16.onnx resnet-101 visual float16 βœ… 112
models/clip-resnet-101-visual-qint8.onnx resnet-101 visual qint8 βœ… 57
models/clip-resnet-101-visual-quint8.onnx resnet-101 visual quint8 βœ… 57
models/clip-resnet-101-textual-float32.onnx resnet-101 textual float32 βœ… 254
models/clip-resnet-101-textual-float16.onnx resnet-101 textual float16 βœ… 127
models/clip-resnet-101-textual-qint8.onnx resnet-101 textual qint8 βœ… 64
models/clip-resnet-101-textual-quint8.onnx resnet-101 textual quint8 βœ… 64
models/clip-resnet-50x4-visual-float32.onnx resnet-50x4 visual float32 βœ… 348
models/clip-resnet-50x4-visual-float16.onnx resnet-50x4 visual float16 βœ… 174
models/clip-resnet-50x4-visual-qint8.onnx resnet-50x4 visual qint8 βœ… 88
models/clip-resnet-50x4-visual-quint8.onnx resnet-50x4 visual quint8 βœ… 88
models/clip-resnet-50x4-textual-float32.onnx resnet-50x4 textual float32 βœ… 365
models/clip-resnet-50x4-textual-float16.onnx resnet-50x4 textual float16 βœ… 183
models/clip-resnet-50x4-textual-qint8.onnx resnet-50x4 textual qint8 βœ… 92
models/clip-resnet-50x4-textual-quint8.onnx resnet-50x4 textual quint8 βœ… 92
models/clip-resnet-50x16-visual-float32.onnx resnet-50x16 visual float32 βœ… 669
models/clip-resnet-50x16-visual-float16.onnx resnet-50x16 visual float16 βœ… 335
models/clip-resnet-50x16-visual-qint8.onnx resnet-50x16 visual qint8 βœ… 169
models/clip-resnet-50x16-visual-quint8.onnx resnet-50x16 visual quint8 βœ… 169
models/clip-resnet-50x16-textual-float32.onnx resnet-50x16 textual float32 βœ… 495
models/clip-resnet-50x16-textual-float16.onnx resnet-50x16 textual float16 βœ… 248
models/clip-resnet-50x16-textual-qint8.onnx resnet-50x16 textual qint8 βœ… 124
models/clip-resnet-50x16-textual-quint8.onnx resnet-50x16 textual quint8 βœ… 124
models/clip-resnet-50x64-visual-float32.onnx resnet-50x64 visual float32 βœ… 1681
models/clip-resnet-50x64-visual-float16.onnx resnet-50x64 visual float16 βœ… 840
models/clip-resnet-50x64-visual-qint8.onnx resnet-50x64 visual qint8 βœ… 424
models/clip-resnet-50x64-visual-quint8.onnx resnet-50x64 visual quint8 βœ… 424
models/clip-resnet-50x64-textual-float32.onnx resnet-50x64 textual float32 βœ… 812
models/clip-resnet-50x64-textual-float16.onnx resnet-50x64 textual float16 βœ… 406
models/clip-resnet-50x64-textual-qint8.onnx resnet-50x64 textual qint8 βœ… 204
models/clip-resnet-50x64-textual-quint8.onnx resnet-50x64 textual quint8 βœ… 204
models/clip-resnet-50-visual-float32.onnx resnet-50 visual float32 βœ… 153
models/clip-resnet-50-visual-float16.onnx resnet-50 visual float16 βœ… 77
models/clip-resnet-50-visual-qint8.onnx resnet-50 visual qint8 βœ… 39
models/clip-resnet-50-visual-quint8.onnx resnet-50 visual quint8 βœ… 39
models/clip-resnet-50-textual-float32.onnx resnet-50 textual float32 βœ… 255
models/clip-resnet-50-textual-float16.onnx resnet-50 textual float16 βœ… 128
models/clip-resnet-50-textual-qint8.onnx resnet-50 textual qint8 βœ… 64
models/clip-resnet-50-textual-quint8.onnx resnet-50 textual quint8 βœ… 64
models/clip-resnet-50-visual-float32.onnx resnet-50 visual float32 βœ… 153
models/clip-resnet-50-visual-float16.onnx resnet-50 visual float16 βœ… 77
models/clip-resnet-50-visual-qint8.onnx resnet-50 visual qint8 βœ… 39
models/clip-resnet-50-visual-quint8.onnx resnet-50 visual quint8 βœ… 39
models/clip-resnet-50-textual-float32.onnx resnet-50 textual float32 βœ… 255
models/clip-resnet-50-textual-float16.onnx resnet-50 textual float16 βœ… 128
models/clip-resnet-50-textual-qint8.onnx resnet-50 textual qint8 βœ… 64
models/clip-resnet-50-textual-quint8.onnx resnet-50 textual quint8 βœ… 64
models/clip-resnet-50-visual-float32.onnx resnet-50 visual float32 βœ… 153
models/clip-resnet-50-visual-float16.onnx resnet-50 visual float16 βœ… 77
models/clip-resnet-50-visual-qint8.onnx resnet-50 visual qint8 βœ… 39
models/clip-resnet-50-visual-quint8.onnx resnet-50 visual quint8 βœ… 39
models/clip-resnet-50-textual-float32.onnx resnet-50 textual float32 βœ… 255
models/clip-resnet-50-textual-float16.onnx resnet-50 textual float16 βœ… 128
models/clip-resnet-50-textual-qint8.onnx resnet-50 textual qint8 βœ… 64
models/clip-resnet-50-textual-quint8.onnx resnet-50 textual quint8 βœ… 64
models/clip-vit-base-patch16-visual-float32.onnx vit-base-patch16 visual float32 βœ… 345
models/clip-vit-base-patch16-visual-float16.onnx vit-base-patch16 visual float16 βœ… 173
models/clip-vit-base-patch16-visual-qint8.onnx vit-base-patch16 visual qint8 βœ… 87
models/clip-vit-base-patch16-visual-quint8.onnx vit-base-patch16 visual quint8 βœ… 87
models/clip-vit-base-patch16-textual-float32.onnx vit-base-patch16 textual float32 βœ… 254
models/clip-vit-base-patch16-textual-float16.onnx vit-base-patch16 textual float16 βœ… 127
models/clip-vit-base-patch16-textual-qint8.onnx vit-base-patch16 textual qint8 βœ… 64
models/clip-vit-base-patch16-textual-quint8.onnx vit-base-patch16 textual quint8 βœ… 64
models/clip-vit-base-patch32-visual-float32.onnx vit-base-patch32 visual float32 βœ… 352
models/clip-vit-base-patch32-visual-float16.onnx vit-base-patch32 visual float16 βœ… 176
models/clip-vit-base-patch32-visual-qint8.onnx vit-base-patch32 visual qint8 βœ… 89
models/clip-vit-base-patch32-visual-quint8.onnx vit-base-patch32 visual quint8 βœ… 89
models/clip-vit-base-patch32-textual-float32.onnx vit-base-patch32 textual float32 βœ… 254
models/clip-vit-base-patch32-textual-float16.onnx vit-base-patch32 textual float16 βœ… 127
models/clip-vit-base-patch32-textual-qint8.onnx vit-base-patch32 textual qint8 βœ… 64
models/clip-vit-base-patch32-textual-quint8.onnx vit-base-patch32 textual quint8 βœ… 64
models/clip-vit-large-patch14-visual-float32.onnx vit-large-patch14 visual float32 βœ… 1216
models/clip-vit-large-patch14-visual-float16.onnx vit-large-patch14 visual float16 βœ… 608
models/clip-vit-large-patch14-visual-qint8.onnx vit-large-patch14 visual qint8 βœ… 306
models/clip-vit-large-patch14-visual-quint8.onnx vit-large-patch14 visual quint8 βœ… 306
models/clip-vit-large-patch14-textual-float32.onnx vit-large-patch14 textual float32 βœ… 495
models/clip-vit-large-patch14-textual-float16.onnx vit-large-patch14 textual float16 βœ… 248
models/clip-vit-large-patch14-textual-qint8.onnx vit-large-patch14 textual qint8 βœ… 124
models/clip-vit-large-patch14-textual-quint8.onnx vit-large-patch14 textual quint8 βœ… 124
models/clip-vit-large-patch14-336-visual-float32.onnx vit-large-patch14-336 visual float32 βœ… 1217
models/clip-vit-large-patch14-336-visual-float16.onnx vit-large-patch14-336 visual float16 βœ… 609
models/clip-vit-large-patch14-336-visual-qint8.onnx vit-large-patch14-336 visual qint8 βœ… 307
models/clip-vit-large-patch14-336-visual-quint8.onnx vit-large-patch14-336 visual quint8 βœ… 307
models/clip-vit-large-patch14-336-textual-float32.onnx vit-large-patch14-336 textual float32 βœ… 495
models/clip-vit-large-patch14-336-textual-float16.onnx vit-large-patch14-336 textual float16 βœ… 248
models/clip-vit-large-patch14-336-textual-qint8.onnx vit-large-patch14-336 textual qint8 βœ… 124
models/clip-vit-large-patch14-336-textual-quint8.onnx vit-large-patch14-336 textual quint8 βœ… 124
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .