def init_adapters(
        self,
        model: "PreTrainedModel",
        config: type[BasePassConfig],
        *,
        task: Optional[str] = None,
        use_loftq: Optional[bool] = False,
        use_dora: Optional[bool] = False,
    ) -> "PeftModel":
        """Initialize LoRA adapters.

        :param model: The Hugging Face PyTorch model to add LoRA adapters to.
        :param config: The config for the pass run.
        :param task: The task type of the model.
        :param use_loftq: Whether to use LoftQ to initialize weights.
        :param use_dora: Whether to use DoRA to initialize weights.
        :return: The LoRA model.
        """
        config_kwargs = {}
        if use_loftq:
            from peft import LoftQConfig

            config_kwargs = {
                "init_lora_weights": "loftq",
                "loftq_config": LoftQConfig(loftq_bits=4, loftq_iter=config.loftq_iter),
            }
        if use_dora:
            config_kwargs = {
                "use_dora": True,
            }
        if task:
            config_kwargs.update({"task_type": get_peft_task_type_from_task(task, fail_on_not_found=True)})

        return self.get_peft_model(model, config, config_kwargs)
Initialize LoRA adapters.

        :param model: The Hugging Face PyTorch model to add LoRA adapters to.
        :param config: The config for the pass run.
        :param task: The task type of the model.
        :param use_loftq: Whether to use LoftQ to initialize weights.
        :param use_dora: Whether to use DoRA to initialize weights.
        :return: The LoRA model.
        
olive/passes/pytorch/lora.py