mirror of
https://github.com/wassname/weight-steering.git
synced 2026-08-15 13:05:01 +08:00
fix: remove flash_attention_2, revert to Qwen3.5-4B
Qwen3.5-4B + FA2 trips linear_attention masking in transformers. sdpa (default) works fine; sl confirmed same approach in their sweep. Model reverted to Qwen3.5-4B to match sl baselines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
43278709d7
commit
553d15b9c3
+1
-1
@@ -544,7 +544,7 @@ def generate_pairs(cfg: DataCfg) -> Path:
|
||||
if tok.pad_token is None:
|
||||
tok.pad_token = tok.eos_token
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
cfg.model_id, torch_dtype=torch.bfloat16, device_map="cuda", attn_implementation="flash_attention_2"
|
||||
cfg.model_id, torch_dtype=torch.bfloat16, device_map="cuda"
|
||||
)
|
||||
model.eval()
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ FRAMES: dict[str, dict[str, str | float]] = {
|
||||
|
||||
@dataclass
|
||||
class TinyMFVAiriskCfg:
|
||||
model: str = "Qwen/Qwen3-4B"
|
||||
model: str = "Qwen/Qwen3.5-4B"
|
||||
behavior: str = "authority"
|
||||
adapter: str = "delora"
|
||||
out: Path = Path("out")
|
||||
@@ -520,7 +520,7 @@ def run_eval(cfg: TinyMFVAiriskCfg) -> tuple[pl.DataFrame, pl.DataFrame, pl.Data
|
||||
if tok.pad_token is None:
|
||||
tok.pad_token = tok.eos_token
|
||||
tok.padding_side = "left"
|
||||
model = AutoModelForCausalLM.from_pretrained(cfg.model, torch_dtype=torch.bfloat16, device_map="cuda", attn_implementation="flash_attention_2")
|
||||
model = AutoModelForCausalLM.from_pretrained(cfg.model, torch_dtype=torch.bfloat16, device_map="cuda")
|
||||
model.eval()
|
||||
|
||||
vignettes = _load_vignettes(cfg.limit)
|
||||
|
||||
@@ -323,7 +323,7 @@ def main(cfg: KLCalibrateCfg) -> None:
|
||||
tok.pad_token = tok.eos_token
|
||||
tok.padding_side = "left"
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
cfg.model, torch_dtype=torch.bfloat16, device_map="cuda", attn_implementation="flash_attention_2"
|
||||
cfg.model, torch_dtype=torch.bfloat16, device_map="cuda"
|
||||
)
|
||||
model.eval()
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class EvalTinymfvCalibratedCfg:
|
||||
behavior: str = "authority"
|
||||
out: Path = Path("out")
|
||||
adapters: tuple[str, ...] = ("lora", "dora", "pissa", "delora", "oft", "ia3")
|
||||
model: str = "Qwen/Qwen3-4B"
|
||||
model: str = "Qwen/Qwen3.5-4B"
|
||||
bootstrap_samples: int = 256
|
||||
limit: int = 0
|
||||
batch_size: int = 16
|
||||
|
||||
@@ -103,7 +103,7 @@ def _foundation_short(behavior: str) -> dict[str, str]:
|
||||
@dataclass
|
||||
class ReadmeTinymfvCfg:
|
||||
behavior: str = "auth_care"
|
||||
model_label: str = "Qwen3-4B"
|
||||
model_label: str = "Qwen3.5-4B"
|
||||
out: Path = Path("out")
|
||||
adapters: tuple[str, ...] = ("lora", "dora", "pissa", "delora", "oft", "ia3")
|
||||
include_prompt_baseline: bool = True
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ def train_adapter(cfg: TrainCfg, ds: Dataset) -> Path:
|
||||
tok.pad_token = tok.eos_token
|
||||
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
cfg.model_id, torch_dtype=torch.bfloat16, device_map="cuda", attn_implementation="flash_attention_2"
|
||||
cfg.model_id, torch_dtype=torch.bfloat16, device_map="cuda"
|
||||
)
|
||||
model.config.use_cache = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user