[TPU] Add example for profiling TPU inference #12531
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provides an example for simple prefill or decode profiling on TPUs. This is a starting point equivalent to text-only inference using
benchmark_latency.py
, where all the user can specify is batch size, input length, and output length.Future work should expand this example to cover realistic data and multimodal inference.
Example screenshot of a profile in tensorboard (
![Screenshot 2025-01-28 at 5 26 47 PM](https://private-user-images.githubusercontent.com/3195154/407525073-c49a3919-7926-4f68-87fd-2e922826e8e3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMzk0NjIsIm5iZiI6MTczOTAzOTE2MiwicGF0aCI6Ii8zMTk1MTU0LzQwNzUyNTA3My1jNDlhMzkxOS03OTI2LTRmNjgtODdmZC0yZTkyMjgyNmU4ZTMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMTgyNjAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjllODRkZGM4NjZkMzVjODBmMDBiMWI5MTg2YjUyYmIyZmVkNjRjNTZkZmQ3YWQ2YjZlMGU4YWY4ZWY3NjczMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Il75N9l6lErItf6KcYUaNwZzOdqULj9o3Lcg9PaTRFU)
tensorboard --logdir profiles/ --port 6006
):