-
Notifications
You must be signed in to change notification settings - Fork 24.1k
buffer is not large enough when running pytorch on Mac M1 mps #77886
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
Comments
Same issue with YOLOv5 on MPS noted in #77748 (comment). I see |
This comment was marked as off-topic.
This comment was marked as off-topic.
Fix crashes in view tensors due to buffer size mismatch (pytorch#78247, pytorch#77886)
Fixes #78247, #77886 Pull Request resolved: #78496 Approved by: https://github.com/albanD, https://github.com/malfet
This issue is fixed in PR #78496 (nightly build 1.13.0.dev20220531 or later). |
β¦#78496) Summary: Fixes #78247, #77886 Pull Request resolved: #78496 Approved by: https://github.com/albanD, https://github.com/malfet Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/017b0ae9431ae3780a4eb9bf6d8865dfcd02cd92 Reviewed By: seemethere Differential Revision: D36784418 Pulled By: seemethere fbshipit-source-id: 3558273f2fa3342f4e028fe1186c733bc5a370a8
Same issue with YOLOv5 on device "mps" |
|
β¦#78496) Fixes pytorch#78247, pytorch#77886 Pull Request resolved: pytorch#78496 Approved by: https://github.com/albanD, https://github.com/malfet
@jerjer1223 @GerardWalsh can you please reinstall nightly and see if this resolves ultralytics/yolov5#8102 |
Fixes #78247, #77886 Pull Request resolved: #78496 Approved by: https://github.com/albanD, https://github.com/malfet (cherry picked from commit 017b0ae)
Hello I am still receiving this error. What do I have to do to resolve this bug/issue? Thanks. pytorch nightly version: torch-1.13.0.dev20220607 /AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:782: failed assertion `[MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 160000 bytes |
I'm also still receiving this error, a fix would be appreciated. PyTorch version 1.13.0.dev20220607 Fusing layers... |
No it does not
|
Same issue try running YOLOv5s with mps on M1 Pro YOLOv5 π 2022-6-12 Python-3.9.12 torch-1.13.0.dev20220612 MPS
|
same issue when running with stable baselines 3 contrib PPO recurrent
|
YOLOv5 π v6.1-253-g75bbaa8 Python-3.10.4 torch-1.13.0.dev20220616 MPS /AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:782: failed assertion `[MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 25600 bytes |
Require explicit request for MPS, i.e. ```bash python detect.py --device mps ``` Reverts #8210 for preferring MPS if available. Note that torch MPS is experiencing ongoing compatibility issues in pytorch/pytorch#77886
I confirm I'm experiencing the same YOLOv5 Apple MPS bug with torch 1.12 on MacBook M1: $ glennjocher@Glenns-MacBook-Air yolov5 % python detect.py --device mps
detect: weights=yolov5s.pt, source=data/images, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=mps, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 π v6.1-386-g858a1a3 Python-3.9.13 torch-1.12.0 MPS
Fusing layers...
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients
/AppleInternal/Library/BuildRoots/b6051351-c030-11ec-96e9-3e7866fcf3a1/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:782: failed assertion `[MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 25600 bytes |
@albanD @razarmehr is this error supposed to exist in torch 1.12? I see the fix was was in a 1.13 nightly. |
Require explicit request for MPS, i.e. ```bash python detect.py --device mps ``` Reverts #8210 for preferring MPS if available. Note that torch MPS is experiencing ongoing compatibility issues in pytorch/pytorch#77886
Hi, I'm not sure if this made it for the release no. |
Reopening to investigate if it still crashes on trunk, and if it is not, why Pytorch-1.12 is still affected |
Require explicit request for MPS, i.e. ```bash python detect.py --device mps ``` Reverts ultralytics#8210 for preferring MPS if available. Note that torch MPS is experiencing ongoing compatibility issues in pytorch/pytorch#77886
I'm still getting the issue on 1.13.0.dev20220712 Is there any fix? |
@glenn-jocher, @daniwnwd this should be fixed in the latest PyTorch nightly (1.13.0.dev20220722). Could you please let me know if you are still seeing the issue on your end? |
@DenisVieriu97 |
@DenisVieriu97 I confirm that the original YOLOv5 inference still fails on |
Thanks a lot @crayon7442 and @glenn-jocher for checking this! |
@DenisVieriu97 awesome! Thanks for the update. |
Require explicit request for MPS, i.e. ```bash python detect.py --device mps ``` Reverts ultralytics#8210 for preferring MPS if available. Note that torch MPS is experiencing ongoing compatibility issues in pytorch/pytorch#77886
I'm on the latest nightly
Edited to hardwrap the long lines |
@astrowonk that's not an error, that's a warning. As the message states not all torch ops are fully converted to MPS yet. |
I think you have have to side scroll to see everything @glenn-jocher, the formatting wasn't great. " Error: buffer is not large enough. Must be 201452 bytes" is there on the last line. and then the kernel dies (in Ipython or Jupyter) |
@astrowonk , can you create a new issue with the network and command line and we will take a look. Thanks. |
@astrowonk ah yes, I stand corrected! |
@kulinseth Opened #86152 |
I just had this issue and I found the solution. It turns out the error was because my MacOS was too old and PyTorch mps was not compatible. If nothing else it working try updating the operating system. |
π Describe the bug
The bug seems related to #77851
To reproduce the bug:
The error message:
Versions
1.12.0.dev20220519
The text was updated successfully, but these errors were encountered: