Skip to content

Fix hunyuan 1.5 get_byt5_text_tokens#565

Merged
llmc-reviewer merged 1 commit intomainfrom
hy
Dec 4, 2025
Merged

Fix hunyuan 1.5 get_byt5_text_tokens#565
llmc-reviewer merged 1 commit intomainfrom
hy

Conversation

@helloyongyang
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 hunyuan15 input encoder. This change aims to standardize and encapsulate the tokenization process, ensuring that text inputs are correctly prepared with appropriate padding, truncation, and special tokens for model consumption, addressing a potential issue or improving existing tokenization practices.

Highlights

  • New Tokenization Utility: A new method, get_byt5_text_tokens, has been added to model.py to specifically handle the tokenization of text prompts for the byT5 model.
  • Standardized byT5 Tokenization: This new function encapsulates the logic for tokenizing text using the byT5 tokenizer, ensuring consistent application of parameters like max_length, padding, truncation, and add_special_tokens.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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):

@llmc-reviewer llmc-reviewer merged commit 33f0f67 into main Dec 4, 2025
2 checks passed
@helloyongyang helloyongyang deleted the hy branch December 28, 2025 16:05
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