duzx16
commited on
Commit
·
220f772
1
Parent(s):
f9f74fd
Fix overflow in FP16
Browse files- modeling_chatglm.py +1 -1
modeling_chatglm.py
CHANGED
|
@@ -51,7 +51,7 @@ class InvalidScoreLogitsProcessor(LogitsProcessor):
|
|
| 51 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
|
| 52 |
if torch.isnan(scores).any() or torch.isinf(scores).any():
|
| 53 |
scores.zero_()
|
| 54 |
-
scores[..., 20005] =
|
| 55 |
return scores
|
| 56 |
|
| 57 |
|
|
|
|
| 51 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
|
| 52 |
if torch.isnan(scores).any() or torch.isinf(scores).any():
|
| 53 |
scores.zero_()
|
| 54 |
+
scores[..., 20005] = 5e4
|
| 55 |
return scores
|
| 56 |
|
| 57 |
|