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

Unable to download yolox_s_coco.pth weights 404 error #2057

Open
davesteps opened this issue Oct 20, 2024 · 19 comments
Open

Unable to download yolox_s_coco.pth weights 404 error #2057

davesteps opened this issue Oct 20, 2024 · 19 comments

Comments

@davesteps
Copy link

🐛 Describe the bug

Downloading: "https://sghub.deci.ai/models/yolox_s_coco.pth" to /github/home/.cache/torch/hub/checkpoints/yolox_s_coco.pth
Traceback (most recent call last):
...
  File "/usr/local/lib/python3.10/dist-packages/super_gradients/common/decorators/factory_decorator.py", line 36, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/super_gradients/training/models/model_factory.py", line 230, in get
    net = instantiate_model(model_name, arch_params, checkpoint_num_classes, pretrained_weights, download_required_code)
  File "/usr/local/lib/python3.10/dist-packages/super_gradients/training/models/model_factory.py", line 168, in instantiate_model
    load_pretrained_weights(net, model_name, pretrained_weights)
  File "/usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py", line 1595, in load_pretrained_weights
    pretrained_state_dict = load_state_dict_from_url(url=url, map_location=map_location, file_name=unique_filename)
  File "/usr/local/lib/python3.10/dist-packages/torch/hub.py", line 746, in load_state_dict_from_url
    download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/usr/local/lib/python3.10/dist-packages/torch/hub.py", line 611, in download_url_to_file
    u = urlopen(req)
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
ERROR: failed to reproduce 'training': failed to run: python -m src.train, exited with 1
Error: Process completed with exit code 255.

Versions

Collecting environment information...
PyTorch version: 2.2.2+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0] (64-bit runtime)
Python platform: Linux-6.8.0-47-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3070 Ti Laptop GPU
Nvidia driver version: 535.183.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        39 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               20
On-line CPU(s) list:                  0-19
Vendor ID:                            GenuineIntel
Model name:                           12th Gen Intel(R) Core(TM) i7-12700H
CPU family:                           6
Model:                                154
Thread(s) per core:                   2
Core(s) per socket:                   14
Socket(s):                            1
Stepping:                             3
CPU max MHz:                          4700.0000
CPU min MHz:                          400.0000
BogoMIPS:                             5376.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities
Virtualisation:                       VT-x
L1d cache:                            544 KiB (14 instances)
L1i cache:                            704 KiB (14 instances)
L2 cache:                             11.5 MiB (8 instances)
L3 cache:                             24 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-19
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Mitigation; Clear Register File
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.23.0
[pip3] nvidia-cublas-cu12==12.1.3.1
[pip3] nvidia-cuda-cupti-cu12==12.1.105
[pip3] nvidia-cuda-nvrtc-cu12==12.1.105
[pip3] nvidia-cuda-runtime-cu12==12.1.105
[pip3] nvidia-cudnn-cu12==8.9.2.26
[pip3] nvidia-cufft-cu12==11.0.2.54
[pip3] nvidia-curand-cu12==10.3.2.106
[pip3] nvidia-cusolver-cu12==11.4.5.107
[pip3] nvidia-cusparse-cu12==12.1.0.106
[pip3] nvidia-nccl-cu12==2.19.3
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.1.105
[pip3] onnx==1.15.0
[pip3] onnx-graphsurgeon==0.3.27
[pip3] onnxruntime==1.15.0
[pip3] onnxruntime-gpu==1.18.0
[pip3] onnxsim==0.4.36
[pip3] torch==2.2.2
[pip3] torchmetrics==0.8.0
[pip3] torchvision==0.17.2
[pip3] triton==2.2.0
[conda] numpy                     1.23.0                   pypi_0    pypi
[conda] nvidia-cublas-cu12        12.1.3.1                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.1.105                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.1.105                 pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.1.105                 pypi_0    pypi
[conda] nvidia-cudnn-cu12         8.9.2.26                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.0.2.54                pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.2.106               pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.4.5.107               pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.1.0.106               pypi_0    pypi
[conda] nvidia-nccl-cu12          2.19.3                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.1.105                 pypi_0    pypi
[conda] torch                     2.2.2                    pypi_0    pypi
[conda] torchmetrics              0.8.0                    pypi_0    pypi
[conda] torchvision               0.17.2                   pypi_0    pypi
[conda] triton                    2.2.0                    pypi_0    pypi
@ksil
Copy link

ksil commented Oct 21, 2024

Also seeing this on python3.9.20, darwin, super-gradients version 3.7.1 with other models.

The site could be down. Going to https://sghub.deci.ai/models/yolox_s_coco.pth directly yields:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>NotFound</Code>
    <Message>The resource you requested does not exist</Message>
    ...
</Error>

@rurigk
Copy link

rurigk commented Oct 21, 2024

@davesteps @ksil check the latest commit it changed the download urls buit there is no release available
What i did was download the latest release and use it as local library but i replaced the urls

@rvryan67
Copy link

I can confirm the same issue

from super_gradients.training import models
yolo_nas_l = models.get("yolo_nas_l", pretrained_weights="coco")
Downloading: "https://sghub.deci.ai/models/yolo_nas_l_coco.pth" to /root/.cache/torch/hub/checkpoints/yolo_nas_l_coco.pth
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
[<ipython-input-6-74936ab117f4>](https://localhost:8080/#) in <cell line: 2>()
      1 from super_gradients.training import models
----> 2 yolo_nas_l = models.get("yolo_nas_l", pretrained_weights="coco")



[/usr/lib/python3.10/urllib/request.py](https://localhost:8080/#) in http_error_default(self, req, fp, code, msg, hdrs)
    641 class HTTPDefaultErrorHandler(BaseHandler):
    642     def http_error_default(self, req, fp, code, msg, hdrs):
--> 643         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    644 
    645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 404: Not Found

@BloodAxe
Copy link
Contributor

Yes old S3 bucket was taken down.
For not the workaround is to pip install from the master:

pip install -U git+https://github.com/Deci-AI/super-gradients@e0ccacf8868ffa1296fa4f8407c03d2bc227312c

Sorry for the inconvenience.

@kidhasmoxy
Copy link

kidhasmoxy commented Oct 22, 2024

This doesn't work @BloodAxe , as there's a step in checkpoint_utils.py that splits the url using the old location. That also needs to be updated to use the new base url: "https://sg-hub-nv.s3.amazonaws.com/"

[/usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py](https://localhost:8080/#) in load_pretrained_weights(model, architecture, pretrained_weights)
   1590         pretrained_state_dict = torch.load(url.replace("file://", ""), map_location="cpu")
   1591     else:
-> 1592         unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")
   1593         map_location = torch.device("cpu")
   1594         with wait_for_the_master(get_local_rank()):

IndexError: list index out of range

@The1Percent
Copy link

Yah experienced the same error here:
IndexError Traceback (most recent call last)
in <cell line: 5>()
3 from super_gradients.training import models
4
----> 5 model = models.get(Models.YOLO_NAS_S, pretrained_weights="coco")

3 frames
/usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py in load_pretrained_weights(model, architecture, pretrained_weights)
1590 pretrained_state_dict = torch.load(url.replace("file://", ""), map_location="cpu")
1591 else:
-> 1592 unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "").replace(" ", "")
1593 map_location = torch.device("cpu")
1594 with wait_for_the_master(get_local_rank()):

IndexError: list index out of range

@hua-bing
Copy link

This doesn't work @BloodAxe , as there's a step in checkpoint_utils.py that splits the url using the old location. That also needs to be updated to use the new base url: "https://sg-hub-nv.s3.amazonaws.com/"

[/usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py](https://localhost:8080/#) in load_pretrained_weights(model, architecture, pretrained_weights)
   1590         pretrained_state_dict = torch.load(url.replace("file://", ""), map_location="cpu")
   1591     else:
-> 1592         unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")
   1593         map_location = torch.device("cpu")
   1594         with wait_for_the_master(get_local_rank()):

IndexError: list index out of range

Maybe you can try to replace the url with the updated one in your virtual environment. I tried it and at least I did not see any errors after I replaced all occurrences. It's not ideal, but probably it'll get you moving.

@kidhasmoxy
Copy link

This doesn't work @BloodAxe , as there's a step in checkpoint_utils.py that splits the url using the old location. That also needs to be updated to use the new base url: "https://sg-hub-nv.s3.amazonaws.com/"

[/usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py](https://localhost:8080/#) in load_pretrained_weights(model, architecture, pretrained_weights)
   1590         pretrained_state_dict = torch.load(url.replace("file://", ""), map_location="cpu")
   1591     else:
-> 1592         unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")
   1593         map_location = torch.device("cpu")
   1594         with wait_for_the_master(get_local_rank()):

IndexError: list index out of range

Maybe you can try to replace the url with the updated one in your virtual environment. I tried it and at least I did not see any errors after I replaced all occurrences. It's not ideal, but probably it'll get you moving.

Thanks for following up. Your recommendation is what I ended up doing. My followup post was to document it for others.

@hannadiamond
Copy link

hannadiamond commented Oct 23, 2024

Created a pr to fix this #2061
@BloodAxe @ofrimasad @shaydeci

@tatsuya-fukuoka
Copy link

tatsuya-fukuoka commented Oct 25, 2024

I have solved the problem with the following modification.

1. Modification of pretrained_models.py

Open pretrained_models.py

vi /usr/local/lib/python3.10/dist-packages/super_gradients/training/pretrained_models.py

Replaced part of the URL.

:%s/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/g

2. Modification of checkpoint_utils.py

Open checkpoint_utils.py

vi /usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py

Corrected line 1592.
[before]

unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")

[after]

unique_filename = url.split("https://sg-hub-nv.s3.amazonaws.com/models/")[1].replace("/", "_").replace(" ", "_")

Thanks to everyone who commented above for their help in resolving this issue.

@hannadiamond
Copy link

PR with passed pipeline tests ready for review and merge
#2057 (comment)

@BloodAxe

@aeozyalcin
Copy link

aeozyalcin commented Nov 4, 2024

Until @hannadiamond's PR is merged, here is a workaround I just verified:
! pip install -U git+https://github.com/hannadiamond/super-gradients@2235adeacc876dbab442096085fc404e79ce19a4

@davesteps
Copy link
Author

old urls seem to be working again

@goutham-nivass
Copy link

@davesteps still it is not

@goutham-nivass
Copy link

@tatsuya-fukuoka any idea , how to do this in runtime ?

@davesteps
Copy link
Author

FYI you can manually download the weights to: ~/.cache/torch/hub/checkpoints to get around the error

@phyuphyuthaw
Copy link

phyuphyuthaw commented Nov 8, 2024

Hi, I also found the same problem too.

To edit the path as @tatsuya-fukuoka mentioned, here is how I solved.

In our coding environment, in my case, in the google colab, first of all I tried to clone the original super-gradient under /content/ folder.

!git clone https://github.com/Deci-AI/super-gradients.git /content/super_gradients_folder

Then write a pip install for cloned path.

!pip install -e /content/super_gradients_folder

Finally let's check the Editable project location: by running this code. If it is showing installed from your edited source, you can modify the checkpoint_utils.py as you like.

!pip show super_gradients

After that, I replaced the url in checkpoint_utils.py as @tatsuya-fukuoka mentioned.

The code should be run now.

Thanks.

@tatsuya-fukuoka
Copy link

I have solved the problem with the following modification.

1. Modification of pretrained_models.py

Open pretrained_models.py

vi /usr/local/lib/python3.10/dist-packages/super_gradients/training/pretrained_models.py

Replaced part of the URL.

:%s/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/g

2. Modification of checkpoint_utils.py

Open checkpoint_utils.py

vi /usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py

Corrected line 1592. [before]

unique_filename = url.split("https://sghub.deci.ai/models/")[1].replace("/", "_").replace(" ", "_")

[after]

unique_filename = url.split("https://sg-hub-nv.s3.amazonaws.com/models/")[1].replace("/", "_").replace(" ", "_")

Thanks to everyone who commented above for their help in resolving this issue.

I believe that an easy way to do this with a command is to use the sed command to perform the substitution as follows.
The path to the super_gradients package must be the path in your environment.

sed -i -e "s/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/g" /usr/local/lib/python3.10/dist-packages/super_gradients/training/pretrained_models.py

sed -i -e "s/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/g" /usr/local/lib/python3.10/dist-packages/super_gradients/training/utils/checkpoint_utils.py

Thanks.

@CrasCris
Copy link

@tatsuya-fukuoka Thanks it works

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