Spaces:
Runtime error
Runtime error
metadata
title: Transformers.js Benchmark Leaderboard
emoji: π
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.49.1
app_file: leaderboard/src/leaderboard/app.py
pinned: false
Transformers.js Benchmark Leaderboard
A Gradio-based leaderboard that displays benchmark results from a HuggingFace Dataset repository.
Features
- π Interactive leaderboard: Display benchmark results in a searchable/filterable table
- π Advanced filtering: Filter by model name, task, platform, device, mode, and dtype
- β Recommended models: Curated list of WebGPU-compatible beginner-friendly models
- π Real-time updates: Refresh data on demand from HuggingFace Dataset
- π Performance metrics: View load time, inference time, and p50/p90 percentiles
- π Markdown export: Export recommended models for documentation
Architecture
.
βββ leaderboard/ # Gradio-based leaderboard app
β βββ src/
β β βββ leaderboard/
β β βββ app.py # Main Gradio application
β β βββ data_loader.py # HuggingFace Dataset loader
β β βββ formatters.py # Data formatting utilities
β βββ pyproject.toml # Python dependencies
β βββ README.md # Detailed leaderboard docs
βββ bench/ # Benchmark server (separate deployment)
β βββ src/
β β βββ core/ # Shared types and utilities
β β βββ node/ # Node.js benchmark runner
β β βββ web/ # Browser benchmark runner
β β βββ server/ # REST API server
β βββ package.json
βββ client/ # CLI client for benchmark server
βββ src/
βββ package.json
Development
Running locally
- Install dependencies:
cd leaderboard
uv sync
- Configure environment variables:
# Create .env file or export variables
export HF_DATASET_REPO="your-username/benchmark-results"
export HF_TOKEN="your-hf-token" # Optional, for private datasets
- Run the leaderboard:
uv run python -m leaderboard.app
The leaderboard will be available at: http://localhost:7861
Environment Variables
| Variable | Required | Description |
|---|---|---|
HF_DATASET_REPO |
Yes | HuggingFace dataset repository containing benchmark results |
HF_TOKEN |
No | HuggingFace API token (only needed for private datasets) |
Deployment
This leaderboard is designed to run on Hugging Face Spaces using the Gradio SDK.
Quick Deploy
Create a new Space on Hugging Face:
- Go to https://huggingface.co/new-space
- Choose Gradio as the SDK
- Set the Space name (e.g.,
transformersjs-benchmark-leaderboard)
Upload files to your Space:
# Clone your Space repository git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME cd YOUR_SPACE_NAME # Copy leaderboard files (adjust path as needed) cp -r /path/to/this/repo/leaderboard/* . # Commit and push git add . git commit -m "Deploy leaderboard" git pushConfigure Space secrets:
- Go to your Space settings β Variables and secrets
- Add
HF_DATASET_REPO: Your dataset repository (e.g.,username/benchmark-results) - Add
HF_TOKEN: Your HuggingFace API token (if using private datasets)
Space will automatically deploy and be available at:
https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
Dependencies
The Space automatically installs dependencies from pyproject.toml:
gradio>=5.49.1- Web UI frameworkpandas>=2.3.3- Data manipulationhuggingface-hub>=0.35.3- Dataset loadingpython-dotenv>=1.1.1- Environment variables
Data Format
The leaderboard reads JSONL files from the HuggingFace Dataset repository. Each line should be a JSON object with benchmark results:
{
"id": "benchmark-id",
"platform": "web",
"modelId": "Xenova/all-MiniLM-L6-v2",
"task": "feature-extraction",
"mode": "warm",
"device": "wasm",
"dtype": "fp32",
"status": "completed",
"result": {
"metrics": {
"load_ms": {"p50": 100, "p90": 120},
"first_infer_ms": {"p50": 10, "p90": 15},
"subsequent_infer_ms": {"p50": 8, "p90": 12}
}
}
}
Related Projects
- Benchmark Server (
bench/): REST API server for running benchmarks (separate Docker deployment) - CLI Client (
client/): Command-line tool for submitting benchmarks to the server
License
MIT