Note: this does require patching transformers/models/modeling_clip.py as noted in the comments. Without the patch, the values are traced to either CPUFloatType or CUDAFloatType and so the model cannot be used on either type of device interchangeably.
Added basic script to trace HuggingFace Transformers models based on https://huggingface.co/openai/clip-vit-large-patch14-336
Note: this does require patching
transformers/models/modeling_clip.py
as noted in the comments. Without the patch, the values are traced to eitherCPUFloatType
orCUDAFloatType
and so the model cannot be used on either type of device interchangeably.