MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / non_pad_len

Function non_pad_len

seq2seq/constrained_seq2seq.py:50–51  ·  view source on GitHub ↗
(tokens: np.ndarray)

Source from the content-addressed store, hash-verified

48 decoding_format: str,
49 tokenizer: PreTrainedTokenizer) -> Callable[[EvalPrediction], Dict]:
50 def non_pad_len(tokens: np.ndarray) -> int:
51 return np.count_nonzero(tokens != tokenizer.pad_token_id)
52
53 def decode_pred(pred: EvalPrediction) -> Tuple[List[str], List[str]]:
54 return decode_tree_str(pred.predictions, tokenizer), decode_tree_str(pred.label_ids, tokenizer)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected