-
Notifications
You must be signed in to change notification settings - Fork 60
Modified OpenELM.py, mincpm.py, gpt2.py, gpt_bigcode.py, internlm2.py code to make it work with mypy #61
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
base: main
Are you sure you want to change the base?
Conversation
@awni can you please review this PR ?? |
@awni can you please review this PR ?? |
Will try and get to it soon. |
Sure. Will be waiting for your response. Meanwhile I will try to run the mypy command on the entire repository to see if there are any files which are still incompatible |
Thanks for your awesome review @awni ! I would take a note of all the changes and make those as soon as possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this. I left a few comments, please address and then I can review again.
@awni Thanks for the amazing and systematic review on this code. I have taken all of your suggestions into considerations and made the changes to this PR |
@@ -77,12 +77,14 @@ def get_token_score(self, token_id: int) -> float: | |||
def added_tokens(self) -> Iterable[Tuple[bytes, float, TokenType]]: | |||
for text in self.added_tokens_list: | |||
if text in self.specials: | |||
toktype = self.get_token_type(self.specials[text], "", self.special_ids) | |||
toktype = self.get_token_type( | |||
self.specials[text], text.encode("utf-8"), self.special_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like the same behavior. I'm just wondering what motivated the change here and if this code is still working? Or maybe it wasn't working before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it gave some mypy errors initially. Doing this change fixed them.
mlx_lm/models/deepseek_v2.py
Outdated
@@ -197,54 +198,13 @@ def __init__(self, config: ModelArgs): | |||
**rope_kwargs, | |||
) | |||
|
|||
def __call__( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's happening here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. How it got deleted. Wasn't intentional. Probably while fixing merge conflicts maybe? Just guessing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, I left a few more comments to sort out.
Thanks for your amazing review @awni I will make these changes and push the code today |
@awni I made all the changes suggested. Can you please review this?? |
on executing the following command before this change:
mypy --explicit-package-bases --ignore-missing-imports models/openelm.py
Output:
After this change: