-
Notifications
You must be signed in to change notification settings - Fork 18
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
Installing Root_trainer on an M1 Max Apple Silicon #86
Comments
Hi! I like this idea, but I am not really sure exactly what is involved and I don't personally have an M1 Mac so it might be quite hard to develop/test it. From this page: https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/ It looks like it might be as simple as updating your pytorch version after installing the RootPainter server. Perhaps you could try this and let me know how it goes? In general I recommend connecting to a remote server somewhere if you don't have a suitable GPU. If you dont have your own remote server you could try the colab tutorial: https://colab.research.google.com/drive/104narYAvTBt-X4QEDrBSOZm_DRaAKHtA?usp=sharing The colab setup is a bit slow because its using google drive for sync and the GPU is not amazing but it often gets the job done. Kind regards, |
From https://pytorch.org/get-started/locally/ and It looks like macOS 12.3 or later is required. |
Made an attempt at implementing this. See commit message in 935fd6a for summary of what was done and the issues faced |
This is very helpful, I was also down the path of using ".to(device)" but was stuck with torch.loaf() calls. I will also try it again with the new information from @rohanorton . @Abe404 I am using MAC OS 12.3x. I think we'll be able to get this. |
I have been working on this today using an Apple M2 Max. The branch '86-installing-root_trainer-on-an-m1-max-apple-silicon' now contains working code for performing training and inference on an apple GPU using RootPainter. This is still a work in progress and I have more testing to do. The implementation will likely change, but I wanted to update you here in case you would like to try it out :) Testing it out will require installing/running from source. I will perform some more in depth tests but training seems fairly quick compared to Colab. For users with a suitable (recent/modern) MacBook I believe this will be a superior solution to using Google Colab and will suffice in many cases. |
OK the segment folder function does not work yet. I am working on it. I had to upgrade to PyQt6 to build the client on an M2 Mac. This has caused a few breaking changes but they aren't very hard to fix. |
The segment_folder function is now working again after the changes in the following commit. I'm trying to make a version of the client that builds on an M2 chip and the necessary changes (switching to PyQt6) have introduced these bugs. If you want to try this now it might be better just to use the server in this branch and download one of the Mac clients from the releases. For now I expect everything on the extras menu and measurements menu to crash (in this WIP pyqt6 client). I'll update soon when I have more fixes. |
Would love to get the server running on my M1 mac. I installed the m1 branch from github (86-installing-root_trainer-on-an-m1-max-apple-silicon) and tried to run the
I'm not very good at python so I'm not sure what's causing the syntax error -- is there a missing colon after the function definition? (I also get the same error if I import the start function and try to run it from python). Would appreciate any tips you can offer! Thanks for all your great work on this software -- we've been finding it very useful in our research. Ethan Edit: I added the colon after def stop_fn() and it works now, so I guess this was the issue... |
I'm afraid I'm getting a different error now after I tried to start training with the local server. I am using the latest release of the client from the main branch (v 0.2.27). The new error reads:
|
Hi Ethan, Thanks for the kind words. Thanks for reporting these issues. This branch is a little less stable compared to the master branch, but I'm happy to fix that. I'll work on these issues today and will update you again soon. Kind regards, |
Syntax error fixed: My bad. I should have ran the tests/linter before committing this error. |
…DataLoader (fixing issue reported by #86 (comment))
I believe this is now fixed. (fix in 182460a). Can you please pull the latest code and let me know how it goes and if you run into any more problems. This branch is still a bit 'work in progress' as I have some more tests I'd like to do before merging it back into the master branch so it is especially useful for me to hear how your testing goes and if you run into any issues. Thanks again for your support and for reaching out with the detailed error message. Kind regards, |
Thank you very much for looking into this! I am getting a different error now after reinstalling with your new commits:
Not sure where the multi_epoch module is supposed to come from? |
The multi_epoch module is found here: I think the missing multi_module might be an issue related to the method of installation and running using start-trainer.
|
Thanks. I think you're right that it was an installation issue. I was using pip to try to clone the m1 branch from github but it seems like it wasn't installing the multi_epoch folder? It seems to be working now after following your instructions. Thank you very much! I will update you if I run into any more issues. (Also FIY, I can already see that it's running much much faster from the local server on my computer compared to google colab). |
Seems like it. I will try to figure out why when I start working on the next pip release.
Ace!
Yes, I think think this is a big deal. I have had a similar experience. My plan is to create a version of RootPainter for Mac where the server is integrated into the client. Basically a stand-alone integrated version which does not require any command line usage. The first step is to get this version released (that still requires some command line usage to install the server with pip etc) and then I will try to create some kind of UI widget to allow the trainer to be managed from within the client. |
The integrated version sounds great. Would definitely make the barrier to entry a lot lower for people who don't want to fiddle around with the command line. Thanks again for all your help!! |
I had trouble installing root-painter-trainer on a macbook M1 running Macos 15.1. The imagecodecs seemed to be the root of it all, possibly in combination with the python version. Here is what I did to install the server:
at which point I get the |
Hi Jon, The current instructions for getting the RootPainter trainer installed and running on Mac are the following: They seemed to work well for myself and @ethanbass so that's my recommendation for now until I can get these changes into the main release. Kind regards, |
Unfortunately, that does not work. It seems to rely on distutils, which since Python 3.12 is no longer included [https://stackoverflow.com/questions/77247893/modulenotfounderror-no-module-named-distutils-in-python-3-12]. Installing it via setuptools [https://pypi.org/project/setuptools/] gives new problems:
ChatGPT thinks that this is also a Python version problem. Unfortunately, while I'm not familiar with venv but it seems resistant to making environments with different versions of python. |
Thanks for sharing these details. I will install python3.13 on my Mac and see if I can reproduce the problem (and then fix it). |
fbb2846 is a commit that includes the fixes. Unfortunately this Mac (local training) version is still not as well tested and I am not yet fully confident in it. |
Hi Abraham,
Is there a way to install the server on a Mac using Apple Silicon (M1 Max) to take advantage of the GPU directly and not use Rozetta emulation? Any help to get started would be highly appreciated.
The text was updated successfully, but these errors were encountered: