PKU-Alignment / omnisafe

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

feat: support safe slac #324

Open Gaiejj opened 5 months ago

Gaiejj commented 5 months ago

Description

This PR is already complete in terms of implementation accuracy. We will merge it shortly after improving the code style and documentation.

Support Safe SLAC[1] algorithms for Safe Vision tasks in Safety-Gymnasium

[1]: Safe Reinforcement Learning From Pixels Using a Stochastic Latent Representation

Example Demo

https://github.com/PKU-Alignment/omnisafe/assets/108712610/46aa5f2d-63be-4c99-9d68-84eeed2b7da5

Experiment and Performance

Motivation and Context

Vision-based safety tasks are of great significance for the safe exploration of agents. The interface for Safe Vision will promote the development of vision-based SafeRL algorithms.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 27.43056% with 418 lines in your changes are missing coverage. Please review.

Project coverage is 91.63%. Comparing base (93d4975) to head (9fd5fd7). Report is 1 commits behind head on main.

:exclamation: Current head 9fd5fd7 differs from pull request most recent head 277b6e1. Consider uploading reports for the commit 277b6e1 to get more accurate results

Files Patch % Lines
omnisafe/common/latent.py 20.92% 121 Missing :warning:
omnisafe/algorithms/off_policy/safe_slac.py 19.67% 98 Missing :warning:
omnisafe/adapter/offpolicy_latent_adapter.py 24.39% 93 Missing :warning:
omnisafe/common/buffer/offpolicy_buffer.py 33.33% 26 Missing :warning:
omnisafe/utils/tools.py 35.00% 26 Missing :warning:
omnisafe/envs/safety_gymnasium_vision_env.py 46.67% 24 Missing :warning:
omnisafe/utils/model.py 40.74% 16 Missing :warning:
omnisafe/common/buffer/base.py 39.13% 14 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #324 +/- ## ========================================== - Coverage 96.83% 91.63% -5.21% ========================================== Files 138 142 +4 Lines 7071 7643 +572 ========================================== + Hits 6847 7003 +156 - Misses 224 640 +416 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.