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

Couldn't reach server GPT-2 #4513

Closed
MSMOON opened this issue May 22, 2020 · 8 comments
Closed

Couldn't reach server GPT-2 #4513

MSMOON opened this issue May 22, 2020 · 8 comments
Labels
External Using the library with external tools (onnx, tflite, ...)

Comments

@MSMOON
Copy link

MSMOON commented May 22, 2020

I have tried to use gpt2 using ubuntu and vagrant. This is the code:
import torch from lm_scorer.models.auto import AutoLMScorer as LMScorer scorer = LMScorer.from_pretrained("gpt2")
I get this error:

AH01215: OSError: Couldn't reach server at 'https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-config.json' to download pretrained model configuration file.

It has worked before but I had to reset my virtual environment and now it no longer worked. I think it has something to do with apache configurations.

Also, It works in the terminal but not in python script.

@MSMOON
Copy link
Author

MSMOON commented May 22, 2020

I also created this stack overflow question here: https://stackoverflow.com/questions/61944526/oserror-couldnt-reach-server-gpt2-config-json

@BramVanroy
Copy link
Collaborator

It is odd that it works from CLI but not from within your script. That does not make a lot of sense. Can you try this?

scorer = LMScorer.from_pretrained("gpt2", force_download=True)

@BramVanroy BramVanroy added the External Using the library with external tools (onnx, tflite, ...) label May 22, 2020
@MSMOON
Copy link
Author

MSMOON commented May 22, 2020

Thanks, Bram. I tried that code but I get the same error. I believe it has something to do with 1) apache2 or ubuntu config and what I've allowed it to connect to or 2) some download I am missing because it has worked previously.

I tried downloading the gpt2 config, model.bin, and vocab file but I would either get the same error as above or get this error:

ValueError: Unrecognized model name.Can be one of: gpt2, gpt2-medium, gpt2-large, gpt2-xl, distilgpt2:

@BramVanroy
Copy link
Collaborator

If you are sure that you have manually downloaded all files to the correct folder, you can disable the online look-up. This is useful if you have, as you say, network restrictions.

scorer = LMScorer.from_pretrained("gpt2", local_files_only=True)

@MSMOON
Copy link
Author

MSMOON commented May 23, 2020

Still nothing yet.

  1. I downloaded everything from https://huggingface.co/gpt2#list-files
  2. Added files to the same directory the script is in
  3. changed names (e.g. gpt2-config.json to config.json)

Is there anything I am missing?

@BramVanroy
Copy link
Collaborator

This is likely to be a problem with the LMScorer rather than with this transformers library. Looking t the source code, it does not pass they keyword arguments down to model init. I suggest that you make an issue over at the library that you used.

https://github.com/simonepri/lm-scorer/blob/master/lm_scorer/models/gpt2.py

@MSMOON
Copy link
Author

MSMOON commented May 25, 2020

Still nothing. I believe it is my apache2 configurations for access but I haven't figure out how yet.

@BramVanroy
Copy link
Collaborator

Closing this. See continuation here: simonepri/lm-scorer#8 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Using the library with external tools (onnx, tflite, ...)
Projects
None yet
Development

No branches or pull requests

2 participants