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

LoRA injection utils #3

Merged
merged 1 commit into from
Aug 2, 2023
Merged

LoRA injection utils #3

merged 1 commit into from
Aug 2, 2023

Conversation

RyanJDick
Copy link
Collaborator

Add utils and classes to support injecting LoRA layers into existing networks.

from invoke_training.lora.lora_block import LoRABlock


def find_modules(
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you plan on deciding which device to use with torch? In the main app we do a lot of passing around a torch.device object between functions. Could be nice if there's a cleaner way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call out. I hadn't thought about that yet here. As a start, I think I'll update from_layer(...) to copy the device from the original layer. I can't think of a use case for wanting to override that, but it would be easy enough to add a device parameter to inject_lora_layers(...) in the future if we wanted to.

I'll make this change in PR #2

Copy link
Collaborator

Choose a reason for hiding this comment

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

could be a fast follow in a new PR to get everything consolidated into main for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 2225965

Copy link
Collaborator

@brandonrising brandonrising left a comment

Choose a reason for hiding this comment

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

lgtm

@RyanJDick RyanJDick mentioned this pull request Aug 2, 2023
1 task
Base automatically changed from ryan/lora-linear-layer to main August 2, 2023 15:07
@RyanJDick RyanJDick merged commit 374750e into main Aug 2, 2023
1 check passed
@RyanJDick RyanJDick deleted the ryan/lora-injection branch August 2, 2023 15:10
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.

2 participants