rl icon indicating copy to clipboard operation
rl copied to clipboard

[BUG] remove error catches (try/except) in objectives

Open vmoens opened this issue 1 year ago • 2 comments

We still have a bunch of try/except in losses such as PPO to compute the entropy. We need to remove them for compile compatibility.

vmoens avatar Aug 27 '24 13:08 vmoens

even if if never catches the exception is try/except still problematic? for example if the code to compute the entropy is the following:

try:
    e = dist.entropy()
except NotImplementedError:
    x = dist.rsample((samples_mc,))
    e = -dist.log_prob(x).mean(0)

And we run it with a dist with the entropy method implemented. Will then be compatible with compile? I guess so right?

albertbou92 avatar Sep 07 '24 16:09 albertbou92

Compile will be happy, but not when it's not available and then the error won't be very clear. Because we know if advance if the distribution has an entropy function, we should patch that.

vmoens avatar Sep 09 '24 17:09 vmoens