Spaces:
Running
Running
File size: 1,354 Bytes
e6f24ae | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """M10 — HyperSteer: Transformer hypernetwork, no-context variant.
Lightly-trained method using a small transformer to generate steering vectors.
Using no-context variant due to GPU budget constraints.
"""
import numpy as np
from src.methods.base import SteeringMethod
class HyperSteer(SteeringMethod):
"""HyperSteer — Transformer hypernetwork (no-context variant)."""
def __init__(self, **kwargs):
self._trained = False
self._direction: np.ndarray = None
@property
def name(self) -> str:
return "HyperSteer"
@property
def method_id(self) -> str:
return "M10"
@property
def is_training_free(self) -> bool:
return False
def extract_vector(
self,
h_pos: np.ndarray,
h_neg: np.ndarray,
**kwargs,
) -> np.ndarray:
if self._direction is not None:
return self._direction
# Fallback
from src.methods.diffmean import DiffMean
return DiffMean().extract_vector(h_pos, h_neg)
def train(self, train_data: dict) -> None:
"""Train HyperSteer hypernetwork.
TODO: Implement no-context variant following AxBench/HyperSteer.
Note: Using no-context variant due to GPU budget (24GB).
"""
raise NotImplementedError("HyperSteer training not yet implemented.")
|