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(cbf): support crabs as a representative control barrier function based algorithm #327

Closed muchvo closed 5 months ago

muchvo commented 5 months ago

Description

feat(cbf): support crabs as a representative control barrier function based algorithm.

We are delighted to have implemented the CRABS(NeurIPS 2021) algorithm, a representative control barrier function based method, and compared it with the original implementation. During the implementation process, we carefully compared the implementation details to ensure that the gradient flow was completely consistent with the code provided by the authors. Our results achieved similar performance, and we hope this contribution will facilitate easier comparisons with CBF-based methods within the SafeRL community, while also leveraging our tool for enhanced research.

However, we observed that this algorithm requires the use of pretrained model parameters as a starting point for training, and it is currently unclear how these parameters are obtained. This issue was also mentioned in the Paper Decision that decide to accept this paper. Fortunately, the authors provided pretrained model parameters for the Swing environment, which allowed us to successfully replicate part of the performance.

Here is the performance of the original paper: image

Here is the performance from our implementation: env_id---SafeInvertedPendulumSwing-v2---6b9b13e5feee035b0c4eef4bf5d8e2d20cb5800c36f27ed24e878b6d82f18c74

Regarding the remaining environments: Move, Upright, and Tilt, we are actively communicating with the authors. If the community has any solutions to this issue and is willing to support us, please feel free to contact us. Your support is crucial to our progress.

Motivation and Context

Why is this change required? What problem does it solve? If it fixes an open issue, please link to the issue here. You can use the syntax close #15213 if this solves the issue #15213

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 84.61538% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 96.57%. Comparing base (c6c8aa9) to head (a0d10b8).

Files Patch % Lines
omnisafe/common/offline/dataset.py 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #327 +/- ## ========================================== - Coverage 96.59% 96.57% -0.01% ========================================== Files 139 139 Lines 7090 7089 -1 ========================================== - Hits 6848 6846 -2 - Misses 242 243 +1 ```

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