-
Notifications
You must be signed in to change notification settings - Fork 64
fix: add repetition_penalty #155
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
Conversation
Summary of ChangesHello @ChenZiHong-Gavin, 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 primarily enhances 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
|
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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.
Code Review
This pull request introduces repetition_penalty to the sampling parameters and refactors the _build_inputs method to use tokenizer chat templates. While adding the new parameter is a good enhancement, the refactoring of _build_inputs introduces a critical issue: it changes the expected type for the history parameter, which breaks the contract with the BaseLLMWrapper base class and will cause runtime errors. Additionally, the new implementation modifies the history list in-place, which is an undesirable side effect. I've also noted a minor issue with an unused import. My review includes suggestions to address these problems.
I am having trouble creating individual review comments. Click here to see my feedback.
graphgen/models/llm/local/vllm_wrapper.py (48-56)
This refactoring has several issues:
- Critical Bug (Contract Violation): The
historyparameter's type is nowOptional[List[dict]], which is incompatible with theOptional[List[str]]defined in theBaseLLMWrapperbase class methods. This violates the Liskov Substitution Principle and will cause runtime errors. The method signatures must be consistent across the class hierarchy. - Side Effect: The input
historylist is modified in-place. A copy should be used to avoid unexpected behavior for the caller. - Vague Type Hint: The return type should be
strinstead ofAnyfor better type safety.
def _build_inputs(self, prompt: str, history: Optional[List[dict]] = None) -> str:
messages = (history or []).copy()
messages.append({"role": "user", "content": prompt})
return self.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
graphgen/models/llm/local/vllm_wrapper.py (2)
The stop import from tracemalloc is not used in this file and should be removed to maintain code cleanliness.
|
/gemini summary |
Summary of ChangesThis pull request significantly improves the Highlights
Changelog
Activity
|
This PR made the following changes to
vllm_wrapper:self.tokenizer.apply_chat_templateto format promptvllm_wrapperconstructor has been increased from 300 to 600 seconds, allowing more time for generation requests to complete.