Skip to content

Commit 32afa7b

Browse files
TongLi3701Tong Li
andauthored
fix empty tensor (#6319)
Co-authored-by: Tong Li <[email protected]>
1 parent bcf2459 commit 32afa7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

applications/ColossalChat/coati/distributed/grpo_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def step(self, step_idx: int, pbar: Any, **kwargs) -> Optional[float]:
254254
true_indices = torch.nonzero(effective_prompts_mask)
255255
# Make sure the indices are not empty.
256256
if true_indices.numel() > 0:
257-
true_indices = true_indices.squeeze()
257+
true_indices = true_indices.squeeze(-1)
258258
if excessive_prompts_per_rank <= len(true_indices):
259259
excessive_prompts_idx = true_indices[-excessive_prompts_per_rank:]
260260
else:

0 commit comments

Comments
 (0)