Usage Examples
This document provides practical examples for both methods of adding evaluations to HuggingFace model cards.
Table of Contents
- Setup
- Method 1: Extract from README
- Method 2: Import from Artificial Analysis
- Standalone vs Integrated
- Common Workflows
Setup
Initial Configuration
# Navigate to skill directory
cd hf_evaluation_skill
# Install dependencies
uv add huggingface_hub python-dotenv pyyaml requests
# Configure environment variables
cp examples/.env.example .env
# Edit .env with your tokensYour .env file should contain:
HF_TOKEN=hf_your_write_token_here
AA_API_KEY=aa_your_api_key_here # Optional for AA importsVerify Installation
cd scripts
python3 test_extraction.pyMethod 1: Extract from README
Extract evaluation tables from your model's existing README.
Basic Extraction
# Preview what will be extracted (dry run)
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "meta-llama/Llama-3.3-70B-Instruct" \
--dry-runApply Extraction to Your Model
# Extract and update model card directly
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/your-model-7b"Custom Task and Dataset Names
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/your-model-7b" \
--task-type "text-generation" \
--dataset-name "Standard Benchmarks" \
--dataset-type "llm_benchmarks"Create Pull Request (for models you don't own)
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "organization/community-model" \
--create-prExample README Format
Your model README should contain tables like:
## Evaluation Results
| Benchmark | Score |
|---------------|-------|
| MMLU | 85.2 |
| HumanEval | 72.5 |
| GSM8K | 91.3 |
| HellaSwag | 88.9 |Method 2: Import from Artificial Analysis
Fetch benchmark scores directly from Artificial Analysis API.
Integrated Approach (Recommended)
# Import scores for Claude Sonnet 4.5
python3 scripts/evaluation_manager.py import-aa \
--creator-slug "anthropic" \
--model-name "claude-sonnet-4" \
--repo-id "your-username/claude-mirror"With Pull Request
# Create PR instead of direct commit
python3 scripts/evaluation_manager.py import-aa \
--creator-slug "openai" \
--model-name "gpt-4" \
--repo-id "your-username/gpt-4-mirror" \
--create-prStandalone Script
For simple, one-off imports, use the standalone script:
# Navigate to examples directory
cd examples
# Run standalone script
AA_API_KEY="your-key" HF_TOKEN="your-token" \
python3 artificial_analysis_to_hub.py \
--creator-slug "anthropic" \
--model-name "claude-sonnet-4" \
--repo-id "your-username/your-repo"Finding Creator Slug and Model Name
- Visit Artificial Analysis
- Navigate to the model you want to import
- The URL format is:
https://artificialanalysis.ai/models/\{creator-slug\}/\{model-name\} - Or check their API documentation
Common examples:
- Anthropic:
--creator-slug "anthropic" --model-name "claude-sonnet-4" - OpenAI:
--creator-slug "openai" --model-name "gpt-4-turbo" - Meta:
--creator-slug "meta" --model-name "llama-3-70b"
Standalone vs Integrated
Standalone Script Features
- ✓ Simple, single-purpose
- ✓ Can run via
uv runfrom URL - ✓ Minimal dependencies
- ✗ No README extraction
- ✗ No validation
- ✗ No dry-run mode
Use when: You only need AA imports and want a simple script.
Integrated Script Features
- ✓ Both README extraction AND AA import
- ✓ Validation and show commands
- ✓ Dry-run preview mode
- ✓ Better error handling
- ✓ Merge with existing evaluations
- ✓ More flexible options
Use when: You want full evaluation management capabilities.
Common Workflows
Workflow 1: New Model with README Tables
You've just created a model with evaluation tables in the README.
# Step 1: Preview extraction
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/new-model-7b" \
--dry-run
# Step 2: Apply if it looks good
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/new-model-7b"
# Step 3: Validate
python3 scripts/evaluation_manager.py validate \
--repo-id "your-username/new-model-7b"
# Step 4: View results
python3 scripts/evaluation_manager.py show \
--repo-id "your-username/new-model-7b"Workflow 2: Model Benchmarked on AA
Your model appears on Artificial Analysis with fresh benchmarks.
# Import scores and create PR for review
python3 scripts/evaluation_manager.py import-aa \
--creator-slug "your-org" \
--model-name "your-model" \
--repo-id "your-org/your-model-hf" \
--create-prWorkflow 3: Combine Both Methods
You have README tables AND AA scores.
# Step 1: Extract from README
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/hybrid-model"
# Step 2: Import from AA (will merge with existing)
python3 scripts/evaluation_manager.py import-aa \
--creator-slug "your-org" \
--model-name "hybrid-model" \
--repo-id "your-username/hybrid-model"
# Step 3: View combined results
python3 scripts/evaluation_manager.py show \
--repo-id "your-username/hybrid-model"Workflow 4: Contributing to Community Models
Help improve community models by adding missing evaluations.
# Find a model with evaluations in README but no model-index
# Example: community/awesome-7b
# Create PR with extracted evaluations
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "community/awesome-7b" \
--create-pr
# GitHub will notify the repository owner
# They can review and merge your PRWorkflow 5: Batch Processing
Update multiple models at once.
# Create a list of repos
cat > models.txt << EOF
your-org/model-1-7b
your-org/model-2-13b
your-org/model-3-70b
EOF
# Process each
while read repo_id; do
echo "Processing $repo_id..."
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "$repo_id"
done < models.txtWorkflow 6: Automated Updates (CI/CD)
Set up automatic evaluation updates using GitHub Actions.
# .github/workflows/update-evals.yml
name: Update Evaluations Weekly
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday
workflow_dispatch: # Manual trigger
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install dependencies
run: |
pip install huggingface-hub python-dotenv pyyaml requests
- name: Update from Artificial Analysis
env:
AA_API_KEY: ${{ secrets.AA_API_KEY }}
HF_TOKEN: ${\{ secrets.HF_TOKEN }}
run: |
python scripts/evaluation_manager.py import-aa \
--creator-slug "${{ vars.AA_CREATOR_SLUG }}" \
--model-name "${\{ vars.AA_MODEL_NAME }}" \
--repo-id "${{ github.repository }}" \
--create-prVerification and Validation
Check Current Evaluations
python3 scripts/evaluation_manager.py show \
--repo-id "your-username/your-model"Validate Format
python3 scripts/evaluation_manager.py validate \
--repo-id "your-username/your-model"View in HuggingFace UI
After updating, visit:
https://huggingface.co/your-username/your-modelThe evaluation widget should display your scores automatically.
Troubleshooting Examples
Problem: No tables found
# Check what tables exist in your README
python3 scripts/evaluation_manager.py extract-readme \
--repo-id "your-username/your-model" \
--dry-run
# If no output, ensure your README has markdown tables with numeric scoresProblem: AA model not found
# Verify the creator and model slugs
# Check the AA website URL or API directly
curl -H "x-api-key: $AA_API_KEY" \
https://artificialanalysis.ai/api/v2/data/llms/models | jqProblem: Token permission error
# Verify your token has write access
# Generate a new token at: https://huggingface.co/settings/tokens
# Ensure "Write" scope is enabledTips and Best Practices
- Always dry-run first: Use
--dry-runto preview changes - Use PRs for others' repos: Always use
--create-prfor repositories you don't own - Validate after updates: Run
validateto ensure proper formatting - Keep evaluations current: Set up automated updates for AA scores
- Document sources: The tool automatically adds source attribution
- Check the UI: Always verify the evaluation widget displays correctly
General help
python3 scripts/evaluation_manager.py --help
Command-specific help
python3 scripts/evaluation_manager.py extract-readme --help python3 scripts/evaluation_manager.py import-aa --help
For issues or questions, consult:
- `../SKILL.md` - Complete documentation
- `../README.md` - Troubleshooting guide
- `../QUICKSTART.md` - Quick start guide