Skip to content

[Misc] refactor neuron_multimodal and profiling #19397

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
Merged
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
6 changes: 5 additions & 1 deletion examples/offline_inference/neuron_multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def print_outputs(outputs):
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")


if __name__ == "__main__":
def main():
assert (
len(PROMPTS) == len(IMAGES) == len(SAMPLING_PARAMS)
), f"""Text, image prompts and sampling parameters should have the
Expand Down Expand Up @@ -104,3 +104,7 @@ def print_outputs(outputs):
# test batch-size = 4
outputs = llm.generate(batched_inputs, batched_sample_params)
print_outputs(outputs)


if __name__ == "__main__":
main()
8 changes: 6 additions & 2 deletions examples/offline_inference/profiling_tpu/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def run_to_completion():
return


if __name__ == "__main__":
def parse_args():
parser = FlexibleArgumentParser(
description="Benchmark the latency of processing a single batch of "
"requests till completion."
Expand Down Expand Up @@ -102,5 +102,9 @@ def run_to_completion():
)

parser = EngineArgs.add_cli_args(parser)
args = parser.parse_args()
return parser.parse_args()


if __name__ == "__main__":
args = parse_args()
main(args)