Skip to main content

Python class

LoRAConfig

LoRAConfig

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

source

Bases: ConfigFileModel

Configuration for LoRA (Low-Rank Adaptation) inference.

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

source

Whether LoRA adapters are enabled on the server.

lora_paths

lora_paths: list[str]

source

The list of statically defined LoRA adapter paths.

max_lora_rank

max_lora_rank: int

source

The maximum rank of all LoRA adapters.

max_num_loras

max_num_loras: int

source

The maximum number of active LoRA adapters in a batch.

model_config

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'strict': False}

source

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init()

model_post_init(context, /)

source

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