Download scripts/nvfp4/query_submissions.py from GPUMODE/kernelbot-data: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/datasets/GPUMODE/kernelbot-data/resolve/0d4e46fa01b1025376fa84c300dfb18a7715189e/scripts/nvfp4/query_submissions.py
- Command line
-
hf download hf://datasets/GPUMODE/kernelbot-data@0d4e46fa01b1025376fa84c300dfb18a7715189e/scripts/nvfp4/query_submissions.py
-
curl -L -o query_submissions.py https://huggingface.co/datasets/GPUMODE/kernelbot-data/resolve/0d4e46fa01b1025376fa84c300dfb18a7715189e/scripts/nvfp4/query_submissions.py
2.37 kB
| #!/usr/bin/env python3 | |
| """ | |
| Query submissions by user/problem or by submission ID. | |
| Usage: | |
| python query_submissions.py # Show all submission IDs for gau.nernst on gemv | |
| python query_submissions.py --id 187476 # Show code for specific submission ID | |
| python query_submissions.py --user gau.nernst --problem nvfp4_gemm | |
| """ | |
| import argparse | |
| import pandas as pd | |
| from pathlib import Path | |
| df = pd.read_parquet(Path(__file__).parent.parent.parent / 'nvidia_nvfp4_submissions.parquet') | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--id', type=int, help='Submission ID to query') | |
| parser.add_argument('--user', default='gau.nernst', help='Username to filter') | |
| parser.add_argument('--problem', default='nvfp4_gemv', help='Problem name to filter') | |
| args = parser.parse_args() | |
| if args.id: | |
| # Query specific submission | |
| sub = df[df['submission_id'] == args.id] | |
| if sub.empty: | |
| print(f"Submission {args.id} not found") | |
| else: | |
| row = sub.iloc[0] | |
| score_us = row['score'] * 1_000_000 if pd.notna(row['score']) else 'N/A' | |
| print(f"ID: {row['submission_id']}") | |
| print(f"User: {row['user_name']}") | |
| print(f"Problem: {row['problem_name']}") | |
| print(f"Score: {score_us:.2f} µs" if isinstance(score_us, float) else f"Score: {score_us}") | |
| print(f"\n=== CODE ===\n") | |
| print(row['code']) | |
| else: | |
| # List all submission IDs for user/problem | |
| subs = df[(df['user_name'] == args.user) & (df['problem_name'] == args.problem)] | |
| subs = subs.sort_values('score') | |
| ids = subs['submission_id'].tolist() | |
| scores = [(row['submission_id'], row['score'] * 1_000_000 if pd.notna(row['score']) else None) | |
| for _, row in subs.iterrows()] | |
| print(f"User: {args.user} | Problem: {args.problem} | Count: {len(ids)}") | |
| print(f"\nSubmission IDs (sorted by score, fastest first):") | |
| print(ids) | |
| # Get fastest/slowest with valid scores | |
| valid_scores = [(sid, sc) for sid, sc in scores if sc is not None] | |
| if valid_scores: | |
| print(f"\nFastest: {valid_scores[0][0]} ({valid_scores[0][1]:.2f} µs)") | |
| print(f"Slowest: {valid_scores[-1][0]} ({valid_scores[-1][1]:.2f} µs)") | |
| print(f"\nQuery a specific submission: python query_submissions.py --id {valid_scores[0][0]}") | |
| else: | |
| print("\nNo submissions with scores found") | |