[Feature] Fine-tune email classifier — WeightedTrainer, FineTunedAdapter, SSE training UI #8
Labels
No labels
backlog
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Circuit-Forge/avocet#8
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Full fine-tune pipeline implemented on branch
feat/vue-label-tab(2026-03-15).What was built
New files
scripts/finetune_classifier.py— CLI + library:load_and_prepare_data(),WeightedTrainer,run_finetune(),compute_class_weights(),compute_metrics_for_trainer()tests/test_finetune.py— 15 unit tests + 1 integration testModified files
scripts/classifier_adapters.py—FineTunedAdapter(loads saved checkpoint via HF pipeline; GPU-routed)scripts/benchmark_classifier.py—discover_finetuned_models(), auto-merge fine-tuned adapters into benchmark at startupapp/api.py—GET /api/finetune/status,GET /api/finetune/run(SSE subprocess stream, path-traversal-safe)web/src/views/BenchmarkView.vue— trained models badge row + collapsible fine-tune section (auto-triggers benchmark on completion)environment.yml— addedscikit-learn>=1.4Key design notes
load_and_prepare_data()acceptsPath | list[Path]; deduplicates by MD5(subject + body[:100]), last-write-wins. Supports accumulating multiple labeling sessions over time.deberta-small(100M, ~15 min, no VRAM conflict) andbge-m3(600M, requires stopping Peregrine vLLM first)compute_loss(**kwargs)absorbsnum_items_in_batch(Transformers 4.38+); weights moved.to(device)for GPU trainingdiscover_finetuned_models()scansmodels/*/training_info.jsonat startup — trained models appear in benchmark automaticallyStreamingResponse; VueuseApiSSEcomposable handles progress/complete/error_DATA_DIRCLI usage
Test results
job-seekerenv: 79/79 passjob-seeker-classifiersenv: 44/44 unit tests pass (integration test skipped — needs GPU headroom)Known limitation
Integration test (
test_integration_finetune_on_example_data) hits CUDA OOM when Peregrine vLLM is running. Run with./manage.sh stopfirst.