Skip to content

Conversation

huydhn
Copy link
Contributor

@huydhn huydhn commented Jun 6, 2025

This is the script I'm using to upload vLLM benchmark results. It can be retrofit to upload other benchmark results too, for example torch.compile benchmark results on GB200. I will write a wiki on how to use this script, but the simple usage is:

UPLOADER_USERNAME=<REACT>
UPLOADER_PASSWORD=<REACT>
GPU_DEVICE=$(nvidia-smi -i 0 --query-gpu=name --format=csv,noheader | awk '{print $2}')

python upload_benchmark_results.py \
  --repo pytorch \
  --benchmark-name TorchInductor \
  --benchmark-results test-reports \
  --device "${GPU_DEVICE}" \
  --dry-run

This also handles JSONEachRow format correctly in read_benchmark_results function as this is the format used by ClickHouse and DynamoBench

cc @zhe-thoughts @ZainRizvi

Signed-off-by: Huy Do <huydhn@gmail.com>
Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:45 — with GitHub Actions Inactive
@huydhn huydhn requested a review from ZainRizvi June 6, 2025 02:47
@huydhn huydhn marked this pull request as ready for review June 6, 2025 02:47
Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:56 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:56 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:56 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:56 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 6, 2025 02:56 — with GitHub Actions Inactive
huydhn added a commit to pytorch/test-infra that referenced this pull request Jun 6, 2025
Courtesy of Claude code. This is the initial version of an API that I'm
building to allow people to upload benchmark results. This works in
conjunction with
pytorch/pytorch-integration-testing#36

I will need to prepare a Terraform change for the lambda, but the API
works as follows:

```
import requests

with open("FILE_TO_BE_UPLOADED.json") as f:
    content = f.read()

json_data = {
    "username": "REDACT",
    "password": "REDACT",
    "content": content,
    "path": "v3/foobar/debug.json",
}

headers = {
    "content-type": "application/json"
}

url = "https://qrr6jzjpvyyd77fkj6mqkes4mq0tpirr.lambda-url.us-east-1.on.aws"
requests.post(url, json=json_data, headers=headers)
```

cc @zhe-thoughts @ZainRizvi

---------

Signed-off-by: Huy Do <huydhn@gmail.com>
Comment on lines 311 to 314
if s3_bucket:
upload_s3(s3_bucket, s3_path, data)
elif upload_url:
upload_via_api(upload_url, s3_path, data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you're expecting the user to always specify a unique s3 bucket to upload the metrics to.

  • Is there a right/wrong format or path for them to be using, or will arbitrary paths work just fine as long as they're unique? Do we need path validation here?
  • Can we generate this bucket path for the user? Ideally in the lambda so that there's no risk of a bad path being passed in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the S3 path is generated automatically here f"v3/{repo_name}/{head_branch}/{head_sha}/{device}/benchmark_results{model_suffix}.json", the lambda has a check to not overwrite existing file https://github.com/pytorch/test-infra/blob/main/aws/lambda/benchmark-results-uploader/lambda_function.py#L29. I will remove the option to set the bucket name because I want to write only to the benchmark bucket.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about sending the lambda the inputs used to generate the S3 path instead? Feels like a much more reliable approach over trusting input from a client to be in a specific format (especially if the backend takes a dependency on that format)

Comment on lines 117 to 121
uploader.add_argument(
"--upload-url",
type=str,
action=ValidateURL,
help="the URL to upload the benchmark results to",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this expected to be the full s3 url, or just the s3 item key (the lambda seems to have the bucket name fixed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me rework this part. The URL here will be fixed after https://github.com/pytorch-labs/pytorch-gha-infra/pull/705 is deployed. For example, https://qrr6jzjpvyyd77fkj6mqkes4mq0tpirr.lambda-url.us-east-1.on.aws. I only want people to upload to the benchmark bucket

Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 9, 2025 18:11 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 9, 2025 18:11 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 9, 2025 18:11 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 9, 2025 18:11 — with GitHub Actions Inactive
@huydhn huydhn requested a review from ZainRizvi June 9, 2025 18:13
@huydhn
Copy link
Contributor Author

huydhn commented Jun 9, 2025

The failure on llama4 Maverick is expected. That model isn't working yet.

Copy link
Contributor

@ZainRizvi ZainRizvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving since as per offline convo the actual paths used don't really matter so long as there are no path collisions

@zhe-thoughts
Copy link

Looking forward!

Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 10, 2025 01:07 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 10, 2025 01:07 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 10, 2025 01:07 — with GitHub Actions Inactive
@huydhn huydhn temporarily deployed to pytorch-x-vllm June 10, 2025 01:07 — with GitHub Actions Inactive
@huydhn huydhn merged commit 3478bce into main Jun 10, 2025
6 of 7 checks passed
@huydhn
Copy link
Contributor Author

huydhn commented Jun 10, 2025

cc @yangw-dev Once this is merged, we will need to finally migrate https://hud.pytorch.org/benchmark/compilers dashboard to the new benchmark table because this script will only upload the results there. Till date, the two tables are in sync, but this is not the case anymore.

@huydhn
Copy link
Contributor Author

huydhn commented Jun 10, 2025

Looking forward!

@zhe-thoughts This is finally landed, I'm writing the wiki on how to use this script locally and will send it your way in the next few hours so that we can try it out tomorrow.

@huydhn huydhn mentioned this pull request Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants