Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clip adaptor #97

Open
haoxiangzhao12138 opened this issue Oct 31, 2024 · 3 comments
Open

clip adaptor #97

haoxiangzhao12138 opened this issue Oct 31, 2024 · 3 comments

Comments

@haoxiangzhao12138
Copy link

In the Clip Adapter, which specific model of OpenCLIP is used? When using torch.hub.load with adaptor_names='clip', it requires access to Hugging Face. Is there a way to load the Clip Adapter locally instead?

@mranzinger
Copy link
Collaborator

Hmm, are you sure it requires huggingface? It should be using open_clip:

import open_clip
self.oc_model = open_clip.create_model_from_pretrained(
model_name=adaptor_config['model'],
pretrained=adaptor_config['pretrained'],
return_transform=False,
)

And this is the specific model we use: https://github.com/mlfoundations/open_clip/blob/main/docs/openclip_results.csv#L2

name and pretrained map to model_name and pretrained here:

model_name=adaptor_config['model'],
pretrained=adaptor_config['pretrained'],

@haoxiangzhao12138
Copy link
Author

Thank you very much for your response. When I use torch.hub.load(... , ... , source='local') to load a local model and add the adaptor_name parameter, I encounter the following error:

requests.exceptions.ConnectTimeout: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /apple/DFN5B-CLIP-ViT-H-14-378/resolve/main/open_clip_pytorch_model.bin (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f422eedcb50>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: cf1f5d30-1fe2-4417-abde-ed366c875d0a)')

From what I understand, it seems like there’s an issue accessing Hugging Face. Is there any additional parameter I might need to add to torch.hub.load to address this?

@mranzinger
Copy link
Collaborator

Ah, I see. So open_clip is pulling the model weights from huggingface. Do you have access to any environment that is able to access them? Do you need to text encoder for the clip model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants