lm_polygraph.stat_calculators.infer_causal_lm_calculator module

class lm_polygraph.stat_calculators.infer_causal_lm_calculator.InferCausalLMCalculator(n_alternatives: int = 10, tokenize: bool = False, return_embeddings: bool = True)[source]

Bases: StatCalculator

Performs inference of the model and ensures that output contains 1. logprobas 2. tokens 3. embeddings

For Whitebox model (lm_polygraph.WhiteboxModel), at input texts batch calculates: * generation texts * tokens of the generation texts * probabilities distribution of the generated tokens * attention masks across the model (if applicable) * embeddings from the model

static meta_info() Tuple[List[str], List[str]][source]

Returns the statistics and dependencies for the calculator.