Skip to content

Commit

Permalink
Adding streaming to genai_perf_config
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-braf committed Apr 3, 2024
1 parent c952c1f commit bf7246c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion model_analyzer/perf_analyzer/genai_perf_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ class GenaiPerfConfig:
"input-type",
"num-of-output-prompts",
"random-seed",
"streaming",
"tokenizer",
]

boolean_args = ["streaming"]

def __init__(self):
"""
Construct a GenaiPerfConfig
Expand Down Expand Up @@ -120,10 +123,24 @@ def _parse_options(self):
"""
temp_args = []
for key, value in self._args.items():
if value:
if key in self.boolean_args:
temp_args = self._parse_boolean_args(key, value, temp_args)
elif value:
temp_args.append(f"--{key}={value}")
return temp_args

def _parse_boolean_args(self, key, value, temp_args):
"""
Parse genai perf args that should not add a value to the cli string
"""
assert type(value) in [
str,
type(None),
], f"Data type for arg {key} must be a (boolean) string instead of {type(value)}"
if value != None and value.lower() == "true":
temp_args.append(f"--{key}")
return temp_args

def __getitem__(self, key):
"""
Gets an arguments value in config
Expand Down

0 comments on commit bf7246c

Please sign in to comment.