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

Class InvalidScoreLogitsProcessor

workers/modeling_chatglm_med.py:138–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136 )
137
138class InvalidScoreLogitsProcessor(LogitsProcessor):
139 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
140 if torch.isnan(scores).any() or torch.isinf(scores).any():
141 scores.zero_()
142 scores[..., 20005] = 1e4
143 return scores
144
145
146def load_tf_weights_in_chatglm_6b(model, config, tf_checkpoint_path):

Callers 1

chatMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected