Fix hunyuan 1.5 get_byt5_text_tokens#565
Conversation
Summary of ChangesHello @helloyongyang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a dedicated function to handle the tokenization of text prompts for the byT5 model within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new helper method get_byt5_text_tokens to encapsulate the tokenization logic for the byT5 model. This is a good refactoring for clarity. My review includes a suggestion to mark this new method as a static method, as it does not depend on the instance's state, which improves code clarity.
| result = list(dict.fromkeys(result)) if len(result) > 1 else result | ||
| return result | ||
|
|
||
| def get_byt5_text_tokens(self, byt5_tokenizer, byt5_max_length, text_prompt): |
There was a problem hiding this comment.
Since this method doesn't use the instance (self), it can be defined as a static method. This makes it clear that the method's behavior is independent of the object's state. To do this, add the @staticmethod decorator and remove the self parameter.
@staticmethod
def get_byt5_text_tokens(byt5_tokenizer, byt5_max_length, text_prompt):
No description provided.