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

Class LogitsProcessorList

generation_utils.py:402–413  ·  view source on GitHub ↗

This class can be used to create a list of :class:`~transformers.LogitsProcessor` or :class:`~transformers.LogitsWarper` to subsequently process a :obj:`scores` input tensor. This class inherits from list and adds a specific `__call__` method to apply each :class:`~transformers.LogitsPr

Source from the content-addressed store, hash-verified

400
401
402class LogitsProcessorList(list):
403 """
404 This class can be used to create a list of :class:`~transformers.LogitsProcessor` or
405 :class:`~transformers.LogitsWarper` to subsequently process a :obj:`scores` input tensor. This class inherits from
406 list and adds a specific `__call__` method to apply each :class:`~transformers.LogitsProcessor` or
407 :class:`~transformers.LogitsProcessor` to the inputs.
408 """
409
410 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor) -> torch.FloatTensor:
411 for processor in self:
412 scores = processor(input_ids, scores)
413 return scores
414
415
416class MinLengthLogitsProcessor(LogitsProcessor):

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected