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

Method __init__

generation_utils.py:345–354  ·  view source on GitHub ↗

Initialize n-best list of hypotheses.

(self, num_beams: int, max_length: int, length_penalty: float, early_stopping: bool)

Source from the content-addressed store, hash-verified

343
344class BeamHypotheses:
345 def __init__(self, num_beams: int, max_length: int, length_penalty: float, early_stopping: bool):
346 """
347 Initialize n-best list of hypotheses.
348 """
349 self.max_length = max_length - 1 # ignoring bos_token
350 self.length_penalty = length_penalty
351 self.early_stopping = early_stopping
352 self.num_beams = num_beams
353 self.beams = []
354 self.worst_score = 1e9
355
356 def __len__(self):
357 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected