-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[None][test] Add accuracy evaluation for AutoDeploy #6764
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
Merged
suyoggupta
merged 7 commits into
NVIDIA:main
from
nv-auto-deploy:user/arasane/autodeploy_accuracy_eval
Aug 15, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1dffec7
Add accuracy evaluation for AutoDeploy
ajrasane 6ce6b3f
Update llm args and sampling params
ajrasane 21787a1
fix test
suyoggupta a3d46b2
Remove unused import
ajrasane edc8635
Remove nvfp4 streaming test
ajrasane a226efb
Remove nvfp4 test
ajrasane 99567b5
Merge branch 'main' into user/arasane/autodeploy_accuracy_eval
suyoggupta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
66 changes: 66 additions & 0 deletions
66
tests/integration/defs/accuracy/test_llm_api_autodeploy.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import pytest | ||
|
||
from tensorrt_llm._torch.auto_deploy import LLM as AutoDeployLLM | ||
from tensorrt_llm.sampling_params import SamplingParams | ||
|
||
from ..conftest import llm_models_root | ||
from .accuracy_core import MMLU, CnnDailymail, LlmapiAccuracyTestHarness | ||
|
||
|
||
class TestLlama3_1_8B(LlmapiAccuracyTestHarness): | ||
MODEL_NAME = "meta-llama/Llama-3.1-8B" | ||
MODEL_PATH = f"{llm_models_root()}/llama-3.1-model/Meta-Llama-3.1-8B" | ||
|
||
def get_default_kwargs(self): | ||
return { | ||
'skip_tokenizer_init': False, | ||
'trust_remote_code': True, | ||
'kv_cache_config': { | ||
'enable_block_reuse': False, | ||
}, | ||
'max_batch_size': 512, | ||
# 131072 is the max seq len for the model | ||
'max_seq_len': 8192, | ||
# max num tokens is derived in the build_config, which is not used by AutoDeploy llmargs. | ||
# Set it explicitly here to 8192 which is the default in build_config. | ||
'max_num_tokens': 8192, | ||
'skip_loading_weights': False, | ||
'compile_backend': 'torch-opt', | ||
'free_mem_ratio': 0.7, | ||
'cuda_graph_batch_sizes': [1, 2, 4, 8, 16, 32, 64, 128, 256] | ||
} | ||
|
||
def get_default_sampling_params(self): | ||
eos_id = -1 | ||
beam_width = 1 | ||
return SamplingParams(end_id=eos_id, | ||
pad_id=eos_id, | ||
n=beam_width, | ||
use_beam_search=beam_width > 1) | ||
|
||
@pytest.mark.skip_less_device_memory(32000) | ||
def test_auto_dtype(self): | ||
kwargs = self.get_default_kwargs() | ||
sampling_params = self.get_default_sampling_params() | ||
with AutoDeployLLM(model=self.MODEL_PATH, | ||
tokenizer=self.MODEL_PATH, | ||
**kwargs) as llm: | ||
task = CnnDailymail(self.MODEL_NAME) | ||
task.evaluate(llm) | ||
task = MMLU(self.MODEL_NAME) | ||
task.evaluate(llm, sampling_params=sampling_params) |
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.
Uh oh!
There was an error while loading. Please reload this page.