Load_adapter vs from_pretrained
Hello, everyone.when using peft library,Scenariomodel = AutoModel.from_pretrained(“your_model”)model = get_peft_model(model, lora_config)model.save_pretrained(“my_dir”)After executing the code above, let’s discuss the differences in the following approaches:Approach 1model = AutoModel.from_pretrained(“your_model”)model = PeftModel.from_pretrained(model, “my_dir”)Approach 2model = AutoModel.from_pretrained(“your_model”)model.load_adapter(“my_dir”)what is different between the two approaches??
2024-03-20T11:50:19Z
I think both approaches are equivalent according to thesource code:if config.task_type not in MODEL_TYPE_TO_PEFT_MODEL_MAPPING.keys():
            model = cls(model, config, adapter_name)
        else:
            model = MODEL_TYPE_TO_PEFT_MODEL_MAPPING[config.task_type](model, config, adapter_name)
        model.load_adapter(model_id, adapter_name, is_trainable=is_trainable, **kwargs)
        return model