Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

summarize-experiment

БесплатноБез исполняемых скриптовНе проверен

Create the standard summary of experiment results from a completed (fine-tuned and evaluated) experiment. Run this right after run-experiment as the required…

niznik-devот niznik-dev★ 15 звёзд на GitHub

Об этом скилле

Summarize Experiment

Generate a summary.md file capturing key metrics from a completed experiment. Think R's summary() for experiment results.

Your Task

Create the standard post-run summary of experiment results:

  1. Parse run status from experiment_summary.yaml
  2. Extract final training loss from SLURM stdout
  3. Extract accuracy from inspect-ai .eval files
  4. Generate summary.md in experiment directory
  5. Log the process in logs/summarize-experiment.log

Prerequisites

  • experiment_summary.yaml exists
  • At least some runs have completed (partial results acceptable)
  • run-experiment has been executed (or manual SLURM jobs run)
  • Conda environment activated - The parse_eval_log.py script requires inspect-ai. Activate the conda environment from claude.local.md before running extraction commands.

Workflow

1. Locate Experiment

Find the experiment directory:

  • If in an experiment directory (contains experiment_summary.yaml): use current directory
  • Otherwise: ask user for path

2. Parse Run Status

Read experiment_summary.yaml to identify runs:

From runs: section:

  • name: Run identifier
  • type: "fine-tuned" or "control"
  • model: Model name
  • parameters: Dict of hyperparameters (empty for control runs)

From evaluation.matrix: section:

  • run: Run name
  • tasks: List of evaluation task names
  • epochs: List of epochs to evaluate (null for control runs)

Determine status by checking filesystem:

  • Fine-tuning: Check for {experiment_dir}/{run_name}/artifacts/ and SLURM outputs
  • Evaluation: Check for {run_dir}/eval/*/logs/*.eval files

3. Extract Training Loss

For each COMPLETED fine-tuning run:

  1. Find SLURM stdout in the output directory:
    • Read experiment.dir from experiment_summary.yaml as experiment_dir
    • Look in: {experiment_dir}/{run_name}/artifacts/slurm-*.out
    • If multiple files, use most recent by modification time
  2. Extract final loss using cruijff_kit.tools.torchtune.extract_loss:
    from cruijff_kit.tools.torchtune.extract_loss import final_loss
    result = final_loss(slurm_text)  # returns (epoch, step, loss) or None
    
    • The canonical regex and helpers live in src/tools/torchtune/extract_loss.py
    • final_loss() returns the last match (epoch, step, loss) or None
    • extract_losses() returns all matches as a list
    • The step number from the last match is the total training steps
  3. Record: run_name, final_loss, total_steps, epoch, step

Note: Training SLURM outputs are in the output directory, NOT the run directory. (Missing stdout → record N/A, continue; see Error Handling.)

4. Extract Evaluation Accuracy

For each COMPLETED evaluation:

  1. Find .eval files: {run_dir}/eval/*/logs/*.eval
  2. For each .eval file, run:
    python -m cruijff_kit.tools.inspect.parse_eval_log {path}
    
  3. Parse JSON output for the scorer's metrics (the scorer field tells you the type)
  4. Map to epoch using SLURM job names (see below)
  5. Dispatch on scorer type:
    • Binary classification (match/exact_match on 0/1 targets): also run summary_binary.py for balanced accuracy and F1 (below).
    • continuous_scorer (regression targets): run summary_continuous.py for mae/rmse/r²/parse_rate and a prediction-distribution glance (below). Accuracy is not meaningful here — do not report it.
    • risk_scorer (binary 0/1, but its CORRECT/INCORRECT is exact-string-match and summary_binary.py crashes on its .eval archives): take accuracy/samples from parse_eval_log only — do not run summary_binary.py on it. Argmax accuracy and format-compliance % are explore-experiment's job, not summarize's.
  6. Record the metrics appropriate to the scorer — classification → accuracy, balanced_accuracy, f1; regression → mae, rmse, r_squared, parse_rate. Always record run_name, task, epoch, samples.

Returns (JSON): consume task, accuracy, samples, scorer, model. The scorer field drives the dispatch in step 5; on failure it returns {"status": "error", "message": ...} (see Error Handling).

Mapping Epochs via SLURM Job Names

The .eval files don't currently store epoch information directly. To reliably map each evaluation to its epoch:

  1. Find SLURM output files in the eval directory: {run_dir}/eval/slurm-*.out
  2. Extract job IDs from filenames (e.g., slurm-2773062.out → job ID 2773062)
  3. Query job names via sacct:
    sacct -j {job_ids} --format=JobID,JobName%50
    
  4. Parse epoch from the job name — scaffold-inspect names eval jobs eval-{task}-ep{N} (or eval-{task} for a base run with no epoch). The run is identified by which {run_dir}/eval/ the slurm file sits in, not by the job name:
    • eval-acs_income-ep0 → epoch 0
    • eval-acs_income-ep9 → epoch 9

Reliable regardless of submission order, timing, or resubmissions — the epoch comes from the scaffold-set job name, never from

Полный SKILL.md на GitHub

Установить summarize-experiment в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

logging.md

FAQ

Что делает скилл summarize-experiment?

Create the standard summary of experiment results from a completed (fine-tuned and evaluated) experiment. Run this right after run-experiment as the required post-run step — captures key metrics (loss, accuracy, regression metrics) into summary.md.

Как установить скилл summarize-experiment?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл summarize-experiment запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить summarize-experiment с