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 · 8 comments
Open

Cannot use load_from_checkpoint in an offline environment #225

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

Comments

@zzaebok
Copy link
Contributor

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
Contributor 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.

@vergilus
Copy link

vergilus commented Nov 5, 2024

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.

any updates?

@flashbear
Copy link

i need this update as well :)

@flashbear
Copy link

do i simply place the downloaded (eg. xlm-roberta-large) and place it on the parent folder?

@vergilus
Copy link

vergilus commented Dec 6, 2024

do i simply place the downloaded (eg. xlm-roberta-large) and place it on the parent folder?

I modified the local comet configs hparam.yaml, where there is a path for the infoxlm ckpt path (pretrained_model). Then switch on the reload_hparams during comet loading:
comet_scorer = comet.load_from_checkpoint(args.comet_ckpt, reload_hparams=True)

@flashbear
Copy link

@vergilus appreciate your feedback 👍 working now :)

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

4 participants