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

fix llama2 70b lora tuning bug #7622

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion nemo/collections/nlp/parts/peft_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def __init__(self, cfg):
else:
kv_channels = cfg.kv_channels
projection_size = kv_channels * cfg.num_attention_heads
num_query_groups = cfg.get("num_query_groups", None)
if num_query_groups is None:
num_query_groups = cfg.num_attention_heads
qkv_projection_size = projection_size + (2 * kv_channels * num_query_groups)
Copy link
Collaborator

Choose a reason for hiding this comment

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

will this continue to work for non-group query attention models?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes! Tested with llama2 7b as well.


config_args = {
"in_features": cfg.hidden_size,
"out_features": 3 * projection_size,
"out_features": qkv_projection_size,
"dim": lora_cfg.adapter_dim,
"norm_position": None,
"norm_type": None,
Expand Down
Loading