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

Running inference on Mac M1 #75

Open
EtienneAr opened this issue Sep 20, 2023 · 4 comments
Open

Running inference on Mac M1 #75

EtienneAr opened this issue Sep 20, 2023 · 4 comments

Comments

@EtienneAr
Copy link

Hello,

I started trying to run the inference on a Mac Studio (with an Apple M1 Ultra).
So far I managed to install everything using conda and pip with some minor changes.

But now I am having a problem while trying to run an inference (from "Testing your installation" section of the doc, or from test_cosypose_inference.py) :

cam = Panda3dCamera.create(f"camera={idx}", resolution=resolution, app=self._app)

crashes because
graphics_buffer = app.graphicsEngine.make_output(

returns None

Do you have any idea regarding this issue ?
I will keep investigating this problem and will post here if I encounter new ones.

@EtienneAr
Copy link
Author

Hello, I am putting the "latest" update here, so everyone can see it :

I tried a bunch of examples from this repo https://github.com/Schwarzbaer/panda_examples.git (with Panda3d installed from pip)
All of them worked fine, even offscreen rendering. So the Panda3d install doesn't seem to be the problem.

I tried to disable the offscreen rendering in Happypose : it doesn't crash anymore, but it seems like it renders only black images when doing that.
And the tests/test_renderer_panda3d.py still fails.

I did not have much more time yet to investigate on this topic, sorry.

@nim65s
Copy link
Collaborator

nim65s commented Oct 17, 2023

cc @alice-cariou FYI

@Alhuuin
Copy link

Alhuuin commented Oct 31, 2023

Hello,
My fix for this was to simply set the number of back_buffer to 0 after

frame_buffer_props = p3d.core.FrameBufferProperties.getDefault()

The frame buffer properties needed by default are not available on mac. But you can add :
frame_buffer_props = p3d.core.FrameBufferProperties(frame_buffer_props)
frame_buffer_props.set_back_buffers(0)

The first line is necessary because the p3d.core.FrameBufferProperties.getDefault() is const.
With that fix, the scripts run correctly, and the tests/test_renderer_panda3d.py doesn't fail on my side.

I hope it helps

@Alhuuin
Copy link

Alhuuin commented Nov 7, 2023

Hello,

I don’t know if this is the best place to ask, but :
I’ve been having issues trying to use mps instead of cuda on happypose.

The first thing I did was adding mps to the possible devices to be used :
For that, i replaced every occurence of
torch.device('cuda' if torch.cuda.is_available() else 'cpu
by
torch.device('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')

But i had 2 errors :
RuntimeError: slow_conv2d_forward_mps: input(device='cpu') and weight(device=mps:0') must be on the same device
and
FileNotFoundError: [Errno 2] No such file or directory

I made several attempts to fix these errors, including changing the multiprocessing method, but none worked, so i’m open to suggestions.

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

3 participants