Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
75c53890
Unverified
Commit
75c53890
authored
Aug 01, 2023
by
Wenhao Chen
Committed by
GitHub
Aug 01, 2023
Browse files
[chat] fix compute_approx_kl (#4338)
parent
03654c0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
applications/Chat/coati/models/utils.py
applications/Chat/coati/models/utils.py
+1
-1
No files found.
applications/Chat/coati/models/utils.py
View file @
75c53890
...
...
@@ -19,7 +19,7 @@ def compute_approx_kl(log_probs: torch.Tensor,
action_mask: Mask for actions.
"""
log_ratio
=
log_probs
-
log_probs
_base
log_ratio
=
log_probs
_base
-
log_probs
approx_kl
=
(
log_ratio
.
exp
()
-
1
)
-
log_ratio
if
action_mask
is
not
None
:
approx_kl
=
masked_mean
(
approx_kl
,
action_mask
,
dim
=
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment