| FL_Retrain |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/FL_base.py code served (permissive licence) · get_code("e307e10a2009efe7") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import copy
import numpy as np
torch.manual_seed(0)
# Simple model for testing
class SimpleModel(nn.Module):
def __init__(self, input_dim=4, hidden_dim=8, num_classes=3):
super(SimpleModel, self).__init__()
self.fc1 = nn.Linear(input_dim, hidden_dim)
self.fc2 = nn.Linear(hidden_dim, num_classes)
def forward(self, x):
x = torch.relu(self.fc1(x))
x = self.fc2(x)
return x
# Create initial global model
init_global_model = SimpleModel(input_dim=4, hidden_dim=8, num_classes=3)
# Create client data loaders (list of list of (data, target) tuples)
num_clients = 2
num_classes = 3
input_dim = 4
client_data_loaders = []
for client_id in range(num_clients):
# Each client has 2 batches of data
client_data = []
for batch_id in range(2):
# Create small batch: 2 samples per batch
data = torch.randn(2, input_dim) # batch_size=2, features=4
target = torch.randint(0, num_classes, (2,)) # batch_size=2, 3 classes
client_data.append((data, target))
client_data_loaders.append(client_data)
# Create test loader (list of (data, target) tuples)
test_loader = []
for batch_id in range(2):
data = torch.randn(2, input_dim)
target = torch.randint(0, num_classes, (2,))
test_loader.append((data, target))
# Add batch_size attribute to test_loader for the test function
class SimpleDataLoader:
def __init__(self, data_list):
self.data = data_list
self.batch_size = 2
def __iter__(self):
return iter(self.data)
def __len__(self):
return len(self.data)
@property
def dataset(self):
class Dataset:
def __init__(self, size):
self.size = size
def __len__(self):
return self.size
return Dataset(4)
test_loader = SimpleDataLoader(test_loader)
client_data_loaders = [SimpleDataLoader(client_data) for client_data in client_data_loaders]
# Create FL_params configuration object
class FLParams:
def __init__(self):
self.N_client = num_clients
self.local_lr = 0.01
self.local_epoch = 1
self.global_epoch = 1
self.if_retrain = True
self.forget_client_idx = 0
self.if_unlearning = False
self.train_with_test = False
self.use_gpu = False
self.cuda_state = False
FL_params = FLParams()
ARGS = {
'init_global_model': init_global_model,
'client_data_loaders': client_data_loaders,
'test_loader': test_loader,
'FL_params': FL_params
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| FL_Train |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/FL_base.py code served (permissive licence) · get_code("f73358727d0c56aa") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import copy
torch.manual_seed(0)
# Define a simple model
class SimpleModel(nn.Module):
def __init__(self):
super(SimpleModel, self).__init__()
self.fc1 = nn.Linear(4, 8)
self.fc2 = nn.Linear(8, 3)
def forward(self, x):
x = torch.relu(self.fc1(x))
x = self.fc2(x)
return x
# Create a simple data loader (list of (x, y) tuples)
def create_data_loader(num_batches=2, batch_size=2):
data_loader = []
for _ in range(num_batches):
x = torch.randn(batch_size, 4)
y = torch.randint(0, 3, (batch_size,))
data_loader.append((x, y))
return data_loader
# Create test loader
test_loader = create_data_loader(num_batches=2, batch_size=2)
# Create client data loaders (one for each client)
client_data_loaders = [
create_data_loader(num_batches=2, batch_size=2),
create_data_loader(num_batches=2, batch_size=2),
create_data_loader(num_batches=2, batch_size=2)
]
# Define FL_params config
class FL_Params:
def __init__(self):
self.N_client = 3
self.local_lr = 0.01
self.local_epoch = 1
self.global_epoch = 1
self.use_gpu = False
self.cuda_state = False
self.train_with_test = False
self.if_retrain = False
self.if_unlearning = False
self.forget_client_idx = -1
FL_params = FL_Params()
# Create initial global model
init_global_model = SimpleModel()
ARGS = {
'init_global_model': init_global_model,
'client_data_loaders': client_data_loaders,
'test_loader': test_loader,
'FL_params': FL_params
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| attack |
Ran ran, honoured the contract we drafted |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/membership_inference.py code served (permissive licence) · get_code("322658c072f2ee54") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import numpy as np
from sklearn.svm import SVC
torch.manual_seed(0)
np.random.seed(0)
# Simple target model
class TargetModel(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.linear1 = nn.Linear(4, 16)
self.linear2 = nn.Linear(16, num_classes)
def forward(self, x):
x = torch.relu(self.linear1(x))
x = self.linear2(x)
return x
# Simple attack model
class AttackModel:
def __init__(self):
self.model = SVC(kernel='linear')
def predict(self, X):
return self.model.predict(X)
def fit(self, X, y):
self.model.fit(X, y)
return self
# Config class
class FL_Params:
def __init__(self):
self.data_name = 'mnist'
self.forget_client_idx = 0
# Create client loaders (list of data loaders, each is a list of batches)
def create_client_loader(num_batches=2, batch_size=2, input_dim=4, num_classes=10):
loader = []
for _ in range(num_batches):
data = torch.randn(batch_size, input_dim)
target = torch.randint(0, num_classes, (batch_size,))
loader.append((data, target))
return loader
# Create test loader
def create_test_loader(num_batches=3, batch_size=2, input_dim=4, num_classes=10):
loader = []
for _ in range(num_batches):
data = torch.randn(batch_size, input_dim)
target = torch.randint(0, num_classes, (batch_size,))
loader.append((data, target))
return loader
target_model = TargetModel(num_classes=10)
attack_model = AttackModel()
# Pre-train attack model on dummy data
dummy_X = np.random.randn(20, 10)
dummy_y = np.hstack([np.ones(10), np.zeros(10)]).astype(np.int16)
attack_model.fit(dummy_X, dummy_y)
client_loaders = [create_client_loader(num_batches=2, batch_size=2, input_dim=4, num_classes=10)]
test_loader = create_test_loader(num_batches=3, batch_size=2, input_dim=4, num_classes=10)
fl_params = FL_Params()
ARGS = {
'target_model': target_model,
'attack_model': attack_model,
'client_loaders': client_loaders,
'test_loader': test_loader,
'FL_params': fl_params
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| build |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/UnfoldedSelf-ReconstructionHashing/install.py code served (permissive licence) · get_code("daeac69bbd11aadf") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import subprocess
def build(library, args):
print('Building %s...' % library)
if args is not None and len(args) != 0:
q = ' '.join(['--build-arg ' + x.replace(' ', '\\ ') for x in args])
else:
q = ''
try:
subprocess.check_call('docker build %s --rm -t ann-benchmarks-%s -f install/Dockerfile.%s .' % (q, library, library), shell=True)
return {library: 'success'}
except subprocess.CalledProcessError:
return {library: 'fail'}
ARGS = {
'library': 'faiss',
'args': ['PYTHON_VERSION=3.9', 'BUILD_TYPE=Release']
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| build_multiprocess |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/UnfoldedSelf-ReconstructionHashing/install.py code served (permissive licence) · get_code("b3c0443b6e963126") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import subprocess
def build(library, args):
print('Building %s...' % library)
if args is not None and len(args) != 0:
q = ' '.join(['--build-arg ' + x.replace(' ', '\\ ') for x in args])
else:
q = ''
try:
subprocess.check_call('docker build %s --rm -t ann-benchmarks-%s -f install/Dockerfile.%s .' % (q, library, library), shell=True)
return {library: 'success'}
except subprocess.CalledProcessError:
return {library: 'fail'}
def build_multiprocess(args):
return build(*args)
# Construct valid arguments for build_multiprocess
# The function expects args to be a tuple/list that unpacks to (library, args_list)
# where library is a string and args_list is either None or a list of strings
library_name = "test-library"
build_args = ["VERSION=1.0", "OPTION=enabled"]
ARGS = {
"args": (library_name, build_args)
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| convert_color |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/UnfoldedSelf-ReconstructionHashing/create_website.py code served (permissive licence) · get_code("24ec4bb9c63da4f6") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
torch.manual_seed(0)
ARGS = {
'color': (0.5, 0.3, 0.8, 255)
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| convert_linestyle |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/UnfoldedSelf-ReconstructionHashing/create_website.py code served (permissive licence) · get_code("feb0a5830b75c0f5") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
point_styles = {'o': 'circle', '<': 'triangle', '*': 'star', 'x': 'cross', '+': 'rect'}
def convert_color(color):
r, g, b, a = color
return 'rgba(%(r)d, %(g)d, %(b)d, %(a)d)' % {'r': r * 255, 'g': g * 255, 'b': b * 255, 'a': a}
def convert_linestyle(ls):
new_ls = {}
for algo in ls.keys():
algostyle = ls[algo]
new_ls[algo] = (convert_color(algostyle[0]), convert_color(algostyle[1]), algostyle[2], point_styles[algostyle[3]])
return new_ls
# Build test data
# Each algorithm maps to a tuple of (color1, color2, value, point_style_key)
# Colors are (r, g, b, a) tuples where values are in [0, 1]
ls_value = {
'algorithm_1': ((1.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0), 42, 'o'),
'algorithm_2': ((0.0, 0.0, 1.0, 0.8), (1.0, 1.0, 0.0, 0.5), 99, '<'),
'algorithm_3': ((0.5, 0.5, 0.5, 1.0), (0.2, 0.8, 0.3, 0.9), 15, '*'),
}
ARGS = {
'ls': ls_value,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| get_run_desc |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/UnfoldedSelf-ReconstructionHashing/create_website.py code served (permissive licence) · get_code("239f62264b6ae120") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
ARGS = {
'properties': {
'dataset': 'cifar10',
'count': 42,
'distance': 'euclidean'
}
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| global_train_once |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/FL_base.py code served (permissive licence) · get_code("c905b0a8556ab59d") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import copy
torch.manual_seed(0)
# Define a minimal model that works with the function
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(4, 8)
self.fc2 = nn.Linear(8, 3)
def forward(self, x):
x = torch.relu(self.fc1(x))
x = self.fc2(x)
return x
# Create a minimal global model
global_model = SimpleModel()
# Create client data loaders - list of lists of (data, target) tuples
# 2 clients, each with 2 batches of size 2
client_data_loaders = [
[
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
],
[
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
]
]
# Create test loader
test_loader_data = [
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
(torch.randn(2, 4), torch.randint(0, 3, (2,))),
]
# Create a simple batch_size attribute for test_loader
class SimpleDataLoader:
def __init__(self, data):
self.data = data
self.batch_size = 2
def __iter__(self):
return iter(self.data)
def __len__(self):
return len(self.data)
@property
def dataset(self):
class Dataset:
def __init__(self, data):
self.data = data
def __len__(self):
return sum(len(batch[0]) for batch in self.data)
return Dataset(self.data)
test_loader = SimpleDataLoader(test_loader_data)
# Create FL parameters config
class FLParams:
def __init__(self):
self.N_client = 2
self.local_lr = 0.01
self.local_epoch = 1
self.use_gpu = False
self.cuda_state = False
self.if_retrain = False
self.forget_client_idx = -1
self.if_unlearning = False
self.train_with_test = False
FL_params = FLParams()
ARGS = {
"global_model": global_model,
"client_data_loaders": client_data_loaders,
"test_loader": test_loader,
"FL_params": FL_params,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| model_init |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/model_initiation.py code served (permissive licence) · get_code("2bc0994ff60f7a3b") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Net_mnist. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
ARGS = {
'data_name': 'mnist'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Net_mnist — a Net_mnist output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Net_mnist output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| train_attack_model |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/membership_inference.py code served (permissive licence) · get_code("9ef0b0c0d1702662") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned XGBClassifier. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader, TensorDataset
torch.manual_seed(0)
# Define a minimal shadow model
class ShadowModel(nn.Module):
def __init__(self, num_classes=2):
super().__init__()
self.linear = nn.Linear(4, num_classes)
def forward(self, x):
return self.linear(x)
# Create shadow model
shadow_model = ShadowModel(num_classes=2)
# Create shadow client loaders - list of DataLoaders with small batches
shadow_client_loaders = []
for client_idx in range(2):
# Each client has some training data (member data)
data = torch.randn(6, 4) # 6 samples, 4 features
target = torch.randint(0, 2, (6,))
dataset = TensorDataset(data, target)
loader = DataLoader(dataset, batch_size=2, shuffle=False)
shadow_client_loaders.append(loader)
# Create shadow test loader (non-member data)
test_data = torch.randn(8, 4) # 8 samples, 4 features
test_target = torch.randint(0, 2, (8,))
test_dataset = TensorDataset(test_data, test_target)
shadow_test_loader = DataLoader(test_dataset, batch_size=2, shuffle=False)
# Create FL_params config object
class FLParams:
def __init__(self, data_name='adult'):
self.data_name = data_name
FL_params = FLParams(data_name='adult')
ARGS = {
'shadow_old_GM': shadow_model,
'shadow_client_loaders': shadow_client_loaders,
'shadow_test_loader': shadow_test_loader,
'FL_params': FL_params
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, sklearn, torch, xgboost — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type XGBClassifier — a XGBClassifier output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a XGBClassifier output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| unlearning_step_once |
Ran ran; our contract draft was wrong, not the code |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/Fed_Unlearn_base.py code served (permissive licence) · get_code("730cf027470e46c3") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned SimpleModel. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import copy
torch.manual_seed(0)
class SimpleModel(nn.Module):
def __init__(self, input_dim=4, output_dim=3):
super(SimpleModel, self).__init__()
self.linear1 = nn.Linear(input_dim, 8)
self.linear2 = nn.Linear(8, output_dim)
def forward(self, x):
x = self.linear1(x)
x = self.linear2(x)
return x
# Create global models
global_model_before_forget = SimpleModel(input_dim=4, output_dim=3)
global_model_after_forget = SimpleModel(input_dim=4, output_dim=3)
# Create old and new client models (list of models)
num_clients = 2
old_client_models = [SimpleModel(input_dim=4, output_dim=3) for _ in range(num_clients)]
new_client_models = [SimpleModel(input_dim=4, output_dim=3) for _ in range(num_clients)]
# Initialize models with different weights to simulate training
for model in old_client_models:
for param in model.parameters():
param.data.add_(torch.randn_like(param.data) * 0.1)
for model in new_client_models:
for param in model.parameters():
param.data.add_(torch.randn_like(param.data) * 0.2)
for param in global_model_after_forget.parameters():
param.data.add_(torch.randn_like(param.data) * 0.15)
ARGS = {
'old_client_models': old_client_models,
'new_client_models': new_client_models,
'global_model_before_forget': global_model_before_forget,
'global_model_after_forget': global_model_after_forget
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| data_init |
Not yet run unverified (harvested, no recorded run) |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/data_preprocess.py code served (permissive licence) · get_code("9504250a853f1b04") How it ran |
| data_init_with_shadow |
Not yet run unverified (harvested, no recorded run) |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/data_preprocess.py code served (permissive licence) · get_code("0fbd15b487791f46") How it ran |
| data_set |
Not yet run unverified (harvested, no recorded run) |
tamlhp/awesome-machine-unlearning/algorithms/FedEraser/data_preprocess.py code served (permissive licence) · get_code("e391acb794c3ca41") How it ran |