mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-18 00:47:23 +02:00
test: add quality-depth gates and mature CPU coverage
This commit is contained in:
+6
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user