Formatron v0.4.9
Formatron empowers everyone to control the output format of language models with minimal overhead.
Loading...
Searching...
No Matches
formatron.integrations.vllm.FormattersLogitsProcessor Class Reference

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)
 
list[bool|None] is_completed (self)
 Check if the formatters are completed.
 
None reset (self)
 
 __call__ (self, prompt, generated_tokens, logits)
 

Protected Member Functions

 _to_next_batch_step (self)
 

Protected Attributes

 _formatters
 
 _eos_token_id
 
 _last_input_id_length
 
 _configs
 
 _iter
 
 _debug_counter
 

Properties

list[dict[str, typing.Any]|None] formatters_captures (self)
 

Detailed Description

Logit processor that uses formatters to mask batch logits.

Definition at line 18 of file vllm.py.

Constructor & Destructor Documentation

◆ __init__()

formatron.integrations.vllm.FormattersLogitsProcessor.__init__ ( self,
typing.Sequence[FormatterBase | None] formatters,
int eos_token_id,
typing.Sequence[EngineGenerationConfig] | None configs = None )

Definition at line 20 of file vllm.py.

Member Function Documentation

◆ __call__()

formatron.integrations.vllm.FormattersLogitsProcessor.__call__ ( self,
prompt,
generated_tokens,
logits )

Definition at line 64 of file vllm.py.

◆ _to_next_batch_step()

formatron.integrations.vllm.FormattersLogitsProcessor._to_next_batch_step ( self)
protected

Definition at line 60 of file vllm.py.

◆ formatters_captures()

list[dict[str, typing.Any] | None] formatron.integrations.vllm.FormattersLogitsProcessor.formatters_captures ( self)

Definition at line 41 of file vllm.py.

◆ is_completed()

list[bool | None] formatron.integrations.vllm.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.

Definition at line 50 of file vllm.py.

◆ reset()

None formatron.integrations.vllm.FormattersLogitsProcessor.reset ( self)

Definition at line 53 of file vllm.py.

Member Data Documentation

◆ _configs

formatron.integrations.vllm.FormattersLogitsProcessor._configs
protected

Definition at line 29 of file vllm.py.

◆ _debug_counter

formatron.integrations.vllm.FormattersLogitsProcessor._debug_counter
protected

Definition at line 31 of file vllm.py.

◆ _eos_token_id

formatron.integrations.vllm.FormattersLogitsProcessor._eos_token_id
protected

Definition at line 23 of file vllm.py.

◆ _formatters

formatron.integrations.vllm.FormattersLogitsProcessor._formatters
protected

Definition at line 22 of file vllm.py.

◆ _iter

formatron.integrations.vllm.FormattersLogitsProcessor._iter
protected

Definition at line 30 of file vllm.py.

◆ _last_input_id_length

formatron.integrations.vllm.FormattersLogitsProcessor._last_input_id_length
protected

Definition at line 24 of file vllm.py.


The documentation for this class was generated from the following file: