facebookresearch / esm

Evolutionary Scale Modeling (esm): Pretrained language models for proteins
MIT License
3.26k stars 643 forks source link

urllib.error.HTTPError: HTTP Error 404: Not Found when trying to load pretrained model #134

Closed VaticanCameos99 closed 3 years ago

VaticanCameos99 commented 3 years ago

Bug description Please enter a clear and concise description of what the bug is. I tried testing the usage of the library as described in the README.

Reproduction steps installed fair-esm on a conda env as described here: conda install -c conda-forge bio-embeddings-esm

run: By using pytorch hub:

import torch
model, alphabet = torch.hub.load("facebookresearch/esm", "esm1b_t33_650M_UR50S")

By using esm library:

import torch
import esm

# Load ESM-1b model
model, alphabet = esm.pretrained.esm1b_t33_650M_UR50S()

Expected behavior The download should have been completed and the file(s) should have been at .cache/torch/hub/facebook_research_esm_master . All of this was running perfectly fine a few weeks ago but I decided to reinstall and run. Now I see the 404 error code on trying to download it.

Logs Downloading: "https://github.com/facebookresearch/esm/archive/master.zip" to /home/user/.cache/torch/hub/master.zip Traceback (most recent call last): File "", line 1, in File "/home/user/anaconda3/envs/myenv/lib/python3.7/site-packages/torch/hub.py", line 345, in load repo_dir = _get_cache_or_reload(github, force_reload, verbose) File "/home/user/anaconda3/envs/myenv/lib/python3.7/site-packages/torch/hub.py", line 144, in _get_cache_or_reload download_url_to_file(url, cached_file, progress=False) File "/home/user/anaconda3/envs/myenv/lib/python3.7/site-packages/torch/hub.py", line 379, in download_url_to_file u = urlopen(req) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 563, in error result = self._call_chain(args) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 755, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 531, in open response = meth(req, response) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 569, in error return self._call_chain(args) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(args) File "/home/user/anaconda3/envs/myenv/lib/python3.7/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

Additional notes: trying to load any other pretrained model from this repo also gives the same result

tomsercu commented 3 years ago

Seems like your conda environment got corrupted. Probably best idea is to start with a fresh conda environment. You could also just trying to install with pip: pip install fair-esm but the issue may be in one of the dependencies instead.

VaticanCameos99 commented 3 years ago

Hi, thank you for your reply. I did try with pip install, even on a fresh environment, but I see the same error.

Also, not sure if this would work, but I tried accessing the url on the browser (hoping it might download the the zip or redirect me to a parent directory) but that also triggers the same error code.

liujas000 commented 3 years ago

Hi @VaticanCameos99

This is likely due to an issue when branch names were changed (see here for reference)

PR #138 is underway, but in the mean time, the following code should work for you

model, alphabet = torch.hub.load("facebookresearch/esm:main", "esm1b_t33_650M_UR50S")

Thanks for raising this!