Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom names for AdapterFusion layers #774

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

calpt
Copy link
Member

@calpt calpt commented Jan 2, 2025

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:

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:

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:

# 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")

@calpt calpt marked this pull request as ready for review January 2, 2025 16:10
@calpt calpt requested review from TimoImhof and lenglaender January 2, 2025 16:10
Copy link
Contributor

@TimoImhof TimoImhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@TimoImhof TimoImhof merged commit 303c34b into adapter-hub:main Jan 8, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple AdaptersFusion on same adapters
2 participants