Added TrainingHubCallback abstraction and Unsloth adapter #128
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 345 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.350
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #128"
general
weight: 0.35
RobotSail
Summary
TrainingHubCallbackbase class andTrainingHubContextdataclass for backend-agnostic training lifecycle hooksUnslothCallbackAdapter) with exception isolation and rank-0 guardcallbacksandeval_data_pathintolora_sft/ Unsloth LoRA backend so user callbacks fire during real trainingThis is the first split of RHOAIENG-54744. InstructLab / Mini-Trainer adapters and torchrun serialization are deferred to RHOAIENG-77627.
What's included
| Piece | Details |
| --- | --- |
|
TrainingHubCallback| 9 no-op lifecycle hooks (on_train_begin…on_train_end) ||
TrainingHubContext| Normalizedstep,epoch,loss,learning_rate,is_main_process,output_dir,metrics|| Unsloth adapter | Wraps hub callbacks as HF
TrainerCallback; forwards eval metrics onon_evaluate|| API |
lora_sft(..., callbacks=[...], eval_data_path=...)|| Unit tests |
tests/test_callbacks.py— context, hooks, adapter dispatch, exception isolation, rank guard, eval metrics || Smoke notebook |
examples/notebooks/callback_smoke_unsloth.ipynb— guided Unsloth e2e cells (setup, train+eval, pass/fail for all 9 hooks) || Smoke script |
examples/scripts/callback_smoke_unsloth.py— same check runnable from a workbench terminal |Test plan
pytest tests/test_callbacks.py(15 passed)Qwen2.5-0.5B-Instruct- Confirmed all 9 unified hooks fired: begin/epoch/step/log/evaluate/save/end
- Confirmed
on_evaluatereceives metrics (after metrics-forwarding fix)Refs: RHOAIENG-77626, RHOAIENG-54744
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added a unified Training Hub callback framework with a shared training context and standardized lifecycle hooks.
Introduced an adapter that routes Training Hub callback events (including metrics) into the Unsloth-backed training flow.
Extended
lora_sft/LoRA SFT to accept custom callbacks and optional evaluation data and per-device eval batch sizing.Re-exported callback components from the top-level package.
Bug Fixes
Evaluation is now conditionally enabled only when evaluation data is provided.
Tests
Added unit tests for callback behavior and adapter dispatch, including exception isolation and rank-based dispatch.
Added end-to-end callback smoke-check script and notebook.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->