Skip to content

Enable LoRA target names arg #2166

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

Merged

Conversation

divyashreepathihalli
Copy link
Collaborator

No description provided.

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Mar 24, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Mar 24, 2025
@divyashreepathihalli divyashreepathihalli changed the title Enable lora target names arg Enable LoRA target names arg Mar 24, 2025
@SamanehSaadat
Copy link
Member

Could you add a little bit of context on why we need to make target_names an argument?

@divyashreepathihalli
Copy link
Collaborator Author

This would give the users flexibility to specify custom target names. It was a feature requested by internal customers teams.

@divyashreepathihalli divyashreepathihalli added the kokoro:force-run Runs Tests on GPU label Mar 25, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Runs Tests on GPU label Mar 25, 2025
Copy link
Collaborator

@abheesht17 abheesht17 left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM!

target_names = self.get_lora_target_names()

if target_names is None:
target_names = self.get_lora_target_names()
Copy link
Member

Choose a reason for hiding this comment

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

Calling get_lora_target_names() on a model won't return target_names if target_names is not None which could be confusing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is the expected behavior right?
if None -> get default name
else -> use the names provided

Copy link
Member

Choose a reason for hiding this comment

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

The expected behavior for get_lora_target_names() doesn't seem correct to me. I expect get_lora_target_names() to always return the target_names that is passed as the argument but here it always returns defaults. For example, if you do this:

model.enable_lora(rank=2, target_names=["query"])
model.get_lora_target_names() # this will return ["query_dense", "value_dense", "query", "value"] but should return ["query"]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

get_lora_target_names() is not an exposed method right?

Copy link
Member

Choose a reason for hiding this comment

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

Even if it's not exposed, I think it should have the correct behavior of returning the actual target names.
And here get_lora_target_names() is a public function and it's exposed. right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm.. okay - let me send a quick fix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

here - #2167

@divyashreepathihalli divyashreepathihalli merged commit 6ac9222 into keras-team:master Mar 25, 2025
11 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.

4 participants