chainer / chainerrl

ChainerRL is a deep reinforcement learning library built on top of Chainer.
MIT License
1.17k stars 224 forks source link

Downloading pretrained DQN models gives error: HTTP Error 403: Forbidden #601

Closed aguamentiPatronum closed 4 years ago

aguamentiPatronum commented 4 years ago

Used the following call, as described in /chainerrl/chainerrl/examples/atari/reproduction/dqn/readme.md:

python train_dqn.py --load-pretrained --env MsPacmanNoFrameskip-v0 --pretrained-type final --gpu -1 --demo

It appears that there is some permissions problem. I get the following output for both 'final' and 'best' for --pretrained-type:

Output files are saved in results/20200726T185204.498825 INFO:filelock:Lock 5528772168 acquired on /Users/.../.chainer/dataset/pfnet/chainerrl/.lock/models.lock INFO:filelock:Lock 5528772224 acquired on /Users/.../.chainer/dataset/_dl_cache/_dl_lock INFO:filelock:Lock 5528772224 released on /Users/.../.chainer/dataset/_dl_cache/_dl_lock Downloading ... From: https://chainer-assets.preferred.jp/chainerrl/DQN/MsPacmanNoFrameskip-v0/final.zip To: /Users/../.chainer/dataset/_dl_cache/8a5f7ff8e92ffe1519465f112700a8da INFO:filelock:Lock 5528772168 released on /Users/.../.chainer/dataset/pfnet/chainerrl/.lock/models.lock Traceback (most recent call last): File "train_dqn.py", line 177, in main() File "train_dqn.py", line 134, in main model_type=args.pretrained_type)[0]) File "/Users/.../chainerrl/chainerrl/misc/pretrained_models.py", line 150, in download_model env, model_type) File "/Users/.../chainerrl/chainerrl/misc/pretrained_models.py", line 125, in download_and_store_model file)) File "/Users/.../chainerrl/chainerrl/misc/pretrained_models.py", line 90, in cached_download request.urlretrieve(url, temp_path, _reporthook) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 248, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 223, in urlopen return opener.open(url, data, timeout) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 532, in open response = meth(req, response) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 570, in error return self._call_chain(args) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 504, in _call_chain result = func(args) File "/opt/anaconda3/envs/HLenv/lib/python3.6/urllib/request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden

prabhatnagarajan commented 4 years ago

Hi, thanks for your post,

Can you try running the following command: python train_dqn.py --load-pretrained --env MsPacmanNoFrameskip-v4 --pretrained-type final --gpu -1 --demo

This is slightly different from your command in that we use the environment MsPacmanNoFrameskip-v4.

Our pretrained models are on the v4 environments. You can see in this line: https://github.com/chainer/chainerrl/blob/master/chainerrl/misc/pretrained_models.py#L147 that we replace "NoFrameskip-v4" with an empty string, but we don't replace "NoFrameskip-v0" with an empty string.

So if we run the line I wrote above, it tries to download from: https://chainer-assets.preferred.jp/chainerrl/DQN/MsPacman/final.zip

whereas your posted code tries to download from

https://chainer-assets.preferred.jp/chainerrl/DQN/MsPacmanNoFrameskip-v0/final.zip, a file that does not exist.

aguamentiPatronum commented 4 years ago

Perfect! I was going off of the versions listed on the OpenAI site, and so I didn't realize a v4 was available for Ms Pacman. I ran the command you suggested, and it worked like a charm.