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

a weird problem "class 'urllib.error.URLError'" #39

Open
ning-2022 opened this issue Apr 8, 2023 · 8 comments
Open

a weird problem "class 'urllib.error.URLError'" #39

ning-2022 opened this issue Apr 8, 2023 · 8 comments

Comments

@ning-2022
Copy link

Hi Model-angelo experts,

When I used the model_angelo to predict the protein sequence with a MRC map only, some error had appeared as following that
"File "/data/wangning/anaconda3/envs/model_angelo/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
│ └ (<urllib.request.Request object at 0x7fb18f8d4730>,)
└ <bound method HTTPSHandler.https_open of <urllib.request.HTTPSHandler object at 0x7fb18f8bb430>>
File "/data/wangning/anaconda3/envs/model_angelo/lib/python3.9/urllib/request.py", line 1389, in https_open
return self.do_open(http.client.HTTPSConnection, req,
│ │ │ │ │ └ <urllib.request.Request object at 0x7fb18f8d4730>
│ │ │ │ └ <class 'http.client.HTTPSConnection'>
│ │ │ └ <module 'http.client' from '/data/wangning/anaconda3/envs/model_angelo/lib/python3.9/http/client.py'>
│ │ └ <module 'http' from '/data/wangning/anaconda3/envs/model_angelo/lib/python3.9/http/init.py'>
│ └ <function AbstractHTTPHandler.do_open at 0x7fb2375c1d30>
└ <urllib.request.HTTPSHandler object at 0x7fb18f8bb430>
File "/data/wangning/anaconda3/envs/model_angelo/lib/python3.9/urllib/request.py", line 1349, in do_open
raise URLError(err)
└ <class 'urllib.error.URLError'>

urllib.error.URLError: <urlopen error [Errno 111] Connection refused> " Does It seem that model_angelo try to connect the internet? I don't understand this error. I used GPU 2080Ti and CUDA11.5 for this. Please help me. Thanks in advance!

Best regards,
Ning

@jamaliki
Copy link
Collaborator

jamaliki commented Apr 8, 2023

Hi,
If this is the first time you are trying to use either the build or build_no_seq commands, then it needs to download the model weights. Are you connected to the internet?

@ning-2022
Copy link
Author

Hi Jamaliki,

 Nice to hear from you.  Yes, your answer is very correct. Actually, this machine installed with model_angelo has an unstable connection with the internet. I will try another way.  Thanks so much for your answer. It really helps me.  

All best,
Ning

@ning-2022
Copy link
Author

Hi Jamaliki,

 Sorry to bother you again. I have tried to change the internet environment for my machine. But it failed to download the model weights. Could I download  this model weights by myself via git or wget commands and equip them into somewhere? Please give me some suggestions.  Thanks!

All best,
Ning

@jamaliki
Copy link
Collaborator

jamaliki commented Apr 9, 2023

Hi,

Yes you can download them by yourself. Although I am not sure which part is giving an error, is the ESM model downloading or the ModelAngelo weights. So, could you upload your model_angelo.log file?

@jamaliki
Copy link
Collaborator

jamaliki commented Apr 9, 2023

In the meantime, here is a bash script to download the weights yourself (courtesy of GPT-4 ;) ):

#!/bin/bash

# Check if the bundle_name is provided
if [ -z "$1" ]; then
    echo "Usage: $0 <bundle_name>"
    echo "Available bundle names: original, original_no_seq, small_gpu"
    exit 1
fi

# Define download links
declare -A bundle_name_to_link
bundle_name_to_link=(
    ["original"]="https://zenodo.org/record/7733060/files/original.zip"
    ["original_no_seq"]="https://zenodo.org/record/7733060/files/original_no_seq.zip"
    ["small_gpu"]="https://zenodo.org/record/7733060/files/small_gpu.zip"
)

# Set the bundle_name
bundle_name="$1"

# Determine torch.hub directory
if [ -n "$TORCH_HOME" ]; then
    torch_hub_dir="$TORCH_HOME/hub"
else
    torch_hub_dir="${XDG_CACHE_HOME:-$HOME/.cache}/torch/hub"
fi

# Create destination directory
dest="$torch_hub_dir/checkpoints/model_angelo/$bundle_name"
mkdir -p "$(dirname "$dest")"

# Check if the file already exists
if [ -f "$dest/success.txt" ]; then
    echo "Bundle $bundle_name already exists."
    exit 0
fi

# Download and extract the zip file
echo "Setting up bundle with name: $bundle_name for the first time."
wget -q -O "${dest}.zip" "${bundle_name_to_link[$bundle_name]}"
unzip -q "${dest}.zip" -d "$(dirname "$dest")"
rm "${dest}.zip"

# Create success.txt file
touch "$dest/success.txt"
echo "Successfully downloaded model" > "$dest/success.txt"

echo "Bundle $bundle_name successfully installed."

@jamaliki
Copy link
Collaborator

jamaliki commented Apr 9, 2023

You should run the script above with the model_angelo conda environment activated twice. Once for original and once for original_no_seq

@ning-2022
Copy link
Author

Thanks for your quick replies. The script you provided is working to download the weights now. I'm not sure whether this connection error relates about ESM model or model_weights downloading. Here is my error log file. Thanks for your time.
model_angelo.log

@jamaliki
Copy link
Collaborator

jamaliki commented Apr 9, 2023

Let me know if you have any more issues!

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

No branches or pull requests

2 participants