-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 special token cleanup when using language models #5354
Conversation
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.
👍
def cleanup_tokens( | ||
token_ids_string: List[Tuple[int, Text]], delimiter: Text | ||
) -> Tuple[List[int], List[Text]]: | ||
"""Utility method to apply specific delimiter based cleanup on list of tokens""" |
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.
We should use the full docstring symtax, e.g. including Args
and Return
. But we also have another issue for that.
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 pointing it out. Will address it as part of that issue.
token_ids, token_strings = zip(*token_ids_string) | ||
return token_ids, token_strings |
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.
token_ids, token_strings = zip(*token_ids_string) | |
return token_ids, token_strings | |
return zip(*token_ids_string) |
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.
@tabergma Get a type error if I do that, that's why had to first unpack it and then return.
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.
ok, thanks for the explanation, then I guess it is fine
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)