Formatron v0.4.9
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]|None 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 74 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.__init__ | ( | self, | |
typing.Sequence[FormatterBase | None] | formatters, | ||
int | eos_token_id, | ||
typing.Sequence[EngineGenerationConfig] | None | configs = None ) |
Definition at line 76 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.__call__ | ( | self, | |
input_ids, | |||
scores ) |
Definition at line 119 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 106 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 116 of file transformers.py.
None formatron.integrations.transformers.FormattersLogitsProcessor.reset | ( | self | ) |
Definition at line 87 of file transformers.py.
|
protected |
Definition at line 79 of file transformers.py.
|
protected |
Definition at line 78 of file transformers.py.
|
protected |
Definition at line 80 of file transformers.py.
formatron.integrations.transformers.FormattersLogitsProcessor.configs |
Definition at line 85 of file transformers.py.