def get_peft_model(
        model: "PreTrainedModel", config: type[BasePassConfig], config_kwargs: dict = None
    ) -> "PeftModel":
        """Get the PEFT model for LoRA fine-tuning."""
        from peft import LoraConfig, LoraRuntimeConfig, get_peft_model

        if config_kwargs is None:
            config_kwargs = {}

        lora_config = LoraConfig(
            r=config.r,
            lora_alpha=config.alpha,
            lora_dropout=config.lora_dropout,
            target_modules=config.target_modules,
            bias="none",
            modules_to_save=config.modules_to_save,
            runtime_config=LoraRuntimeConfig(ephemeral_gpu_offload=config.ephemeral_gpu_offload),
            **config_kwargs,
        )

        return get_peft_model(model, lora_config)
Get the PEFT model for LoRA fine-tuning.
olive/passes/pytorch/lora.py