Skip to content

Commit

Permalink
fixed an issue on the response stabilisation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmnp19 committed Sep 3, 2024
1 parent fbd03d1 commit 5516281
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion piglot/utils/composition/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def composition_torch(self, inner: torch.Tensor, params: torch.Tensor) -> torch.
# Iterate to ensure numerical stability
while u <= max_u:
exp_sum = torch.sum(torch.exp(tch_values), dim=-1)
if not torch.isinf(exp_sum):
if not torch.any(torch.isinf(exp_sum)):
break # Early stopping if condition is met
u += u_increment
tch_values = tch_numerator / u # Recalculate tch_values with updated u
Expand Down

0 comments on commit 5516281

Please sign in to comment.