PKU-Alignment / omnisafe

JMLR: OmniSafe is an infrastructural framework for accelerating SafeRL research.
https://www.omnisafe.ai
Apache License 2.0
933 stars 132 forks source link

[BUG] Omnisafe cannot run on a Mac M1 device #190

Closed u21h2 closed 1 year ago

u21h2 commented 1 year ago

Required prerequisites

What version of OmniSafe are you using?

0.2.2

System information

3.9.13 (main, Aug 25 2022, 18:29:29) [Clang 12.0.0 ] darwin 0.2.2

Problem description

Admittedly, this is a very nice library. However, Omnisafe has the following bug when i run the following command omnisafe train --algo PPO --total-steps 1024 --vector-env-nums 1 --custom-cfgs algo_cfgs:update_cycle --custom-cfgs 512 --device cpu.

image

Note: My device is MacBook Pro M1 Pro.

Reproducible example code

The Python snippets:

Command lines:

Extra dependencies:

Steps to reproduce:

1. 2. 3.

Traceback

No response

Expected behavior

No response

Additional context

No response

zmsn-2077 commented 1 year ago

We have not tested on the Mac platform before, but it seems necessary to support Mac and Windows platforms, we will start testing on the Mac platform as soon as possible and give a solution.

zmsn-2077 commented 1 year ago

Thank you for providing your invaluable feedback. We would like to inform you that the OmniSafe repo has undergone an intense refactoring process over the past two weeks. The crux of OmniSafe is PyTorch and Safety-Gymnasium, with the former enjoying extensive support from its user community on Mac M-series chips. Our team has conducted an exhaustive examination of the Safety-Gymnasium's compatibility with Mac, and we are pleased to report that OmniSafe can now be trained on the Mac's M1 chip. Our detailed results were obtained using the macOS Ventura 13.3.1 and Apple M1 Max platform for testing.

image

If you meet the following error,

RuntimeError: No ffmpeg exe can be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable. you can paste the following code into gymnasium/utils/save_video.py after from gymnasium import logger

import os
os.environ["IMAGEIO_FFMPEG_EXE"] = "/usr/bin/ffmpeg"

For more details about this error, you can refer to https://github.com/Zulko/moviepy/issues/1158

In addition to that, following OmniSafe's installation instructions, you can train your SafeRL model on MacOS.