fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

I downloaded the model and everything related but getting request error from https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/encoder.json

Open KemalDrop opened this issue 3 years ago • 3 comments

🐛 Bug

I have all the files locally including the encoder but from time to time I get requests error from https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/encoder.json website which indicates the from_pretrained function tries to download that file even if I had it. Everytime I load this happens - What do I need to do instead?

To Reproduce

Loading a model that has gpt-2 encoder.json will do. I am using facebook GENRE library so:

from genre.fairseq_model import GENRE
GENRE.from_pretrained(local_path)

Environment

  • fairseq Version : fixing_prefix_allowed_tokens_fn branch
  • PyTorch Version 1.10
  • OS (e.g., Linux): Ubuntu 20.04
  • How you installed fairseq : pip
  • Python version: 3.8
  • CUDA/cuDNN version: 11.0

KemalDrop avatar Dec 15 '21 16:12 KemalDrop

Hi, I also got this error. Is there any solution?

For more information, I put the log below:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts_genre/evaluate_kilt_dataset.py", line 249, in <module>
    GENRE.from_pretrained(args.model_path, checkpoint_file=args.checkpoint_file)
  File "/home/xuyan/GENRE/genre/fairseq_model.py", line 129, in from_pretrained
    return GENREHubInterface(x["args"], x["task"], x["models"][0])
  File "/home/xuyan/GENRE/fairseq/fairseq/models/bart/hub_interface.py", line 30, in __init__
    super().__init__(cfg, task, [model])
  File "/home/xuyan/GENRE/fairseq/fairseq/hub_utils.py", line 108, in __init__
    self.bpe = encoders.build_bpe(cfg.bpe)
  File "/home/xuyan/GENRE/fairseq/fairseq/registry.py", line 61, in build_x
    return builder(cfg, *extra_args, **extra_kwargs)
  File "/home/xuyan/GENRE/fairseq/fairseq/data/encoders/gpt2_bpe.py", line 32, in __init__
    encoder_json = file_utils.cached_path(cfg.gpt2_encoder_json)
  File "/home/xuyan/GENRE/fairseq/fairseq/file_utils.py", line 160, in cached_path
    return get_from_cache(url_or_filename, cache_dir)
  File "/home/xuyan/GENRE/fairseq/fairseq/file_utils.py", line 283, in get_from_cache
    partial(requests.head, url, allow_redirects=True), url
  File "/home/xuyan/GENRE/fairseq/fairseq/file_utils.py", line 234, in request_wrap_timeout
    return func(timeout=timeout)
  File "/home/xuyan/anaconda3/envs/genre/lib/python3.7/site-packages/requests/api.py", line 102, in head
    return request('head', url, **kwargs)
  File "/home/xuyan/anaconda3/envs/genre/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/xuyan/anaconda3/envs/genre/lib/python3.7/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/xuyan/anaconda3/envs/genre/lib/python3.7/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/home/xuyan/anaconda3/envs/genre/lib/python3.7/site-packages/requests/adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='dl.fbaipublicfiles.com', port=443): Max retries exceeded with url: /fairseq/gpt2_bpe/encoder.json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1091)')))

yana-xuyan avatar Apr 19 '22 05:04 yana-xuyan

The same question

SkyAndCloud avatar Jul 27 '22 08:07 SkyAndCloud