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: Extract small function #614

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

madroidmaq
Copy link
Contributor

Extract the load_with_lora function for easy use in other files.

@mzbac
Copy link
Contributor

mzbac commented Mar 25, 2024

Maybe we should consider moving the function out of utils.py. It has becomed too large now, it might be better to create a new file named lora_utils.py and place it there?

@madroidmaq
Copy link
Contributor Author

@mzbac Great suggestion. Initially, I tried placing the load_with_lora function in both tuner/lora.py and tuner/utils.py, but encountered a circular dependency issue. When I attempted to resolve this issue, I found that it required significant changes. So, I ended up putting it in the utils.py.

I will reassess the extent of changes needed to solve the circular dependency problem. The worst-case scenario would be creating a new file named tuner/lora_utils.py, which I will try my best to avoid.

@madroidmaq
Copy link
Contributor Author

The main reason for the circular dependency is the reliance on the load() function in utils.py, which in turn depends on the linear_to_lora_layers function in tuner/utils.py.

I have now removed the logic of actively loading models within functions and instead accept an already loaded model. This can avoid issues with sequential dependencies. Meanwhile, it will be necessary to first load the model and then call the prepare_for_training function when using it, which I think is acceptable.

@madroidmaq madroidmaq changed the title LoRA: Extract load_with_lora function LoRA: Extract prepare_for_training function Mar 27, 2024
@awni
Copy link
Member

awni commented May 3, 2024

@madroidmaq sorry for the delay! I think we can merge this. But could you first rebase to resolve conflicts?

@madroidmaq
Copy link
Contributor Author

madroidmaq commented May 5, 2024

@madroidmaq sorry for the delay! I think we can merge this. But could you first rebase to resolve conflicts?

@awni It's DONE.

@madroidmaq madroidmaq changed the title LoRA: Extract prepare_for_training function LoRA: Extract pre_processing_model function May 5, 2024
@madroidmaq madroidmaq changed the title LoRA: Extract pre_processing_model function LoRA: Extract small function May 5, 2024
Copy link
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

None yet

3 participants