Make the hf model compatible with transformers older versions

#6
by baltachev - opened

Hello!
Yesterday we merged the model compatible with hf CLIP class. It works fine on the latest transformers version.

However, I found out that it can't be loaded on the older versions of transformers (specifically, 4.20.1), so I converted the open_clip model on transformers==4.20.1 and it works like a charm on version >= 4.19.

Decided not to check on older versions because there are quite outdated.

@gabrielilharco Would you mind taking a look at my PR again?

@baltachev Hello, may I ask how you did the conversion from open_clip_pytorch_model.bin to pytorch_model.bin? The outputs from the two models seem to differ. So I'd like to check if I was incorrectly running the models or there is some error in the conversion process. Thanks a lot!

@Cie1 Hello! I just used rwightman's script. My transformers version was 4.20.1 during the conversion.

@baltachev Hello, may I ask how you did the conversion from open_clip_pytorch_model.bin to pytorch_model.bin? The outputs from the two models seem to differ. So I'd like to check if I was incorrectly running the models or there is some error in the conversion process. Thanks a lot!

Thanks! It turns out there is a configuration error in my implementation and the converted weight is correct.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment