yuval-alaluf / SAM

Official Implementation for "Only a Matter of Style: Age Transformation Using a Style-Based Regression Model" (SIGGRAPH 2021) https://arxiv.org/abs/2102.02754
https://yuval-alaluf.github.io/SAM/
MIT License
632 stars 151 forks source link

urllib.error.URLError: <urlopen error [Errno 111] Connection refused> #64

Closed quleileileilei closed 1 year ago

quleileileilei commented 1 year ago

When I run “python scripts/train.py --dataset_type=ffhq_aging --exp_dir=/home/qujinglei/SAM-master/experiment --workers=6 --batch_size=6 --test_batch_size=6 --test_workers=6 --val_interval=2500 --save_interval=10000 --start_from_encoded_w_plus --id_lambda=0.1 --lpips_lambda=0.1 --lpips_lambda_aging=0.1 --lpips_lambda_crop=0.6 --l2_lambda=0.25 --l2_lambda_aging=0.25 --l2_lambda_crop=1 --w_norm_lambda=0.005 --aging_lambda=5 --cycle_lambda=1 --input_nc=4 --target_age=uniform_random --use_weighted_id_loss”

there was a problem:

self._send_output(message_body, encode_chunked=encode_chunked) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/http/client.py", line 1026, in _send_output self.send(msg) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/http/client.py", line 964, in send self.connect() File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/http/client.py", line 1392, in connect super().connect() File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/http/client.py", line 936, in connect (self.host,self.port), self.timeout, self.source_address) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/socket.py", line 724, in create_connection raise err File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "scripts/train.py", line 30, in main() File "scripts/train.py", line 25, in main coach = Coach(opts) File "./training/coach_aging.py", line 39, in init self.lpips_loss = LPIPS(net_type='alex').to(self.device).eval() File "./criteria/lpips/lpips.py", line 27, in init self.lin.load_state_dict(get_state_dict(net_type, version)) File "./criteria/lpips/utils.py", line 19, in get_state_dict map_location=None if torch.cuda.is_available() else torch.device('cpu') File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/site-packages/torch/hub.py", line 481, in load_state_dict_from_url download_url_to_file(url, cached_file, hash_prefix, progress=progress) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/site-packages/torch/hub.py", line 379, in download_url_to_file u = urlopen(req) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 526, in open response = self._open(req, data) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 544, in _open '_open', req) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(*args) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "/home/qujinglei/anaconda3/envs/sam_env/lib/python3.6/urllib/request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

How can i resolve this?Can you help me?thanks very much!

yuval-alaluf commented 1 year ago

This seems like a failure to connect with the external github repository needed for downloading the LPIPS weights. I just tired this again myself and was able to download the weights using the above code. I therefore think this was simply a temporary connection problem. Were you able to download this in the end?

quleileileilei commented 1 year ago

I replace the url = 'https://raw.githubusercontent.com/richzhang/PerceptualSimilarity/' \

quleileileilei commented 1 year ago

I would like to ask which code is displaying a single GPU, and if I want to train with two GPU cards, what should I change in the code?

yuval-alaluf commented 1 year ago

We do not have support for multi-GPU training so you will need to add this yourself using something like DataParallel.