turnstone/app/services/diagnose
pyr0ball ae0ecac17d feat(classifier): add Hybrid-BERT label mapping shim (#41)
Adds _HYBRID_BERT_LABEL_MAP to translate the 7-class output vocabulary of
krishnas4415/log-anomaly-detection-models (Hybrid-BERT, MIT) to Turnstone
SeverityLabel. _map_label now checks the Hybrid-BERT map before the standard
map so either model family works via TURNSTONE_CLASSIFIER_MODEL without any
additional code path.

Mapping (confirmed from model config.json):
  normal            → INFO
  security_anomaly  → ERROR
  system_failure    → CRITICAL
  performance_issue → WARN
  network_anomaly   → WARN
  config_error      → ERROR
  hardware_issue    → CRITICAL

Keyword-based CRITICAL promotion and low-confidence DEBUG demotion apply on
top of the base mapping (same rules as the standard vocabulary).

11 new tests covering all 7 Hybrid-BERT labels, case-insensitivity, and
regression on standard-vocabulary labels. 372 tests passing total.

Note: custom loading code for the non-standard .pt checkpoint format is
explicitly out of scope — evaluate better-packaged HF alternatives first
(see #41 for candidate list).

Closes: #41
2026-06-01 16:20:31 -07:00
..
__init__.py feat(diagnose): tech-level post-processor, offline mode, API auth, context harvest 2026-05-28 08:51:05 -07:00
_llm_client.py fix(diagnose): add max_tokens to all LLM calls; fix reasoning card contrast 2026-05-27 22:23:36 -07:00
classifier.py feat(classifier): add Hybrid-BERT label mapping shim (#41) 2026-06-01 16:20:31 -07:00
hypothesizer.py fix(diagnose): add max_tokens to all LLM calls; fix reasoning card contrast 2026-05-27 22:23:36 -07:00
legacy.py fix: frozen dataclasses, clean __all__, improve exception logging in diagnose package 2026-05-25 12:31:07 -07:00
models.py refactor: pipeline cleanup — 6 follow-up fixes (#33-#38) 2026-05-25 19:05:56 -07:00
pipeline.py feat(diagnose): tech-level post-processor, offline mode, API auth, context harvest 2026-05-28 08:51:05 -07:00
suppressor.py fix(db): add timeout=30s to all sqlite3.connect() calls across app 2026-05-26 23:12:48 -07:00
synthesizer.py feat(diagnose): tech-level post-processor, offline mode, API auth, context harvest 2026-05-28 08:51:05 -07:00
timeline.py refactor: split TimelineReconstructor.reconstruct into helpers, fix magic number + error handling 2026-05-25 13:22:18 -07:00