MCPcopy Create free account
hub / github.com/FreedomIntelligence/CMB / InvalidScoreLogitsProcessor

Class InvalidScoreLogitsProcessor

workers/chatglm3_modeling.py:53–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53class InvalidScoreLogitsProcessor(LogitsProcessor):
54 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
55 if torch.isnan(scores).any() or torch.isinf(scores).any():
56 scores.zero_()
57 scores[..., 5] = 5e4
58 return scores
59
60
61class PrefixEncoder(torch.nn.Module):

Callers 2

chatMethod · 0.70
stream_chatMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected