Skip to content
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

Replace Argparse with ConfigCommand #266

Merged
merged 36 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fd6fbc6
Ported over logic infer logic from parser
nv-braf Jan 29, 2025
f1c9fd0
Added unit testing for inferred input/endpoint logic
nv-braf Jan 29, 2025
8b1e38a
Completed porting of all inferred and checked fields from parser
nv-braf Jan 29, 2025
21e0fca
Adding missing goodput parsing
nv-braf Jan 29, 2025
6edd605
Initial changes to get profile working
nv-braf Jan 30, 2025
8a7c0c6
CLI unit tests passing
nv-braf Jan 31, 2025
442a515
Fixing CLI tests that I missed
nv-braf Jan 31, 2025
cc1930e
Telemetry tests passing
nv-braf Jan 31, 2025
bbf4fc8
Test artifacts passing
nv-braf Jan 31, 2025
0cb56ca
Telemetry data collector tests passing
nv-braf Jan 31, 2025
505adf0
Passing common unit tests
nv-braf Jan 31, 2025
b7493af
Fixing console exporter unit tests
nv-braf Jan 31, 2025
7fc8903
Fixing CSV exporter unit tests
nv-braf Jan 31, 2025
ebe6688
Partial for for JSON exporter unit tests
nv-braf Jan 31, 2025
8684791
Adding library function to convert BaseConfig into a JSON readable di…
nv-braf Jan 31, 2025
6fd0e30
JSON Exporter unit tests passing
nv-braf Feb 1, 2025
4fc8338
Fixing Tokenizer unit tests
nv-braf Feb 1, 2025
32a2f6c
PA Config unit tests passing
nv-braf Feb 1, 2025
2e5d996
Fixing Results and RunConfig unit tests
nv-braf Feb 1, 2025
1ea7221
All unit tests passing
nv-braf Feb 1, 2025
0f5cc07
Fixing codeql issues
nv-braf Feb 3, 2025
f1bf717
Moving generation of artifact directory into PA Config generator class
nv-braf Feb 3, 2025
5774787
Fixing exporters to use PA config
nv-braf Feb 3, 2025
e7b702f
Progress on analyze. Need to add checkpoint support to base config cl…
nv-braf Feb 3, 2025
de70186
Fixed GAP config generator. All unit tests passing
nv-braf Feb 3, 2025
3750fa2
Getting analyze working with CLI
nv-braf Feb 4, 2025
a55ee3b
Analyze working with config file
nv-braf Feb 4, 2025
82ef958
fixing codeql
nv-braf Feb 4, 2025
e2d9c36
Fixed PA config to work with multiple sweep parameters
nv-braf Feb 4, 2025
2a2778e
Fixing message when config found in checkpoint
nv-braf Feb 4, 2025
aa01418
Refactoring path method
nv-braf Feb 5, 2025
59edd20
Removing commented out lines
nv-braf Feb 5, 2025
b16676a
Fixing issue around specifing url/server metrics url
nv-braf Feb 5, 2025
5103616
Changes based on Elias' PR
nv-braf Feb 11, 2025
9093f86
Fixing codeql issue
nv-braf Feb 12, 2025
a752b3e
Missing check for None
nv-braf Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 33 additions & 26 deletions genai-perf/genai_perf/config/generate/genai_perf_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,23 +33,48 @@ def __init__(
self,
config: ConfigCommand,
model_objective_parameters: ModelObjectiveParameters,
args: Namespace = Namespace(),
):
self._args = deepcopy(args)

self._set_parameters_based_on_objective(model_objective_parameters)
self._parameters = self._set_parameters_based_on_config(config)
self._parameters |= self._set_parameters_based_on_objective(
model_objective_parameters
)

###########################################################################
# Set Options Methods
###########################################################################
def _set_parameters_based_on_config(self, config: ConfigCommand) -> Parameters:
"""
Store values set in the config that should be checked when
determining if a previously checkpointed run can be used
"""
parameters: Parameters = {}

# ENDPOINT
parameters["endpoint"] = config.endpoint.to_json_dict()

# Remove any fields that have no bearing on the
# values of metrics being measured
del parameters["endpoint"]["server_metrics_urls"]
del parameters["endpoint"]["url"]

# INPUT
parameters["input"] = config.input.to_json_dict()

# TOKENIZER
parameters["tokenizer"] = config.tokenizer.to_json_dict()

return parameters

def _set_parameters_based_on_objective(
self, model_objective_parameters: ModelObjectiveParameters
) -> None:
self._parameters: Parameters = {}
) -> Parameters:
parameters: Parameters = {}
for objective in model_objective_parameters.values():
for name, parameter in objective.items():
if parameter.usage == SearchUsage.RUNTIME_GAP:
self._parameters[name] = parameter.get_value_based_on_category()
parameters[name] = parameter.get_value_based_on_category()

return parameters

###########################################################################
# Get Accessor Methods
Expand All @@ -60,21 +85,6 @@ def get_parameters(self) -> Parameters:
"""
return self._parameters

def get_obj_args(self) -> Namespace:
"""
Returns args that can be used by the existing CLI based methods in GAP
These will include any objectives that are set via parameters
"""
obj_args = deepcopy(self._args)
if "input_sequence_length" in self._parameters:
obj_args.synthetic_input_tokens_mean = self._parameters[
"input_sequence_length"
]
if "num_dataset_entries" in self._parameters:
obj_args.num_dataset_entries = self._parameters["num_dataset_entries"]

return obj_args

###########################################################################
# Representation Methods
###########################################################################
Expand All @@ -97,9 +107,6 @@ def create_checkpoint_object(self) -> CheckpointObject:
"""
genai_perf_config_dict = deepcopy(self.__dict__)

# Values set on the CLI and parameters are not kept (they can vary from run to run)
del genai_perf_config_dict["_args"]

return genai_perf_config_dict

@classmethod
Expand Down
Loading
Loading