hill-a / stable-baselines

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
http://stable-baselines.readthedocs.io/
MIT License
4.14k stars 723 forks source link

Running Stable Baselines on M1 Macs? #1152

Open adamnhaka opened 2 years ago

adamnhaka commented 2 years ago

Hi everyone,

A while ago (early 2020) to be precise I compiled a DRL project using SB. Since that time, I've moved on to other things. Recently I purchased an ARM-architecture (i.e. M1) Mac and transferred my files over; however, Stable Baselines doesn't function. When I run the project, the kernel keeps restarting with no error message being displayed; I've followed the installation instructions and even matched the version numbers of TF etc. from my old Intel-based machine (on which the code still appears to run fine).

I also tried experimenting with SB-3, for which the Cartpole training example using PPO from the website ([https://stable-baselines3.readthedocs.io/en/master/guide/examples.html]) does appear to run; however, it is extremely slow.

I'd really appreciate if someone could answer the following questions:

  1. Is there a special procedure for installing Stable Baselines and associated components (e.g. TensorFlow) on M1-based Macs?
  2. Is there a performance penalty of running code on these machines?

Cheers!

Miffyli commented 2 years ago

Hey! As you already pointed out, SB3 is an option, and I think it might be the best one. As for your questions:

1) I do not have exact answers, but Tensorflow is definitely the achilles heel. I am not sure if there is M1 support for tensorflow (you have look online for this). However if you are able to install this, installing stable-baselines should then work.

2) I imagine so, as M1 is not generally that performant of a chip (but very power efficient!), and especially on Rosetta. I would imagine you experience the same as you did with SB3.