test: add quality-depth gates and mature CPU coverage

This commit is contained in:
Joseph Magly
2026-08-14 14:08:23 -04:00
parent b80c1a1694
commit 951700a285
21 changed files with 1986 additions and 80 deletions
+6 -1
View File
@@ -6,7 +6,6 @@ import socket
from unittest.mock import MagicMock
import pytest
import torch
_EXTERNAL_MARKERS = ("network", "download", "remote")
@@ -46,6 +45,8 @@ def mock_model():
- model.config with config.num_hidden_layers = 4
- model.named_parameters() returning fake weight tensors
"""
import torch
model = MagicMock()
# Config with num_hidden_layers
@@ -83,6 +84,8 @@ def mock_tokenizer():
@pytest.fixture
def refusal_direction():
"""A normalized random torch tensor of shape (768,)."""
import torch
t = torch.randn(768)
return t / t.norm()
@@ -90,6 +93,8 @@ def refusal_direction():
@pytest.fixture
def activation_pair():
"""A tuple of (harmful_activations, harmless_activations) as random tensors of shape (10, 768)."""
import torch
harmful_activations = torch.randn(10, 768)
harmless_activations = torch.randn(10, 768)
return (harmful_activations, harmless_activations)