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

Be more specific about missign RoPE parameters #1781

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Conversation

rasbt
Copy link
Contributor

@rasbt rasbt commented Oct 7, 2024

Suggests which parameters are missing if some of the new extra RoPE parameters are used (as suggested by @Andrei-Aksionov )

@rasbt rasbt requested a review from lantiga as a code owner October 7, 2024 18:46
@rasbt rasbt mentioned this pull request Oct 7, 2024
@rasbt rasbt merged commit 3f4992a into main Oct 7, 2024
8 of 9 checks passed
@rasbt rasbt deleted the missing-params branch October 7, 2024 19:23
@@ -129,8 +129,9 @@ def rope_cache(self, device: Optional[torch.device] = None) -> Tuple[torch.Tenso
}
else:
# Some but not all parameters are specified; raise an error
missing_params = [param for param, present in zip(adjusted_params_required, params_present) if not present]
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that zip in case of iterators of unequal length will iterate till the shortest one.
Maybe you wanted to use itertools.zip_longest, but then how can you guarantee that items in the list will match.

Perhaps convert to sets and return difference.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or you can rewrite the code a bit.
Iterate over required keys and if it is in the config - add it to a dict. If not - to the list of missing keys.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So weird, I tested it yesterday and could swear it worked. But looking at it again with fresh eyes, I do agree with your point about zip.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok relooking at it again, I don't see an issue @Andrei-Aksionov since both lists have the same length in zip. Note that params_present is always a list that has the same length as adjusted_params_required:

adjusted_params_required = ["factor", "low_freq_factor", "high_freq_factor", "original_max_seq_len"]
params_present = [param in self.config.rope_adjustments for param in adjusted_params_required]

Copy link
Contributor

Choose a reason for hiding this comment

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

Again 🙂
Yes, you are right. It's a list of booleans and not a list of keys, so the length should be the same.
It's just more of a mask, rather than a list of params that are presented in the config. That what confused me.

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