Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.2.0
π Leaderboard Generation Scripts
This directory contains scripts to automatically generate leaderboard JSON files from Excel data.
β‘ Quick Start
1. Install Dependencies
pip install -r scripts/requirements.txt
Required packages:
pandas>=2.0.0- For reading Excel files and data manipulationopenpyxl>=3.1.0- For reading .xlsx Excel files
2. Configure Excel Path
Open scripts/config.py and update the EXCEL_PATH variable:
EXCEL_PATH = BASE_DIR / "Clinical Benchmark and LLM.xlsx" # Place in project root
# OR
EXCEL_PATH = Path("/Users/yourname/Desktop/benchmark.xlsx") # Use absolute path
3. Run the Script
From the project root directory:
python scripts/main.py
Or with Python 3 explicitly:
python3 scripts/main.py
That's it! The script will automatically:
- β Read the Excel file
- β Generate all three leaderboards (Zero-Shot, Few-Shot, CoT)
- β Update task information
- β Calculate and update rankings
- β
Save everything to the
leaderboards/directory
βοΈ Configuration
All settings are in scripts/config.py:
Required Configuration
EXCEL_PATH - Path to your Excel file containing model and task data
# In project root (recommended)
EXCEL_PATH = BASE_DIR / "Clinical Benchmark and LLM.xlsx"
# Absolute path
EXCEL_PATH = Path("/Users/yourname/Desktop/Clinical Benchmark and LLM.xlsx")
# In a subdirectory
EXCEL_PATH = BASE_DIR / "data" / "benchmark.xlsx"
Optional Configuration
INVALID_MODELS - Models to exclude from leaderboards
INVALID_MODELS = [
"gemma-3-27b-pt",
"Hulu-Med-7B",
# Add model names that should not appear
]
Output paths (usually don't need to change):
ZERO_SHOT_OUTPUT- Zero-Shot leaderboard pathFEW_SHOT_OUTPUT- Few-Shot leaderboard pathCOT_OUTPUT- Chain-of-Thought leaderboard path
π Complete Update Workflow
Get your Excel file
- Download/obtain the latest "Clinical Benchmark and LLM.xlsx"
- Place it in the project root or note its location
Update configuration
# Edit scripts/config.py # Set EXCEL_PATH to your file location # Add any models to INVALID_MODELS if neededRun the generation script
python scripts/main.pyVerify the output
- Check
leaderboards/Zero-Shot_leaderboard.json - Check
leaderboards/Few-Shot_leaderboard.json - Check
leaderboards/CoT_leaderboard.json - Check
task_information.json
- Check
Test locally
python app.py # Open browser to test the leaderboard interfaceDeploy
- Commit and push to GitHub
- Deploy to Hugging Face Spaces
π Files Overview
config.py- Central configuration file β οΈ EDIT THIS FILEmain.py- Main script that orchestrates leaderboard generationrequirements.txt- Python dependencies for the scriptsREADME.md- This filehelpers/- Helper modules for processing Excel dataexcel_processor.py- Processes Excel files and creates leaderboardsreorganize_indices.py- Reorganizes model indices by sizeCONSTANTS.py- Constants for data mapping (task names, domain mappings, etc.)leaderboards.py- Placeholder for future leaderboard operations__init__.py- Makes helpers a Python package
π€ Sharing This Code
When sharing this code with others:
- They only need to update
scripts/config.pywith their Excel file path - All other files will automatically use the configured paths
- No need to search through multiple files to update paths
- The script validates the Excel file exists before running
π Troubleshooting
"Excel file not found" error
β ERROR: Excel file not found!
Solution:
- Check that
EXCEL_PATHinscripts/config.pypoints to a valid file - Verify the file exists at that location
- Use absolute paths if relative paths don't work
"Missing models" or unexpected output
Solution:
- Verify that model names in
INVALID_MODELSmatch exactly (case-sensitive) - Check that the Excel file has the required sheets:
- "Models (Simplified)" - contains model information
- "B-CLF", "B-EXT", "B-GEN" - for Zero-Shot
- "B-CLF-5shot", "B-EXT-5shot", "B-GEN-5shot" - for Few-Shot
- "B-CLF-CoT", "B-EXT-CoT", "B-GEN-CoT" - for CoT
- "Task-all" - for task information
Import errors
ModuleNotFoundError: No module named 'pandas'
Solution:
- Install the required packages:
pip install -r scripts/requirements.txt - Make sure you're using the correct Python environment
Running from wrong directory
ModuleNotFoundError: No module named 'helpers'
Solution:
- Always run from the project root:
python scripts/main.py - Not from inside the scripts directory: β
cd scripts && python main.py
π‘ Excel File Requirements
Your Excel file must contain:
Required Sheets:
Models (Simplified) - Model metadata
- Columns: Name, Domain, License, Size (B)
Task Sheets (for each leaderboard type):
- Zero-Shot: B-CLF, B-EXT, B-GEN
- Few-Shot: B-CLF-5shot, B-EXT-5shot, B-GEN-5shot
- CoT: B-CLF-CoT, B-EXT-CoT, B-GEN-CoT
Task-all - Task metadata
- Columns: Task name, Language, Task Type, Clinical context, Data Access, etc.
Model Name Handling:
The script automatically handles some model name variations:
gpt-35-turbo-0125βgpt-35-turbogpt-4o-0806βgpt-4ogemini-2.0-flash-001βgemini-2.0-flash- And more (see
excel_processor.pyfor full list)
π― What the Script Does
- Validates the Excel file exists
- Loads model information from "Models (Simplified)" sheet
- Processes each leaderboard type (Zero-Shot, Few-Shot, CoT):
- Extracts performance data from task sheets
- Calculates average performance
- Generates JSON with model info and scores
- Reorganizes model indices by size (smallest to largest)
- Updates rankings based on average performance
- Creates task_information.json with metadata
- Saves all output files to the
leaderboards/directory
π Notes
- The script preserves model order by size within each leaderboard
- Rankings (T column) are updated based on average performance
- Invalid models are excluded before processing
- All JSON files are formatted with 4-space indentation
- The script uses UTF-8 encoding to support non-ASCII characters