[Misc] refactor neuron_multimodal and profiling (#19397)

Signed-off-by: reidliu41 <reid201711@gmail.com>
Co-authored-by: reidliu41 <reid201711@gmail.com>
This commit is contained in:
Reid 2025-06-10 14:12:42 +08:00 committed by GitHub
parent a3f66e75d1
commit 6b1391ca7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -64,7 +64,7 @@ def print_outputs(outputs):
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}") print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
if __name__ == "__main__": def main():
assert ( assert (
len(PROMPTS) == len(IMAGES) == len(SAMPLING_PARAMS) len(PROMPTS) == len(IMAGES) == len(SAMPLING_PARAMS)
), f"""Text, image prompts and sampling parameters should have the ), f"""Text, image prompts and sampling parameters should have the
@ -104,3 +104,7 @@ if __name__ == "__main__":
# test batch-size = 4 # test batch-size = 4
outputs = llm.generate(batched_inputs, batched_sample_params) outputs = llm.generate(batched_inputs, batched_sample_params)
print_outputs(outputs) print_outputs(outputs)
if __name__ == "__main__":
main()

View File

@ -70,7 +70,7 @@ def main(args: argparse.Namespace):
return return
if __name__ == "__main__": def parse_args():
parser = FlexibleArgumentParser( parser = FlexibleArgumentParser(
description="Benchmark the latency of processing a single batch of " description="Benchmark the latency of processing a single batch of "
"requests till completion." "requests till completion."
@ -102,5 +102,9 @@ if __name__ == "__main__":
) )
parser = EngineArgs.add_cli_args(parser) parser = EngineArgs.add_cli_args(parser)
args = parser.parse_args() return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
main(args) main(args)