Skip to main content

Python module

lora_config

MAX LoRA configuration.

LoRAConfig

class max.pipelines.lib.lora_config.LoRAConfig(*, config_file=None, section_name=None, enable_lora=False, lora_paths=<factory>, max_lora_rank=16, max_num_loras=1)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

  • config_file (str | None)
  • section_name (str | None)
  • enable_lora (bool)
  • lora_paths (list[str])
  • max_lora_rank (int)
  • max_num_loras (int)

enable_lora

enable_lora: bool

Enables LoRA on the server

help()

static help()

Return type:

dict[str, str]

lora_paths

lora_paths: list[str]

List of statically defined LoRA paths

max_lora_rank

max_lora_rank: int

Maximum rank of all possible LoRAs

max_num_loras

max_num_loras: int

The maximum number of active LoRAs in a batch.

This controls how many LoRA adapters can be active simultaneously during inference. Lower values reduce memory usage but limit concurrent adapter usage.

model_config

model_config: ClassVar[ConfigDict] = {}

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

Was this page helpful?