Skip to content

Commit

Permalink
fix loss
Browse files Browse the repository at this point in the history
  • Loading branch information
albertbou92 committed Apr 16, 2024
1 parent d5848ee commit 96effb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/a2c/a2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ def create_env_fn():
loss = loss_module(batch)
loss = loss.named_apply(
lambda name, value: (
(value * mask).mean() if name.startswith("loss_") else value
(value * mask).mean()
if name.startswith("loss_")
else value
# (value * mask).sum(-1).mean(-1) if name.startswith("loss_") else value
),
batch_size=[],
Expand Down
4 changes: 3 additions & 1 deletion scripts/ppo/ppo.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ def create_env_fn():
loss = loss_module(batch)
loss = loss.named_apply(
lambda name, value: (
value * mask).mean() if name.startswith("loss_") else value
(value * mask).mean()
if name.startswith("loss_")
else value
# (value * mask).sum(-1).mean(-1) if name.startswith("loss_") else value
),
batch_size=[],
Expand Down

0 comments on commit 96effb1

Please sign in to comment.