Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions genai-perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ export file is `profile_export.json`, the genai-perf file will be exported to

### Session Options

##### `--block-size`

The number of tokens allocated per hash block.

##### `--num-sessions`

The number of sessions to simulate. This is used when generating synthetic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"batch_size_audio",
"batch_size_image",
"batch_size_text",
"block_size",
"concurrency",
"endpoint_type",
"extra_inputs",
Expand Down
1 change: 1 addition & 0 deletions genai-perf/genai_perf/inputs/input_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def to_lowercase(self):
###########################
# Default Session Parameters
###########################
DEFAULT_BLOCK_SIZE = 512
DEFAULT_NUM_SESSIONS = 0
DEFAULT_SESSION_CONCURRENCY = 1
DEFAULT_SESSION_TURN_DELAY_MEAN_MS = 0
Expand Down
3 changes: 3 additions & 0 deletions genai-perf/genai_perf/inputs/inputs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class InputsConfig:
# Synthetic Prompt Generation Parameters
########################################

# The number of tokens allocated per hash block.
block_size: int = ic.DEFAULT_BLOCK_SIZE

# The number of dataset entries to generate and use as the payload pool
num_dataset_entries: int = ic.DEFAULT_NUM_DATASET_ENTRIES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def _get_prompt(self, data: Dict[str, Any]) -> str:
prompt_tokens_mean,
prompt_tokens_stddev,
hash_ids,
self.config.block_size,
)
prompt = prompt if prompt else prompt_alt
return str(prompt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def create_synthetic_prompt(
tokenizer: Tokenizer instance.
prompt_tokens_mean: Mean number of tokens in the prompt.
prompt_tokens_stddev: Standard deviation for the number of tokens in the prompt.
hash_ids: List of hash indices used for token reuse.
block_size: Number of tokens allocated per hash block (default 512).

Returns:
A synthetic prompt as a string.
Expand Down
8 changes: 8 additions & 0 deletions genai-perf/genai_perf/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,14 @@ def _add_session_args(parser):
required=False
)

session_group.add_argument(
"--block-size",
type=int,
default=ic.DEFAULT_BLOCK_SIZE,
required=False,
help="The number of tokens allocated per hash block.",
)

session_group.add_argument(
"--num-sessions",
type=int,
Expand Down
1 change: 1 addition & 0 deletions genai-perf/genai_perf/subcommand/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def create_config_options(args: Namespace) -> InputsConfig:
session_turn_delay_mean=args.session_turn_delay_mean,
session_turn_delay_stddev=args.session_turn_delay_stddev,
extra_inputs=extra_input_dict,
block_size=args.block_size,
)


Expand Down
1 change: 1 addition & 0 deletions genai-perf/tests/test_exporters/test_json_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def test_generate_json_input_config(
"subcommand": "profile",
"prompt_source": "synthetic",
"extra_inputs": {},
"block_size": 512,
}

_, data = next(iter(mock_read_write))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self):
self.payload_input_filename = Path("test_input.jsonl")
self.prompt_tokens_mean = 10
self.prompt_tokens_stddev = 2
self.block_size = 10

return MockConfig()

Expand Down
Loading