Python class
SpeculativeConfig
SpeculativeConfig
class max.pipelines.SpeculativeConfig(*, config_file=None, section_name=None, speculative_method=None, num_speculative_tokens=2, rejection_sampling_strategy=None, synthetic_acceptance_rate=None)
Bases: ConfigFileModel
Configuration for speculative decoding.
-
Parameters:
is_eagle()
is_eagle()
Returns whether the speculative method is EAGLE (shared embedding/lm_head).
-
Return type:
is_mtp()
is_mtp()
Returns whether the speculative method is MTP.
-
Return type:
is_standalone()
is_standalone()
Returns whether the speculative method is a standalone model.
-
Return type:
model_config
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'strict': False}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_post_init()
model_post_init(context, /)
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
-
Parameters:
-
- self (BaseModel) – The BaseModel instance.
- context (Any) – The context.
-
Return type:
-
None
num_speculative_tokens
num_speculative_tokens: int
The number of speculative tokens to generate per step.
rejection_sampling_strategy
rejection_sampling_strategy: RejectionSamplingStrategy | None
speculative_method
speculative_method: SpeculativeMethod | None
The speculative decoding method to use.
synthetic_acceptance_rate
uses_greedy_rejection()
uses_greedy_rejection()
Returns whether the greedy rejection sampling strategy is used.
-
Return type:
uses_logit_comparison()
uses_logit_comparison()
Returns whether the logit-comparison sampling strategy is used.
-
Return type:
uses_typical_acceptance()
uses_typical_acceptance()
Returns whether the typical-acceptance sampling strategy is used.
-
Return type:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!