-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
AttributeError on an Apple M1 #6975
Comments
@DP1701 I think this is a PyTorch issue unrelated to YOLOv5, i.e. pytorch/pytorch#74016 |
@glenn-jocher Thanks for reporting it. Nevertheless, Pytorch 1.11 has brought a significant performance increase on the M1 chip. |
I guess you're using anaconda. And you can try miniconda instead of anaconda. Anaconda does not support M1 very well. |
@zhiqwang I use miniforge, which I installed via homebrew. But I installed Pytorch using pip3 inside a conda environment. |
@DP1701 I haven't seen any performance increases with PyTorch on M1 using pip install. What install method are you using to see performance improvements? I do see that M1 can run CoreML models (but not PyTorch models) extremely fast. Results show 13X speedup vs CPU on base 2020 M1 Macbook Air: ResultsYOLOv5 🚀 v6.1-25-gcaf7ad0 torch 1.11.0 CPU
Reproduce
|
@glenn-jocher I jumped from version 1.9 directly to 1.11. At the beginning I had installed Pytorch via conda directly, because it was recommended by some others (e.g. here towardsdatascience.com ). |
@DP1701 ah ok got it, thanks! I will try a conda install. |
@DP1701 I'm not sure I understand. From your above comment you say you pip installed PyTorch 1.11 in a Conda environment and observed performance increases? This is not my case on M1 with 1.11. Can you post a screenshot of your |
@glenn-jocher I guess I did not explain this correctly. At the beginning I installed PyTorch 1.9.1 with conda, because the tutorial page recommended this. I used this command from the PyTorch page:
Until recently, I stuck with version 1.9.1 because it just worked fine. After I found this entry on the PyTorch page:
I switched to version 1.11. I just created a new conda environment but installed PyTorch with pip in it. So no conda install used. I have attached two screenshots. I have therefore noticed a performance improvement. |
@DP1701 ah ok got it! I installed torch with pip also. On MacBook M1 I see 344 ms as the average for |
@glenn-jocher When I run the default command, I get the following result:
I have the M1 Max. |
@glenn-jocher I have exported my model to CoreML. Is much faster, but unfortunately something is wrong. The class names are not the right ones and I can't change the image size.
When I want to change the image size, I get this error:
|
@DP1701 wow!!! M1 Max is superfast. This is really interesting, we should establish some benchmarks on the full M1 range. CoreML models are only capable of fixed inference sizes, i.e. so if you export at --640 then you can only run inference at --640. |
@glenn-jocher If you want, I can run some benchmarks on the M1 Max. Ahh, I understand. Can I export the model so that it runs the inference test on an image size of 1280x720? Do you have any idea why the object classes are wrong in the CoreML model? |
@DP1701 for CoreML models you should also pass your --data to detect.py so it can read the names from it (they aren't attached to the model like with PyTorch models). I think you should be able to |
@glenn-jocher The object classes are now displayed correctly. Thanks for the hint!
If I export directly with --imgsz 768 1280 (in the ArgumentParser is written -> help='inference size h,w' ) then it works. This is probably related to the rectangular inference or am I wrong? BTW: I think we might get a PyTorch version with GPU support at the next WWDC. Then it could be even better. |
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
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 YOLOv5 🚀 and Vision AI ⭐! |
Search before asking
Question
Hello @glenn-jocher,
do you also get this message when you run Pytorch 1.11 CPU on an Apple M1?
The message appears only after the vaildation is completed.
Additional
No response
The text was updated successfully, but these errors were encountered: