Skip to content

PigeonDan1/sure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SURE-EVAL logo

SURE-EVAL

Systematic Unified Robust Evaluation Framework for Audio Processing

English δΈ­ζ–‡ πŸ“– User Manual HTML Manual PDF Manual Python 3.10+ License: MIT


πŸ“– User Manual (Recommended)

New to SURE-EVAL? Start with the complete user manual:

The manual uses Qwen3-ASR as a running example and covers installation, data preparation, model onboarding, evaluation execution, and Agent Flow in detail.


πŸ“‹ Overview

SURE-EVAL is an automated evaluation framework for audio tools and models, built around a simple principle:

🎯 Agent decides scope, scripts enforce execution.

Who this is for: audio ML researchers and engineers who want reproducible, auditable benchmark evaluation without hand-rolling a new pipeline for every model.

Three-Layer Architecture

flowchart LR
  U[User request] --> Q{Choose workflow}
  Q -- Existing model evaluation --> M[main_flow_agent]
  Q -- New model onboarding / repair --> T[model_tool_agent]
  Q -- Unsure --> R[Readiness gate]
  R -- ready --> M
  R -- not ready --> T
  T --> Ready[Callable SURE tool]
  Ready --> M
  M --> Run[Evaluation run<br/>scores + reports + manifest]
Loading
Layer Role Key docs
πŸ€– Main Flow Agent Decides what should be run docs/agents/main_flow_agent/README.md
πŸ”§ Model Tool Agent Makes models callable in reproducible ways docs/agents/model_tool_agent/README.md
πŸ“œ Deterministic Script Layer Prepares, validates, scores, records scripts/

Overall Framework

SURE-EVAL overall framework


✨ What SURE-EVAL Solves

Goal How
πŸš€ Onboard a new audio model Turn raw repositories into stable local tools
πŸ“Š Run controlled evaluations Select datasets β†’ Generate predictions β†’ Validate β†’ Score β†’ Record

πŸ’‘ Key Insight: Model integration is high-uncertainty, but evaluation execution should be low-uncertainty. SURE-EVAL separates these concerns.


πŸ—οΈ Architecture

πŸ€– 1. Main Flow Agent

Role: Orchestration layer

Responsibilities:

  • Understanding user goals
  • Task classification
  • Tool readiness verification
  • Dataset scope selection
  • Script routing
  • Outcome assessment

πŸ“– Documentation:


πŸ”§ 2. Model Tool Agent

Location: docs/agents/model_tool_agent/

Responsibilities:

  • Backend selection
  • Environment isolation
  • Import / Load / Infer / Contract validation
  • Wrapper generation
  • Artifact management

πŸ“– Documentation:


πŸ“œ 3. Deterministic Script Layer

Core Scripts:

Script Purpose
prepare_sure_dataset.py Canonical dataset preparation
materialize_predictions_template.py Prediction template generation
validate_prediction_files.py Prediction validation
evaluate_predictions.py Metric & RPS computation
refresh_report_snapshot.py Result recording & reports

Deterministic Metric CLI:

sure-eval metric describe asr --language zh --metric cer --output /tmp/asr_pipeline.json --json
sure-eval metric run --pipeline /tmp/asr_pipeline.json --ref-file ref.txt --hyp-file hyp.txt --output-dir /tmp/sure_eval/asr_eval --json

The CLI calls sure_eval.evaluation.scripts.run_task(...); route selection, executor loading, pipeline-id validation, and output writing stay in the script layer. It reports node-local environment hints but does not validate uv or node dependencies.


πŸš€ Quick Start Guide

πŸ“ Which Path Should I Use?

Start Here
    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Do you have a model under src/sure_eval/models/<model>?   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    β”‚
    β”œβ”€β”€ ❌ No β†’ Use Model Tool Agent
    β”‚         β†’ Build model-local server first
    β”‚         β†’ Then use Main Flow Agent
    β”‚
    └── βœ… Yes β†’ Check config.yaml for server/tool path
                β”‚
                β”œβ”€β”€ ❌ No server path
                β”‚   β†’ Use Model Tool Agent
                β”‚
                └── βœ… Server path exists
                    β†’ Run TOOL_READINESS_AND_ROUTING_UNIT
                        β”‚
                        β”œβ”€β”€ 🟒 server_ready
                        β”‚   β†’ Continue to evaluation
                        β”‚
                        β”œβ”€β”€ 🟑 server_declared_but_unverified
                        β”‚   β†’ Run smoke test first
                        β”‚
                        └── πŸ”΄ tool_broken_needs_repair
                            β†’ Hand off to Model Tool Agent

πŸ› οΈ Path A: Onboard a New Model

Use when: Model is not yet in src/sure_eval/models/

Steps:

  1. Go to Model Tool Agent README
  2. Use the model tool agent prompt template
  3. Let the workflow produce a callable model
  4. Switch to Main Flow Agent for evaluation

🎯 Path B: Evaluate an Existing Model

Use when: Model already has a directory in src/sure_eval/models/

Steps:

  1. Use prompt from Agent README
  2. Let agent execute:
    • TASK_CLASSIFICATION_UNIT
    • TOOL_READINESS_AND_ROUTING_UNIT
    • PLAN_UNIT
    • DATASET_SCOPE_UNIT
    • SCRIPT_ROUTING_UNIT
    • EXECUTION_SURFACE_UNIT
    • EXECUTION_READINESS_UNIT
    • SMOKE_TEST_UNIT
  3. Continue to prediction generation and scoring

Recommended artifact root:

  • src/sure_eval/models/<model>/eval_runs/<run_id>/

Layout contract:


⚑ Installation

Prerequisites

  • Python: 3.10+ for the main environment; some models require 3.11.
  • System packages: ffmpeg, libsndfile1 (for audio I/O).
  • Storage: at least 20 GB for model weights and datasets.
  • GPU: optional but recommended; Qwen3-ASR can run on CPU, slowly.
  • Network: ModelScope access from mainland China; HuggingFace is often blocked.

Quick install with uv

# Clone repository
git clone https://github.com/PigeonDan1/sure.git
cd sure

# Create and activate main environment (Python 3.12 recommended)
uv venv --python 3.12
source .venv/bin/activate

# Install the framework
uv pip install -e .

# Verify
python -m sure_eval.models.registry

Each model also has its own isolated environment under src/sure_eval/models/<model>/.venv/. See the model's setup.sh for details.

Dataset payloads are local-only. The top-level data/ directory is reserved for local mounts, symlinks, caches, and smoke data; tracked dataset registry updates should live under config/ or docs instead.

πŸ’‘ Tip: The minimal prompts in the agent READMEs are copy-paste templates for a Chinese-speaking agent runtime. You can translate the instructions to English if your agent runtime prefers it.


πŸ“Š Deterministic Evaluation Pipeline

Execute evaluation without agents (requires an already-onboarded model such as asr_qwen3):

# 1️⃣ Prepare datasets
python scripts/prepare_sure_dataset.py \
  --dataset aishell1

# 2️⃣ Generate predictions via the model's MCP server
python scripts/generate_predictions_via_server.py \
  --model-dir src/sure_eval/models/asr_qwen3 \
  --dataset aishell1 \
  --run-dir /tmp/eval_run \
  --tool-name asr_transcribe \
  --language auto \
  --resume

# 3️⃣ Validate predictions
python scripts/validate_prediction_files.py \
  --dataset aishell1 \
  --pred-dir /tmp/eval_run/predictions \
  --require-nonempty

# 4️⃣ Evaluate and record
python scripts/evaluate_predictions.py \
  --dataset aishell1 \
  --pred-dir /tmp/eval_run/predictions \
  --tool-name asr_qwen3 \
  --record \
  --output /tmp/eval_payload.json

# 5️⃣ Refresh report snapshot
python scripts/refresh_report_snapshot.py \
  --markdown reports/asr_qwen3.md \
  --json reports/asr_qwen3_summary.json

πŸ”„ Main Flow Execution

Flow Diagram

TASK_CLASSIFICATION_UNIT
        ↓
TOOL_READINESS_AND_ROUTING_UNIT
        ↓
      PLAN_UNIT
        ↓
   DATASET_SCOPE_UNIT
        ↓
   SCRIPT_ROUTING_UNIT
        ↓
EXECUTION_SURFACE_UNIT
        ↓
EXECUTION_READINESS_UNIT
        ↓
   EXECUTE / WAIT
        ↓
   ASSESSMENT_UNIT
        ↓
   RUN_REPORT_UNIT

⚠️ Critical Rule: Never skip tool readiness routing!

If a model declares a server path:

  1. Prefer server-first smoke test
  2. Confirm server_ready status
  3. Only then proceed to evaluation

Two-Stage Rule

🚦 Adapt first, evaluate second.

SURE-EVAL treats model onboarding and evaluation as two distinct stages:

  1. Stage 1 β€” Model Tool Agent: turn a raw model into a callable SURE tool.
  2. Stage 2 β€” Main Flow Agent: run benchmark evaluation on that tool.

If the main flow sees not_tool_ready or tool_broken_needs_repair, stop evaluation routing and hand off to the Model Tool Agent. Do not improvise evaluation-time fixes.

For new models, provide onboarding-oriented inputs early: upstream repo, checkpoint source, expected task/IO contract, and environment hints.

πŸ“– Example: Qwen3 ASR Case Study

Prediction generation should follow a hard contract rather than an implicit "wait until files appear" step:

For human-operated background runs, prefer a single-model single-dataset shell:

Before handing that shell to a user, the main flow should first materialize the execution surface and then run a bounded execution-readiness validation:


πŸ“ Example: Evaluate with Main Flow Agent

Use the prompt template from Agent README, then provide:

MAIN_FLOW_INPUT:
  user_goal: evaluate_existing_model

  target:
    model_name: asr_qwen3
    model_dir: src/sure_eval/models/asr_qwen3
    tool_workflow_ready: true

  constraints:
    allow_tool_workflow: true
    allowed_tasks: [ASR]
    allowed_datasets: null
    blocked_datasets: []
    dry_run: false

  evidence:
    readme_path: src/sure_eval/models/asr_qwen3/README.md
    config_path: src/sure_eval/models/asr_qwen3/config.yaml
    artifacts_dir: src/sure_eval/models/asr_qwen3/artifacts
    model_spec_path: src/sure_eval/models/asr_qwen3/model.spec.yaml

  runtime_context:
    available_scripts:
      - scripts/prepare_sure_dataset.py
      - scripts/materialize_predictions_template.py
      - scripts/validate_prediction_files.py
      - scripts/evaluate_predictions.py
    output_dir: src/sure_eval/models/asr_qwen3/eval_runs/main_agent_asr_qwen3_001

Structured Outputs

  • task_classification.json
  • tool_readiness_routing.json
  • main_agent_plan.json
  • dataset_decision.json
  • script_routing.json
  • execution_surface.json
  • execution_readiness_report.json
  • assessment_report.json
  • main_agent_run_report.json
  • model_eval_manifest.json

πŸ“ Project Structure

sure-eval/
β”œβ”€β”€ data/                   # πŸ“‚ Local dataset mounts and caches; ignored by Git
β”œβ”€β”€ src/sure_eval/
β”‚   β”œβ”€β”€ core/               # βš™οΈ Core utilities
β”‚   β”œβ”€β”€ datasets/           # πŸ“‚ Dataset management
β”‚   β”œβ”€β”€ evaluation/         # πŸ“Š Metrics and RPS
β”‚   β”œβ”€β”€ models/             # πŸ”§ Model registry & onboarded models
β”‚   └── reports/            # πŸ“ˆ Reporting and baselines
β”œβ”€β”€ scripts/                # πŸ“œ Deterministic evaluation scripts
β”œβ”€β”€ config/                 # βš™οΈ Configuration files
β”œβ”€β”€ fixtures/tasks/         # πŸ§ͺ Shared task fixtures
└── docs/agents/            # πŸ“š Agent-scoped harness docs and templates
    β”œβ”€β”€ main_flow_agent/
    └── model_tool_agent/

🎯 Supported Tasks

Task Description
ASR Automatic Speech Recognition
S2TT Speech-to-Text Translation
SD Speaker Diarization
SA-ASR Speaker-Aware ASR
SER Speech Emotion Recognition
Speech Enhancement Noise suppression, enhancement
Music IR Music information retrieval

❓ FAQ

Q: What do server_declared_but_unverified and tool_broken_needs_repair mean?

Status Meaning Next step
server_ready The model server passed the smoke test Continue to evaluation
server_declared_but_unverified config.yaml declares a server, but it hasn't been smoke-tested Run scripts/generate_predictions_via_server.py --max-samples 1 manually
not_tool_ready The model directory is missing required files Start with the Model Tool Agent
tool_broken_needs_repair The environment or wrapper is broken Hand off to the Model Tool Agent; do not continue evaluation

Q: Where are evaluation artifacts stored?

Each run writes structured outputs under src/sure_eval/models/<model>/eval_runs/<run_id>/. See the eval run layout contract.

Q: Can I run evaluation without agents?

Yes. Use the deterministic script pipeline shown in πŸ“Š Deterministic Evaluation Pipeline.


πŸ“š Documentation Map

Document Purpose
User Manual Complete Chinese user manual (also available as HTML / PDF)
Workflow Gallery Visual overview of both agent workflows
Main Flow Agent Agent system prompt & examples
Agent Routing Main flow routing guide
Model Tool Agent Model integration workflow
Onboarded Models Clean model directory set and local artifact policy
Architecture System architecture details
Evaluation Run Layout Model-local artifact layout per run
Prediction Generation Contract Hard contract for wait_for_predictions
Single Model Single Dataset Shell One-command execution contract for human operators
Execution Readiness Unit Preflight shell validation before background runs
Model Eval Manifest One-file index for a model evaluation run
Qwen3 Case Study Real replay case

πŸ“„ License

MIT License. See LICENSE.

About

A Strong Agentic Framework for Model Adaptation and Auto-Evaluation

Topics

Resources

License

Stars

6 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors