From 5b5281467a7fe2f35bf442ebf2900d796d08bf25 Mon Sep 17 00:00:00 2001 From: Tom Tseng Date: Sat, 7 Feb 2026 01:02:30 -0800 Subject: [PATCH] GCG: fix circular import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix circular import: evals/__init__ → evals/gcg/gcg → attacks/__init__ → attacks/embedding_attack → attacks/base → evals/__init__ the fix is to move the gcg implementation from attacks/ to evals/ --- src/tamperbench/whitebox/attacks/gcg/gcg.py | 2 +- src/tamperbench/whitebox/evals/gcg/gcg.py | 2 +- .../whitebox/{attacks => evals}/gcg/implementation.py | 0 tests/attacks/test_gcg_attack.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/tamperbench/whitebox/{attacks => evals}/gcg/implementation.py (100%) diff --git a/src/tamperbench/whitebox/attacks/gcg/gcg.py b/src/tamperbench/whitebox/attacks/gcg/gcg.py index 22471a86..08152401 100644 --- a/src/tamperbench/whitebox/attacks/gcg/gcg.py +++ b/src/tamperbench/whitebox/attacks/gcg/gcg.py @@ -7,9 +7,9 @@ from typing_extensions import override from tamperbench.whitebox.attacks.base import TamperAttack, TamperAttackConfig -from tamperbench.whitebox.attacks.gcg.implementation import GCGConfig from tamperbench.whitebox.attacks.registry import register_attack from tamperbench.whitebox.evals.gcg.gcg import GCGEvaluation, GCGEvaluationConfig +from tamperbench.whitebox.evals.gcg.implementation import GCGConfig from tamperbench.whitebox.evals.output_schema import EvaluationSchema from tamperbench.whitebox.utils.names import AttackName, EvalName diff --git a/src/tamperbench/whitebox/evals/gcg/gcg.py b/src/tamperbench/whitebox/evals/gcg/gcg.py index 13e8df23..9d850a94 100644 --- a/src/tamperbench/whitebox/evals/gcg/gcg.py +++ b/src/tamperbench/whitebox/evals/gcg/gcg.py @@ -11,8 +11,8 @@ from tqdm import tqdm from typing_extensions import override -from tamperbench.whitebox.attacks.gcg.implementation import GCG, GCGConfig from tamperbench.whitebox.evals.base import load_model_and_tokenizer +from tamperbench.whitebox.evals.gcg.implementation import GCG, GCGConfig from tamperbench.whitebox.evals.output_schema import InferenceSchema from tamperbench.whitebox.evals.registry import register_evaluation from tamperbench.whitebox.evals.strong_reject.strong_reject import ( diff --git a/src/tamperbench/whitebox/attacks/gcg/implementation.py b/src/tamperbench/whitebox/evals/gcg/implementation.py similarity index 100% rename from src/tamperbench/whitebox/attacks/gcg/implementation.py rename to src/tamperbench/whitebox/evals/gcg/implementation.py diff --git a/tests/attacks/test_gcg_attack.py b/tests/attacks/test_gcg_attack.py index 9f736bf1..c45b3dfb 100644 --- a/tests/attacks/test_gcg_attack.py +++ b/tests/attacks/test_gcg_attack.py @@ -10,7 +10,7 @@ from dotenv import load_dotenv from tamperbench.whitebox.attacks.gcg.gcg import GCGAttack, GCGAttackConfig -from tamperbench.whitebox.attacks.gcg.implementation import GCGConfig +from tamperbench.whitebox.evals.gcg.implementation import GCGConfig from tamperbench.whitebox.evals.output_schema import EvaluationSchema from tamperbench.whitebox.utils.models.config import ModelConfig from tamperbench.whitebox.utils.names import EvalName, MetricName