MCPcopy Create free account
hub / github.com/THUDM/LongWriter / __call__

Method __call__

train/patch/modeling_chatglm.py:60–64  ·  view source on GitHub ↗
(self, input_ids: torch.LongTensor, scores: torch.FloatTensor)

Source from the content-addressed store, hash-verified

58
59class InvalidScoreLogitsProcessor(LogitsProcessor):
60 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
61 if torch.isnan(scores).any() or torch.isinf(scores).any():
62 scores.zero_()
63 scores[..., 5] = 5e4
64 return scores
65
66def split_tensor_along_last_dim(
67 tensor: torch.Tensor,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected