unlearning done

This commit is contained in:
2026-06-27 20:38:17 +02:00
parent c4fdc034b2
commit 0680a920ff
11 changed files with 307 additions and 740 deletions

View File

@@ -7,7 +7,7 @@ import time
import numpy as np
from sklearn.metrics import classification_report
from pathlib import Path
from unlearning.Strategy import Strategy
#from unlearning.Strategy import Strategy
import copy
from torch.optim.lr_scheduler import CosineAnnealingLR
@@ -84,7 +84,7 @@ class Model(ABC):
print(f'Model loaded from {file_path}')
def unlearn(self, strategy: Strategy, forget_loader, retain_loader):
def unlearn(self, strategy: 'Strategy', forget_loader, retain_loader):
""" Executes a targeted unlearning strategy and profiles efficiency """
print(f"Executing: {strategy.__class__.__name__}...")
@@ -103,6 +103,7 @@ class Model(ABC):
Evaluates the model, prints terminal reports, and routes metrics to
a file logger based on the current context mode.
"""
self.model.eval()
all_preds, all_labels = [], []
print(f"\nEvaluating Domain: [{mode}]...")