Conversation
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
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 addresses a bug in the TPOT calculation logic where the system was not correctly processing string-type responses. By explicitly converting string outputs into a list format, the change ensures that the TPOT metric is consistently and accurately computed, preventing errors and improving the robustness of the inference endpoint's metric reporting. 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.
Pull request overview
This PR fixes a bug in the derive_TPOT method where a string-typed output_sequence (returned by output_sequence_from_data when the response data is a plain string rather than a dict with a list) would be silently skipped instead of being properly handled. The fix wraps the string in a single-element list and adds a warning log for unexpected types.
Changes:
- Wraps string
output_sequenceinto a single-element list so it can be processed by the downstream TPOT logic (or gracefully skipped if < 2 chunks) - Adds a warning log message when
output_sequenceis an unexpected type (not list or string)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if isinstance(output_sequence, str): | ||
| output_sequence = [output_sequence] |
There was a problem hiding this comment.
The same string-wrapping logic should be applied to reasoning_sequence. When output_sequence_from_data is called with join_chunks=False and the data dict contains a string "reasoning" value, reasoning_sequence will also be a string. The isinstance(reasoning_sequence, list) check on line 1085 will silently drop it, causing reasoning tokens to be excluded from the TPOT calculation. Add a similar isinstance(reasoning_sequence, str) check to wrap it in a list, consistent with the fix for output_sequence.
| if isinstance(output_sequence, str): | ||
| output_sequence = [output_sequence] |
There was a problem hiding this comment.
This bug fix lacks a unit test covering the string response case. The existing test_derive_tpot (line 57 in tests/unit/metrics/test_reporter.py) only uses list-based outputs from fake_outputs. A test should be added that stores a plain string (e.g., orjson.dumps("Hello, world")) as the COMPLETE event data to verify that derive_TPOT handles it gracefully without crashing. Since the string case has only one chunk and will be skipped at the len(all_chunks) < 2 check, the test should verify that derive_TPOT returns None (or skips that sample) rather than raising an error.
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where string-based responses were not correctly handled during TPOT calculation. The change wraps string responses in a list, which is the correct approach. I have provided a suggestion to refactor the conditional logic for a minor improvement in efficiency and readability.
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes TPOT calculation when the response type is a string.
Type of change
Related issues
Testing
Checklist