-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Exception: [Errno 2] No such file or directory: 'lib\\best.pt'. Cache may be out of date, try force_reload=True
or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading for help.
#11530
Comments
👋 Hello @curiousdarko, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit. Introducing YOLOv8 🚀We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀! Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects. Check out our YOLOv8 Docs for details and get started with: pip install ultralytics |
@curiousdarko hello! Thank you for reporting this issue. The error message you received suggests that the YOLOv5 cache may be out of date, and recommends trying If you have already tried uninstalling and re-installing the required modules and downloading the requirements.txt multiple times, then you could try using If that still doesn't work, you can refer to our documentation on PyTorch Hub Model Loading or submit a PR to help improve YOLOv5. Hope this helps! |
@glenn-jocher how do i use force_reload=True? |
You can try using import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', force_reload=True)
|
i have tried, but still get the same error, can I give you my code? |
@curiousdarko thanks for trying Sharing your code will definitely help us understand what might be going wrong. Could you please provide us with the code or a minimal reproducible example, along with any error messages you're getting? This will enable us to provide you with a more specific and accurate solution to your problem. Looking forward to hearing back from you! |
@glenn-jocher https://github.com/curiousdarko/aicheat all my code is in this repo, main issue is in darko.py |
@curiousdarko, thank you for sharing your code. We understand that you're encountering issues in your Upon reviewing your file, we see that there are several errors occurring. Here are some potential solutions for you to consider:
def load_model(self, input_size, device='cpu'):
...
self.model.to(device)
...
We hope these suggestions help you resolve the issues in your code. Please let us know if you have any further questions or if you're encountering additional issues. Best regards. |
where is there a models.py? could you help me fix the code on this? |
@curiousdarko thank you for reaching out to us. We apologize for the confusion caused. We understand that Regarding your code, as mentioned earlier, you may try uncommenting def load_model(self, input_size, device='cpu'):
...
self.model.to(device)
... You can change the In addition, you can try using We hope that these suggestions help in fixing the issues you're having. Please feel free to let us know if these changes work or if you require any further assistance. Thank you. |
i dont see what code you are referring to. |
Hello, @curiousdarko, we apologize for any confusion. We were referring to the Additionally, you should also add a def load_model(self, input_size, device='cpu'):
...
self.model.to(device)
... You may also want to change the Finally, adding We hope these suggestions help resolve the issues you're encountering. Please don't hesitate to let us know if you require any further assistance. Thank you. |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Search before asking
YOLOv5 Component
Other
Bug
When i try and use YOLOv5, i get this.
raceback (most recent call last):
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 49, in _create
model = DetectMultiBackend(path, device=device, fuse=autoshape) # detection model
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\models\common.py", line 344, in init
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\models\experimental.py", line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 791, in load
with _open_file_like(f, 'rb') as opened_file:
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 271, in _open_file_like
return _open_file(name_or_buffer, mode)
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 252, in init
super().init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'lib\best.pt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 60, in _create
model = attempt_load(path, device=device, fuse=False) # arbitrary model
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\models\experimental.py", line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 791, in load
with _open_file_like(f, 'rb') as opened_file:
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 271, in _open_file_like
return _open_file(name_or_buffer, mode)
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\serialization.py", line 252, in init
super().init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'lib\best.pt'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\ismae\Desktop\lunar-main\lunarbot v2.py", line 97, in
main()
File "c:\Users\ismae\Desktop\lunar-main\lunarbot v2.py", line 44, in main
lunar = Aimbot(collect_data = "collect_data" in sys.argv)
File "c:\Users\ismae\Desktop\lunar-main\lib\aimbot.py", line 65, in init
self.model = torch.hub.load('ultralytics/yolov5', 'custom', path='lib/best.pt', force_reload = True)
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\hub.py", line 558, in load
File "C:\Users\ismae\anaconda3\lib\site-packages\torch\hub.py", line 587, in _load_local
model = entry(*args, **kwargs)
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 83, in custom
return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
File "C:\Users\ismae/.cache\torch\hub\ultralytics_yolov5_master\hubconf.py", line 78, in _create
raise Exception(s) from e
Exception: [Errno 2] No such file or directory: 'lib\best.pt'. Cache may be out of date, try
force_reload=True
or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading for help.I have uninstalled modules, re installed modules and downloaded and redownloaded the requirements.txt so many times. How on earth do i fix this?
Environment
Minimal Reproducible Example
No response
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: