MCPcopy Create free account
hub / github.com/THUDM/GLM / __init__

Method __init__

generation_utils.py:427–435  ·  view source on GitHub ↗
(self, min_length: int, eos_token_id: int)

Source from the content-addressed store, hash-verified

425 """
426
427 def __init__(self, min_length: int, eos_token_id: int):
428 if not isinstance(min_length, int) or min_length < 0:
429 raise ValueError(f"`min_length` has to be a positive integer, but is {min_length}")
430
431 if not isinstance(eos_token_id, int) or eos_token_id < 0:
432 raise ValueError(f"`eos_token_id` has to be a positive integer, but is {eos_token_id}")
433
434 self.min_length = min_length
435 self.eos_token_id = eos_token_id
436
437 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
438 cur_len = input_ids.shape[-1]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected