How can you switch between adapters in the inference model?
I have a basic model and some trained adapters. How can I switch between them?Based on thedocumentation, this is done using theset_adaptermethod.However, if you look at the code, theadd_adapter,set_adapter,enable_adaptersmethods do not interact in any way with the coefficients stored in theadapter_model.safetensorsfile. The only method that uses the saved adapter coefficients is theload_adaptermethod. I put a breakpoint in theload_filemethod in thetorchfile of thesafetensorspackage and none of the methods exceptload_adaptergo there.The question arises: how then do the recommended methods (add_adapter,set_adapter,enable_adapters) use the coefficients of the trained adapter if they don’t even load them?
2024-05-26T18:46:47Z
I am experiencing the same issues when switching between multiple adapters despite following the documentation, I do not observe any change in the model’s behavior when switching between the adapters.base_model.add_adapter(PeftConfig.from_pretrained(peft_model_output_dir1), adapter_name="adapter_1")
base_model.add_adapter(PeftConfig.from_pretrained(peft_model_output_dir2), adapter_name="adapter_2")When I switch between the adapters using the set_adapter method, there is no observable change in the model’s behavior. The outputs remain the same, regardless of which adapter is active.I suspect that the set_adapter method does not actually activate the specified adapter correctly. Instead, I notice a change in behavior only when I merge the adapter with the base modelThe documentation does not mention the need to perform a merge when switching adapters. Additionally, the methods add_adapter, set_adapter, and enable_adapters do not appear to workPlease provide clarification on how to correctly switch between adapters
2024-05-27T09:36:43Z
Pinging@ybelkadahere