Formatron v0.4.2
Formatron empowers everyone to control the output format of language models with minimal overhead.
|
Logit processor that uses formatters to mask batch logits. More...
Public Member Functions | |
__init__ (self, typing.Sequence[FormatterBase|None] formatters, int eos_token_id, typing.Sequence[EngineGenerationConfig] configs=None) | |
None | reset (self) |
list[bool|None] | is_completed (self) |
Check if the formatters are completed. | |
__call__ (self, input_ids, scores) | |
Public Attributes | |
configs | |
Protected Attributes | |
_formatters | |
_eos_token_id | |
_last_input_id_length | |
Properties | |
list[dict[str, typing.Any]|None] | formatters_captures (self) |
Get the captures of the formatters. | |
Logit processor that uses formatters to mask batch logits.
Definition at line 54 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.__init__ | ( | self, | |
typing.Sequence[FormatterBase | None] | formatters, | ||
int | eos_token_id, | ||
typing.Sequence[EngineGenerationConfig] | configs = None ) |
Definition at line 56 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.__call__ | ( | self, | |
input_ids, | |||
scores ) |
Definition at line 99 of file transformers.py.
list[dict[str, typing.Any] | None] formatron.integrations.transformers.FormattersLogitsProcessor.formatters_captures | ( | self | ) |
Get the captures of the formatters.
Each element in the list corresponds to the captures of the formatter at the same index. If the formatter is None, the element is None.
Definition at line 86 of file transformers.py.
list[bool | None] formatron.integrations.transformers.FormattersLogitsProcessor.is_completed | ( | self | ) |
Check if the formatters are completed.
Each boolean in the list corresponds to the completion status of the formatter at the same index. If the formatter is None, the element is None.
Definition at line 96 of file transformers.py.
None formatron.integrations.transformers.FormattersLogitsProcessor.reset | ( | self | ) |
Definition at line 67 of file transformers.py.
|
protected |
Definition at line 59 of file transformers.py.
|
protected |
Definition at line 58 of file transformers.py.
|
protected |
Definition at line 60 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.configs |
Definition at line 65 of file transformers.py.