[GH-ISSUE #408] How to load pre-trained CLIP model from local directory? #347

Open
opened 2026-10-31 21:14:11 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @HengGao12 on GitHub (Dec 8, 2023).
Original GitHub issue: https://github.com/openai/CLIP/issues/408

Hello, I want to know how to load pre-trained clip model from local directory but not downloading from huggingface?

Originally created by @HengGao12 on GitHub (Dec 8, 2023). Original GitHub issue: https://github.com/openai/CLIP/issues/408 Hello, I want to know how to load pre-trained clip model from local directory but not downloading from huggingface?
Author
Owner

@VimukthiRandika1997 commented on GitHub (Dec 24, 2023):

I had the same issue!, I found this one within an another issue
check this in clip.py

https://github.com/openai/CLIP/pull/397/commits/551aca347511f782a0f3980e93603194a539e853

I worked for me!

<!-- gh-comment-id:1868611271 --> @VimukthiRandika1997 commented on GitHub (Dec 24, 2023): I had the same issue!, I found this one within an another issue check this in clip.py https://github.com/openai/CLIP/pull/397/commits/551aca347511f782a0f3980e93603194a539e853 I worked for me!
Author
Owner
<!-- gh-comment-id:2044590129 --> @zituitui commented on GitHub (Apr 9, 2024): download the pretrained model from: _MODELS = { "RN50": "https://openaipublic.azureedge.net/clip/models/afeb0e10f9e5a86da6080e35cf09123aca3b358a0c3e3b6c78a7b63bc04b6762/RN50.pt", "RN101": "https://openaipublic.azureedge.net/clip/models/8fa8567bab74a42d41c5915025a8e4538c3bdbe8804a470a72f30b0d94fab599/RN101.pt", "RN50x4": "https://openaipublic.azureedge.net/clip/models/7e526bd135e493cef0776de27d5f42653e6b4c8bf9e0f653bb11773263205fdd/RN50x4.pt", "RN50x16": "https://openaipublic.azureedge.net/clip/models/52378b407f34354e150460fe41077663dd5b39c54cd0bfd2b27167a4a06ec9aa/RN50x16.pt", "RN50x64": "https://openaipublic.azureedge.net/clip/models/be1cfb55d75a9666199fb2206c106743da0f6468c9d327f3e0d0a543a9919d9c/RN50x64.pt", "ViT-B/32": "https://openaipublic.azureedge.net/clip/models/40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af/ViT-B-32.pt", "ViT-B/16": "https://openaipublic.azureedge.net/clip/models/5806e77cd80f8b59890b7e101eabd078d9fb84e6937f9e85e4ecb61988df416f/ViT-B-16.pt", "ViT-L/14": "https://openaipublic.azureedge.net/clip/models/b8cca3fd41ae0c99ba7e8951adf17d267cdb84cd88be6f7c2e0eca1737a03836/ViT-L-14.pt", "ViT-L/14@336px": "https://openaipublic.azureedge.net/clip/models/3035c92b350959924f9f00213499208652fc7ea050643e8b385c2dac08641f02/ViT-L-14-336px.pt", } in code: model, preprocess = clip.load(\PATH\TO\ViT-L-14.pt device=device)
Author
Owner

@ierwarf commented on GitHub (Feb 2, 2025):

Thank you so much!! I had same issue :)

<!-- gh-comment-id:2629293711 --> @ierwarf commented on GitHub (Feb 2, 2025): Thank you so much!! I had same issue :)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#347
No description provided.