From fa1f6c61dbb33232bfa93dade85799d1ed0cb1e1 Mon Sep 17 00:00:00 2001 From: wassname <1103714+wassname@users.noreply.github.com> Date: Tue, 13 Jan 2026 06:47:50 +0800 Subject: [PATCH] Refactor documentation and remove commented-out code in training adapter --- antipasto/peft_utils/adapter_scaling.py | 2 +- antipasto/train/train_adapter.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/antipasto/peft_utils/adapter_scaling.py b/antipasto/peft_utils/adapter_scaling.py index d70a21b..fb0bda8 100644 --- a/antipasto/peft_utils/adapter_scaling.py +++ b/antipasto/peft_utils/adapter_scaling.py @@ -4,7 +4,7 @@ Adapter steering for contrastive training with proper gradient flow. For AntiPaSTO: Sets `antipasto_alpha` directly on each layer. The Cayley rotation transform satisfies R(-α) = R(α)^(-1), so a single adapter handles both steering directions. -Key insight: PyTorch's autograd tracks tensor references in the computation graph, +PyTorch's autograd tracks tensor references in the computation graph, not module attributes. So we can: 1. Replace `module.weight` with `weight * coeff` (graph stores ref to original param) 2. Run forward pass diff --git a/antipasto/train/train_adapter.py b/antipasto/train/train_adapter.py index 8aac832..fba0e2b 100644 --- a/antipasto/train/train_adapter.py +++ b/antipasto/train/train_adapter.py @@ -1968,7 +1968,6 @@ def train_model(config: TrainingConfig): f"Results for method: {method} [logratio * label -> nat's toward label]\n{df_res_pv[method].head(5).round(4)}\n" ) - # Generate comprehensive metrics (both text and markdown) md_table, tables_dict, main_score = format_main_results_table( df_res_wlabels, config=config )