Skip to content

Commit 510bdf2

Browse files
author
swarna
committed
simplifying
1 parent 585b744 commit 510bdf2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/fairseq2/recipes/lm/_online_finetune/_rewards.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,9 @@ def convert_pairwise_rewards_to_pointwise(self, batch_pairwise_rewards, batch_pa
998998

999999
# Compute average pointwise rewards
10001000
avg_prompt_rewards = [0.0] * R
1001-
for prompt_reward, count in zip(prompt_rewards, counts):
1002-
if count > 0:
1003-
avg_prompt_rewards.append(round(prompt_reward / count, 4))
1001+
for i in range(len(prompt_rewards)):
1002+
if counts[i] > 0:
1003+
avg_prompt_rewards[i] = round(prompt_rewards[i] / counts[i], 4)
10041004

10051005
batch_pointwise_rewards.append(avg_prompt_rewards)
10061006

0 commit comments

Comments
 (0)