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

Cannot use load_from_checkpoint in an offline environment #225

Open
zzaebok opened this issue Jul 26, 2024 · 3 comments
Open

Cannot use load_from_checkpoint in an offline environment #225

zzaebok opened this issue Jul 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@zzaebok
Copy link

zzaebok commented Jul 26, 2024

Motivation

Due to the policy of my company, I cannot access to an online server (e.g., huggingface).
So I tried to use load_from_checkpoint function after I manually downloaded wmt22-comet-da checkpoint.
However, it makes an SSL error "SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded".

This error is raised because of missing local_files_only param to each model's from_pretrained method.

🚀 Feature

I think COMET needs to support local_files_only parameter to load_from_checkpoint function not to raise http connection error.

Below is my current solution to the problem.

self.model = XLMRobertaModel(
    XLMRobertaConfig.from_pretrained(pretrained_model, local_files_only=local_files_only),
    add_pooling_layer=False,
)

Can I make a PR?
Please let me know if there is better way.

@zzaebok zzaebok added the enhancement New feature or request label Jul 26, 2024
@ricardorei
Copy link
Collaborator

yep, this seems good to me!

@zzaebok
Copy link
Author

zzaebok commented Aug 6, 2024

I made a PR for this issue, please check it :)

Additionally, I think it is also needed to add cache_dir param too. (If you thinks it's okay, I will make another PR for this)

@ricardorei
Copy link
Collaborator

Hi @zzaebok thanks for the PR!

I am on vocations and going to ACL next week so it might take me some time but I will look at it ASAP.

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

No branches or pull requests

2 participants