-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom names for AdapterFusion layers (#774)
Resolves #316. This PR implements the option to specify a custom name for an added AdapterFusion layer. The name can be specified when adding a fusion layer like this: ```python model.add_adapter_fusion(["adapter1", "adapter2"], name="custom_name_fusion") ``` Afterwards, to address the custom-name fusion, specify the name in the `Fuse` block. E.g. for activation: ```python model.set_active_adapters(Fuse("adapter1", "adapter2", name="custom_name_fusion")) ``` Some fusion-specific methods can either take the named `Fuse` block or directly the fusion name: ```python # saving model.save_adapter_fusion("./checkpoint_dir", Fuse("adapter1", "adapter2", name="custom_name_fusion")) # or: # model.save_adapter_fusion("./checkpoint_dir", "custom_name_fusion") # deleting model.delete_adapter_fusion(Fuse("adapter1", "adapter2", name="custom_name_fusion")) # or: # model.delete_adapter_fusion("custom_name_fusion") ``` --------- Co-authored-by: Timo Imhof <[email protected]>
- Loading branch information
Showing
6 changed files
with
140 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters