feat(perf): add --same-request option for benchmark#1214
feat(perf): add --same-request option for benchmark#1214yonlunwu wants to merge 2 commits intomodelscope:mainfrom
Conversation
When enabled, all concurrent requests will send the same prompt (only for dataset mode). This is useful for simulating cache hit scenarios with different input lengths. By reusing a single prompt, you can easily measure the performance of cache hits without preparing multiple prompts of different lengths. It also helps with model warm-up testing.
Summary of ChangesHello, 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 new feature to the benchmarking tool, allowing users to specify that all concurrent requests should use the same prompt when operating in dataset mode. This enhancement is designed to facilitate more focused performance testing, particularly for simulating cache hit scenarios and aiding in model warm-up by providing a consistent input across multiple requests. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
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 --same-request option to use the same prompt for all requests in dataset mode, which is useful for cache testing. The implementation is mostly correct, but I've found a couple of issues. There's a minor typo in the command-line help text. More importantly, the logic to warn users when --same-request is used incorrectly is flawed and will not work as intended. I've provided suggestions to fix these issues.
| if args.same_request and not args.dataset: | ||
| logger.warning("--same-request only works in dataset mode, ignoring...") |
There was a problem hiding this comment.
The condition to warn when --same-request is used outside of dataset mode is incorrect. The args.dataset argument has a default string value ('openqa'), so not args.dataset will almost always evaluate to False, and the warning will never be triggered. The check should instead verify if args.prompt is being used, as --same-request is redundant in that mode.
| if args.same_request and not args.dataset: | |
| logger.warning("--same-request only works in dataset mode, ignoring...") | |
| if args.same_request and args.prompt: | |
| logger.warning("--same-request only works in dataset mode, ignoring...") |
| # Dataset settings | ||
| parser.add_argument('--dataset', type=str, default='openqa', help='Specify the dataset') | ||
| parser.add_argument('--dataset-path', type=str, required=False, help='Path to the dataset file') | ||
| parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations(only for dataset mode)') |
There was a problem hiding this comment.
There's a typo in the help message for the --same-request argument. The opening parenthesis is attached to the word iterations, which makes it harder to read. Adding a space would improve readability.
| parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations(only for dataset mode)') | |
| parser.add_argument('--same-request', action='store_true', default=False, help='Use the same prompt for all iterations (only for dataset mode)') |
|
This feature's necessity can be further discussed. Currently, you can use |
When enabled, all concurrent requests will send the same prompt (only for dataset mode).
This is useful for simulating cache hit scenarios with different input lengths. By reusing a single prompt, you can easily measure the performance of cache hits without preparing multiple prompts of different lengths. It also helps with model warm-up testing.