From 54d4dc25e48a5ebd9215b577ae78c4d7eeb202de Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Wed, 24 Sep 2025 14:13:43 +0800 Subject: [PATCH 1/3] fix(statistic): remove batch guessing and averaging in tp measuring - To directly show the throughput for the given input, rather than trying to guess the batch dimension and report the value for a single sample, we drop the practice of using the first dimension as the batch for averaging. --- torchmeter/statistic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchmeter/statistic.py b/torchmeter/statistic.py index 4802e9c..c446e54 100644 --- a/torchmeter/statistic.py +++ b/torchmeter/statistic.py @@ -868,7 +868,7 @@ def __hook_func( cuda_sync() # WAIT FOR GPU SYNC it = start_event.elapsed_time(end_event) * 1e-3 # ms -> s # type: ignore - tp = ipt[0].shape[0] / it # TODO: batch infer + tp = 1 / it self.__InferTime.append(it) self.__Throughput.append(tp) From 1f981af317201396d0be6ab3693b94b9921ed037 Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Wed, 24 Sep 2025 14:38:01 +0800 Subject: [PATCH 2/3] fix(ci): add shell specification for PR checkout steps - Specify bash shell for PR checkout commands to avoid using PowerShell in Windows. --- .github/workflows/minimal_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/minimal_test.yml b/.github/workflows/minimal_test.yml index f732001..e1c48bd 100644 --- a/.github/workflows/minimal_test.yml +++ b/.github/workflows/minimal_test.yml @@ -106,6 +106,7 @@ jobs: uses: actions/checkout@v4 - name: Checkout PR + shell: bash run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then gh pr checkout ${{ github.event.inputs.pr_number }} @@ -195,6 +196,7 @@ jobs: uses: actions/checkout@v4 - name: Checkout PR + shell: bash run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then gh pr checkout ${{ github.event.inputs.pr_number }} From b79c364ba3ccba69679def866c5da8ed5066b7a4 Mon Sep 17 00:00:00 2001 From: Ahzyuan Date: Wed, 24 Sep 2025 14:56:46 +0800 Subject: [PATCH 3/3] refactor: delete trailing spaces in tp calculating line --- torchmeter/statistic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchmeter/statistic.py b/torchmeter/statistic.py index c446e54..a0e3c6f 100644 --- a/torchmeter/statistic.py +++ b/torchmeter/statistic.py @@ -868,7 +868,7 @@ def __hook_func( cuda_sync() # WAIT FOR GPU SYNC it = start_event.elapsed_time(end_event) * 1e-3 # ms -> s # type: ignore - tp = 1 / it + tp = 1 / it self.__InferTime.append(it) self.__Throughput.append(tp)