[go: nahoru, domu]

Skip to content

Commit

Permalink
fix masking logic when using palm as encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jan 8, 2023
1 parent 4cac0e6 commit 6e1baf6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion palm_rlhf_pytorch/palm_rlhf_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,11 @@ def forward(
# mask if encoder
# treat any token ids that are negative as tokens to mask out - only needed if not autoregressive

mask = (x < 0) if not self.causal else None
if not self.causal:
mask = x >= 0
x = x.masked_fill(~mask, 0)
else:
mask = None

# get token embedding

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'PaLM-rlhf-pytorch',
packages = find_packages(exclude=[]),
version = '0.0.47',
version = '0.0.48',
license='MIT',
description = 'PaLM + Reinforcement Learning with Human Feedback - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit 6e1baf6

Please sign in to comment.