question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Can't create the PPO model on Macbook M1

See original GitHub issue

🐛 Bug

I’m using Macbook Pro M1 and running code in Jupyter Notebook. Every time I run the scripts, I get an error and the Kernel crashed. I’ve tried running the code in Google Colab and it went well. It seems to me that stable-baselines3 library doesn’t support M1 chips. What do I need to do now to run the code locally?

To Reproduce


from stable_baselines3 import PPO
from stable_baselines3.common.env_util import make_vec_env

# Parallel environments
env = make_vec_env("CartPole-v1", n_envs=4)

model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=25000)
model.save("ppo_cartpole")

del model # remove to demonstrate saving and loading

model = PPO.load("ppo_cartpole")

obs = env.reset()
while True:
    action, _states = model.predict(obs)
    obs, rewards, dones, info = env.step(action)
    env.render()

Relevant log output / Error message

The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

Canceled future for execute_request message before replies were done

System Info

No response

Checklist

  • I have checked that there is no similar issue in the repo
  • I have read the documentation
  • I have provided a minimal working example to reproduce the bug
  • I’ve used the markdown code blocks for both code and stack traces.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
qgallouedeccommented, Nov 3, 2022

I’m not sure it is actually duplicated. Looking the code, it is supposed run on the CPU. @nguyenhongson1902 in order for us to help you, you need to fill in the template issue completely, especially the system information section. Without this, I am not able to reproduce this bug. (I tried on my M1, everything works fine).

0reactions
qgallouedeccommented, Nov 8, 2022

Do you still encounter the error? What Python version do you use?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance issue on Macbook Pro M1 - Apple Developer
I am trying to train a model on Macbook Pro M1, but the performance is so bad and the train doesn't work properly....
Read more >
PyTorch 1.13 cannot be installed using `poetry` on Mac M1
Describe the bug This is an installation issue. Poetry parses the endpoint at https://pypi.org/pypi/torch/1.13/json to get dependency ...
Read more >
How to Fix 'Computer Account Creation Failed' Error in M1 Mac
Is your M1 Mac stuck after restore? Unable to log in on M1 MacBook? Here is how to fix computer account creation failed...
Read more >
How To Fix M1 Mac Stuck in Create Computer Account
How To Fix M1 Mac Stuck in Create Computer Account |Computer Account Creation Failed Error in M1 MacBOON Apple Supports & Tips is...
Read more >
RLlib- installation on mac m1 - python - Stack Overflow
conda create -n rllib python=3.8 conda activate rllib pip install cmake "ray[rllib]" pip ... from ray.rllib.agents.ppo import PPOTrainer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found