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

First time training, HTTP Error 403: Forbidden?! #148

Open
eduardohem opened this issue Apr 30, 2020 · 5 comments
Open

First time training, HTTP Error 403: Forbidden?! #148

eduardohem opened this issue Apr 30, 2020 · 5 comments

Comments

@eduardohem
Copy link

loading annotations into memory...
Done (t=10.57s)
creating index...
index created!
loading annotations into memory...
Done (t=0.33s)
creating index...
index created!
Downloading: "http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth" to /home/itandroids/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth
Traceback (most recent call last):
File "train.py", line 335, in
main()
File "train.py", line 331, in main
main_worker(args.gpu, ngpus_per_node, args)
File "train.py", line 232, in main_worker
D_class=EFFICIENTDET[args.network]['D_class']
File "/home/itandroids/Desktop/eficientedet/toandao/models/efficientdet.py", line 33, in init
self.backbone = EfficientNet.from_pretrained(MODEL_MAP[network])
File "/home/itandroids/Desktop/eficientedet/toandao/models/efficientnet.py", line 243, in from_pretrained
model, model_name, load_fc=(num_classes == 1000))
File "/home/itandroids/Desktop/eficientedet/toandao/models/utils.py", line 319, in load_pretrained_weights
state_dict = model_zoo.load_url(url_map[model_name])
File "/home/itandroids/Desktop/eficientedet/toandao/lib/python3.6/site-packages/torch/hub.py", line 492, in load_state_dict_from_url
download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File "/home/itandroids/Desktop/eficientedet/toandao/lib/python3.6/site-packages/torch/hub.py", line 391, in download_url_to_file
u = urlopen(url)
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/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

@josh-marsh
Copy link

josh-marsh commented May 6, 2020

same issue, but in load_pretrained_weights. When you actually try and open the weights link you get:

Anonymous caller does not have storage.objects.get access to public-models/efficientnet/efficientnet-b0-355c32eb.pth.

@HunbeomBak
Copy link

i have a same problem when run demo.py on pytorch-1.4.0, torchvisoin 0.5.0.

i use command
'python demo.py --threshold 0.5 --iou_threshold 0.5 --score --weight pre_trained/checkpoint_VOC_efficientdet-d0_268.pth --file_name demo.png'

i downloaded pre-traiend model form google drive, but demo.py tried download pre-trained, and occurred same problem.

below is error.

Load pretrained Model
Downloading: "http://storage.googleapis.com/public-models/efficientnet/efficientnet-b0-355c32eb.pth" to /home/jovyan/.cache/torch/checkpoints/efficientnet-b0-355c32eb.pth
Traceback (most recent call last):
  File "demo.py", line 174, in <module>
    detect = Detect(weights=args.weight)
  File "demo.py", line 61, in __init__
    is_training=False
  File "/home/jovyan/work/object_detection/EfficientDet.Pytorch/models/efficientdet.py", line 33, in __init__
    self.backbone = EfficientNet.from_pretrained(MODEL_MAP[network])
  File "/home/jovyan/work/object_detection/EfficientDet.Pytorch/models/efficientnet.py", line 243, in from_pretrained
    model, model_name, load_fc=(num_classes == 1000))
  File "/home/jovyan/work/object_detection/EfficientDet.Pytorch/models/utils.py", line 319, in load_pretrained_weights
    state_dict = model_zoo.load_url(url_map[model_name])
  File "/opt/conda/lib/python3.7/site-packages/torch/hub.py", line 495, in load_state_dict_from_url
    download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/opt/conda/lib/python3.7/site-packages/torch/hub.py", line 394, in download_url_to_file
    u = urlopen(url)
  File "/opt/conda/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/opt/conda/lib/python3.7/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/opt/conda/lib/python3.7/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/opt/conda/lib/python3.7/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/opt/conda/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/opt/conda/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 403: Forbidden

@Erotemic
Copy link

Looks like the pretrained weight urls have gone bad.

@jdubpark
Copy link

jdubpark commented Jul 5, 2020

Replace the url_map in model/utils.py with:

url_map = {
    'efficientnet-b0': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b0-355c32eb.pth',
    'efficientnet-b1': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b1-f1951068.pth',
    'efficientnet-b2': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b2-8bb594d6.pth',
    'efficientnet-b3': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b3-5fb5a3c3.pth',
    'efficientnet-b4': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b4-6ed6700e.pth',
    'efficientnet-b5': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b5-b6417697.pth',
    'efficientnet-b6': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b6-c76e70fd.pth',
    'efficientnet-b7': 'https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b7-dcc49843.pth',
}

These links work.

@dscarmo
Copy link

dscarmo commented Jul 12, 2020

Same problem. Just created a pull request to fix the links.

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

6 participants