How to read this model using transformers package?

#1
by monamie - opened

How can I load this model in python using the transformer package?
I tried to use both AutoModel.from_pretrained and CLIPModel.from_pretrained. First it gave the following error.

*** OSError: Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.in
dex or flax_model.msgpack found in directory models/laion/CLIP-convnext_base_w_320-laion_aestheti
c-s13B-b82K-augreg.

So, I downloaded the model and renamed the files open_clip_model.safetensors and open_clip_pytorch_model.bin to pytorch_model.bin and model.safetensors, respectively.
Then, I can load the model, but loading is giving the following warning.

Some weights of ConvNextBackbone were not initialized from the model checkpoint at models/laion/C
LIP-convnext_base_w_320-laion_aesthetic-s13B-b82K-augreg and are newly initialized: ...

Where all the weights of the model are listed. So, this is only initializing a new model with newly initialized parameters.
Can you please share the steps how to load this pretrained model using transformers library?

please refer to the documentation located here:

https://huggingface.co/docs/hub/en/open_clip

Thank you! It worked.

monamie changed discussion status to closed

Sign up or log in to comment