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

load OpenCLIP model and tokenizer from local path #883

Closed
wants to merge 2 commits into from

Conversation

YushunXiang
Copy link

Load OpenCLIP model and tokenizer from local path

Usage:

model, processor = open_clip.create_model_from_pretrained(
    model_name=f'hf-hub:{model_id}',
    precision='fp16',
    cache_dir=cache_dir,
)
print(f"Loading tokenizer from {model_args.model_path}")
tokenizer = open_clip.get_tokenizer(
    model_name=f'hf-hub:{model_id}',
    cache_dir=cache_dir,
)

The cache_dir is your local path.

exclude src_copy dir
@rwightman
Copy link
Collaborator

so this will interfere with normal use of the cache by overriding part of the functionality. I've made some improvements to the cache operation. Explicitly loading from local folders is a bit of a different idea and I'd like to support that but should be done through pretrained argument (folder) and not by overriding cache behaviour

@rwightman rwightman closed this Oct 24, 2024
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

Successfully merging this pull request may close these issues.

2 participants