Fix: Add torch.no_grad() decorator to MMLU evaluate metric#4073
Closed
fa-ina-tic wants to merge 1 commit into
Closed
Fix: Add torch.no_grad() decorator to MMLU evaluate metric#4073fa-ina-tic wants to merge 1 commit into
fa-ina-tic wants to merge 1 commit into
Conversation
Signed-off-by: fa-ina-tic <sooh0601@gmail.com>
Contributor
|
Thanks @fa-ina-tic for opening the PR. I have merged a fix, and it should resolve the issue. Feel free to test it out, and you can close this PR whenever you're ready. |
Author
|
Thanks for your work, @quic-hitameht, it works perfect:) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi team!
I noticed a memory issue during MMLU evaluation and wanted to share a quick fix.
Problem
Running
python -m Examples.torch.evaluate --eval-mmluin the quantization recipe causes continuous VRAM growth during evaluation, causing CUDA Out Of Memory error.Root Cause
The
GenericMMLU.evaluate()method was missing gradient computation disabling, unlike--eval-pplwhich properly uses no_grad context.Changes
Added
@torch.no_grad()decorator toGenericMMLU.evaluate().Note
Other evaluation metrics (
Interactive,TrickyPrompts,Prompts) may have the same issue, but this has not been checked. Additional fixes may be required in a follow-up PR if confirmed.Additional Info(for reproduce)
Machine
Python setup
command
full error log