[来源关键摘录] AI Energy Score 官方开源基准代码与 Docker 容器化能效测试工具。
[正文前段节选] Skip to content
Navigation Menu
Appearance settings
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Repository navigation
AIEnergyScore
NotificationsYou must be signed in to change notification settings
Star44 (44)You must be signed in to star a repository
AI Energy Score: Initiative to establish comparable energy efficiency ratings for AI models.
huggingface.github.io/AIEnergyScore/
aiclimateefficiencyenergysustainability
Custom properties
Report repository
BranchesTags
Open more actions menu
Latest commit
Folders and files
Last commit message
Last commit date
AIEnergyScore_Icon.png
Example1.jpg
Example2.jpg
Label Specs.png
_config.yaml
batch_runner.py
check_h100.py
debug_logger.py
entrypoint.sh
model_config_parser.py
oct_2025_models.csv
parameter_handler.py
pytorch_validation.yaml
reasoning_helpers.py
requirements-dev.txt
requirements.txt
results_aggregator.py
run_ai_energy_benchmark.py
run_docker.sh
run_non_docker.sh
summarize_gpu_wh.py
text_generation.yaml
View all files
Repository files navigation
Welcome to AI Energy Score! This is an initiative to establish comparable energy efficiency ratings for AI models, helping the industry make informed decisions about sustainability in AI development.
Documentation
Label Generator
Get started benchmarking AI models in 5 steps:
1. Install Development Tools
cd AIEnergyScore
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install development dependencies (for running scripts on host)
pip install -r requirements-dev.txt
2. Authenticate with HuggingFace (Optional - for gated models)
If you plan to test gated models (like Gemma or Llama):
# One-time login
hf auth login
3. Build the Docker Image
4. Run Your First Benchmark
# Quick test with default settings (10 samples)
./run_docker.sh --config-name text_generation backend.model=openai/gpt-oss-20b
# Or customize the number of samples
./run_docker.sh -n 100 --config-name text_generation backend.model=openai/gpt-oss-120b
5. View Results
Results are saved in ./results/ with energy data in:
GPU_ENERGY_WH.txt - Total energy consumption
GPU_ENERGY_SUMMARY.json - Detailed metrics
Quick Start: Batch Testing
Test multiple models automatically from a CSV configuration:
# Install development dependencies (if not already done)
# Test a single model first (recommended)
python batch_runner.py \
--model-name "gpt-oss-20b" \
--reasoning-state "High" \
--num-prompts 3 \
--output-dir ./test_run
# Run all gpt-oss Class A models (smaller models)
--model-name gpt-oss \
--num-prompts 10 \
--output-dir ./gpt_oss_results
Results are aggregated in batch_results/master_results.csv with detailed logs in batch_results/logs/. See Batch Testing Multiple Models for full documentation.
Compare different models
Run batch tests
Submit to the leaderboard
🔐 Gated Model Support
AIEnergyScore supports automatic authentication for gated models on HuggingFace! Simply run hf auth login once (Step 2 above), and you'll have seamless access to models like Gemma, Llama, and other restricted models. See Authentication for Gated Models for details.
Evaluating a Proprietary Model
The Dockerfile provided in this repository is made to be used on the NVIDIA H100-80GB GPU.
If you would like to run benchmarks on other types of hardware, we invite you to take a look at these configuration examples that can be run directly with AI Energy Benchmark. However, evaluations completed on other hardware would not be currently compatable and comparable with the rest of the AI Energy Score data.
Building the Docker Image
The Docker image includes both optimum-benchmark and ai_energy_benchmarks. Use the provided build script:
Quick Start with Helper Script
For convenience, use the provided helper script that handles all volume mounts automatically:
The helper script automatically:
Runs container as current user
Mounts HuggingFace cache from ~/.cache/huggingface
Automatically detects and mounts HuggingFace authentication tokens (for gated models)
Creates and mounts results directory
Configures proper environment variables
Defaults to 10 prompts (customize with -n or --num-samples)
Note for Gated Models: If you need to access gated models (like google/gemma-3-4b-pt or Meta Llama models), run huggingface-cli login first. See Authentication for Gated Models for details.
# Use default settings (10 samples)
# Test with 100 samples
# Full test with 1000 samples
./run_docker.sh --num-samples 1000 --config-name text_generation backend.model=openai/gpt-oss-20b
# Use Optimum backend with HuggingFace optimum-benchmark
BENCHMARK_BACKEND=optimum ./run_docker.sh --config-name text_generation backend.model=openai/gpt-oss-20b
Authentication for Gated Models
Some models on HuggingFace (e.g., google/gemma-3-1b-pt, Meta Llama models) require authentication to access. The run_docker.sh script automatically handles authentication using two methods:
Method 1: HuggingFace CLI Login (Recommended)
The easiest way to authenticate is using the HuggingFace CLI:
# One-time setup: login to HuggingFace
huggingface-cli login #legacy
# Then use normally - token is automatically mounted
./run_docker.sh --config-name text_generation backend.model=google/gemma-3-1b-pt
This creates a token file at ~/.huggingface/token which is automatically detected and mounted by run_docker.sh.
Method 2: HF_TOKEN Environment Variable
Alternatively, you can pass your token explicitly:
# Get your token from https://huggingface.co/settings/tokens
export HF_TOKEN=hf_your_token_here
# Run with token from environment
HF_TOKEN=hf_xxx ./run_docker.sh --config-name text_generation backend.model=google/gemma-3-1b-pt
The run_docker.sh script will display a warning if no authentication is found when you run it.
Non-Docker Usage
For environments without Docker support or when you prefer direct execution, use the run_non_docker.sh script:
Setup (first time only):
# 1. Create and activate virtual environment
# 2. Install requirements
pip install -r requirements.txt
# 3. Authenticate with HuggingFace (for gated models)
huggingface-cli login
# 4. Verify GPU access
python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}, GPUs: {torch.cuda.device_count()}')"
Direct Mode - Run a single benchmark:
Direct mode runs a single model using Hydra configuration syntax (key=value).
# Always activate virtual environment first
# Basic usage with default settings (10 prompts, pytorch backend)
./run_non_docker.sh backend.model=openai/gpt-oss-20b
# Customize number of prompts
./run_non_docker.sh -n 100 backend.model=openai/gpt-oss-120b
# Override other Hydra config parameters
./run_non_docker.sh backend.model=openai/gpt-oss-20b scenario.dataset_name=custom.csv
# Using vLLM backend (requires running vLLM server)
./run_non_docker.sh -b vllm -e http://localhost:8021/v1 backend.model=openai/gpt-oss-20b
Note: Direct mode accepts Hydra-style arguments (e.g., backend.model=...) and runs a single model.
Batch Mode - Test multiple models from CSV:
Batch mode runs multiple models from a CSV file using filter flags. Important: Hydra arguments like backend.model= don't work in batch mode - use --model-name instead.
# Activate virtual environment
# Run specific model (use --model-name, NOT backend.model=)
./run_non_docker.sh --batch --model-name "openai/gpt-oss-20b" -n 10
# Run all Class A models
./run_non_docker.sh --batch --class A --output-dir ./class_a_results
# Filter by model name pattern (substring match)
./run_non_docker.sh --batch --model-name "Llama" -n 50
# Filter by reasoning state
./run_non_docker.sh --batch --reasoning-state "On (High)" --output-dir ./reasoning_tests
[...内容已截断,完整版请查看原文或 Wayback 快照]