| ALMethod |
Ran ran on a synthesized input · constructed an object; no result was computed |
kaist-dmlab/mqnet/methods/mqnet.py code served (permissive licence) · get_code("0258e450b0a384bb") 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 an instance of its own class, ALMethod: the run constructed the object and did not call it, so no result was computed. 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
from torch.utils.data import TensorDataset
torch.manual_seed(0)
# Create a minimal args object with required attributes
class Args:
def __init__(self):
self.n_class = 3
args = Args()
# Create a minimal model - just needs to be an nn.Module
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 3)
def forward(self, x):
return self.linear(x)
models = [SimpleModel()]
# Create an unlabeled dataset
# TensorDataset requires tensors of matching first dimension
X_unlabeled = torch.randn(10, 4) # 10 samples, 4 features
y_unlabeled = torch.randint(0, 3, (10,)) # 10 labels
unlabeled_dst = TensorDataset(X_unlabeled, y_unlabeled)
# Create indices for unlabeled set (selecting first 6 samples)
U_index = [0, 1, 2, 3, 4, 5]
ARGS = {
'args': args,
'models': models,
'unlabeled_dst': unlabeled_dst,
'U_index': U_index
}
- 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 ALMethod — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ALMethod 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
|
| LearningLoss |
Ran ran on a synthesized input |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("c5b6fc55cabeb153") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 1, dtype family float; no output shape is stated. The image it ran in was 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
class LearningLoss(nn.Module):
def __init__(self, margin: float=1.0):
super(LearningLoss, self).__init__()
self.margin = margin
def forward(self, outputs, targets):
"""
batch size should be even
but we can't always be satisfied, so we cut our losses and exclude the last sample if it's an odd number.
"""
targets = targets.detach()
if len(outputs) % 2 != 0:
outputs = outputs[:-1]
targets = targets[:-1]
indicate = torch.where(targets[::2] - targets[1::2] > 0, 1, -1)
loss = torch.clamp(-indicate * (outputs[::2] - outputs[1::2]) + self.margin, min=0)
return loss
INIT_ARGS = {
'margin': 1.0
}
ARGS = {
'outputs': torch.randn(4),
'targets': torch.tensor([2.0, 1.0, 3.0, 0.5])
}
if __name__ == '__main__':
model = LearningLoss(**INIT_ARGS)
result = model(**ARGS)
print("Loss output shape:", result.shape)
print("Loss output:", result)
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 1, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
- 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| MQNet |
Ran ran on a synthesized input · constructed an object; no result was computed |
kaist-dmlab/mqnet/methods/mqnet.py code served (permissive licence) · get_code("83ee9eedece61107") 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 an instance of its own class, MQNet: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
torch.manual_seed(0)
np.random.seed(0)
# Define a minimal stand-in for args
class Args:
def __init__(self):
self.n_class = 10
self.subset = 5
self.test_batch_size = 2
self.workers = 0
self.mqnet_mode = 'CONF'
self.n_query = 2
# Create a minimal dataset
class DummyDataset(torch.utils.data.Dataset):
def __init__(self, size=20, feature_dim=4):
self.size = size
self.feature_dim = feature_dim
def __len__(self):
return self.size
def __getitem__(self, idx):
x = torch.randn(self.feature_dim)
y = torch.tensor(idx % 10)
return x, y
# Create minimal model that satisfies how models['mqnet'] is used
class MQNetModel(nn.Module):
def __init__(self, input_dim=2):
super().__init__()
self.fc = nn.Linear(input_dim, 1)
def forward(self, x):
return self.fc(x)
class DummyModel(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(4, 10)
def forward(self, x):
return self.fc(x)
# Define helper functions that are called in select()
def get_labeled_features(args, models, loader):
features = []
for x, y in loader:
features.append(x)
return torch.cat(features, dim=0)
def get_unlabeled_features(args, models, loader):
informativeness = []
features = []
for x, y in loader:
informativeness.append(torch.randn(len(x)))
features.append(x)
informativeness = torch.cat([torch.tensor([iv]) for iv in informativeness], dim=0)
features = torch.cat(features, dim=0)
return informativeness, features, None, None
def get_unlabeled_features_LL(args, models, loader):
informativeness = []
features = []
for x, y in loader:
informativeness.append(torch.randn(len(x)))
features.append(x)
informativeness = torch.cat([torch.tensor([iv]) for iv in informativeness], dim=0)
features = torch.cat(features, dim=0)
return informativeness, features, None, None
def get_CSI_score(args, features_in, features_unlabeled):
return torch.randn(len(features_unlabeled))
def standardize(arr):
if isinstance(arr, torch.Tensor):
arr = arr.numpy()
mean = np.mean(arr)
std = np.std(arr) + 1e-8
standardized = (arr - mean) / std
return torch.tensor(standardized, dtype=torch.float32), mean, std
def construct_meta_input(informativeness, purity):
stack = torch.stack([informativeness, purity], dim=1)
return stack
# Create dataset and indices
unlabeled_dst = DummyDataset(size=20, feature_dim=4)
U_index = list(range(15)) # Unlabeled indices
I_index = list(range(15, 20)) # Labeled indices in subset
# Create models dictionary
models = {
'mqnet': MQNetModel(input_dim=2),
'dummy': DummyModel()
}
# Create args
args = Args()
# Construct ARGS dictionary
ARGS = {
'args': args,
'models': models,
'unlabeled_dst': unlabeled_dst,
'U_index': U_index,
'I_index': I_index,
'cur_cycle': 0
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type MQNet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MQNet 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
|
| MetaDataset |
Ran ran on a synthesized input |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("6534b13cffb5793c") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. 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 numpy as np
from PIL import Image
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
class MetaDataset(Dataset):
def __init__(self, X, X_meta, y, transform):
self.X = X
self.X_meta = X_meta
self.y = y
self.transform = transform
def __len__(self):
return len(self.X)
def __getitem__(self, i):
img = self.X[i]
if isinstance(img, str):
img = Image.open(img).convert('RGB')
else:
img = Image.fromarray(img)
x_i = self.transform(img)
x_meta_i = self.X_meta[i]
y_i = self.y[i]
return (x_i, x_meta_i, y_i)
# Create small test data
X = [np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8) for _ in range(2)]
X_meta = torch.randn(2, 4)
y = torch.tensor([0, 1])
transform = transforms.Compose([
transforms.ToTensor(),
])
INIT_ARGS = {
'X': X,
'X_meta': X_meta,
'y': y,
'transform': transform,
}
ARGS = {
'i': 0,
}
METHOD = '__getitem__'
if __name__ == '__main__':
dataset = MetaDataset(**INIT_ARGS)
result = dataset.__getitem__(**ARGS)
print(f"Result types: {type(result[0])}, {type(result[1])}, {type(result[2])}")
print(f"Result shapes: {result[0].shape}, {result[1].shape}, {result[2]}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- PIL, numpy, torch, torchvision — 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| QueryNet |
Ran ran on a synthesized input |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("1322c5e5fd332ae7") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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
class QueryNet(nn.Module):
def __init__(self, inter_dim: int=64):
super().__init__()
input_size = 2
w1 = torch.rand(input_size, inter_dim, requires_grad=True)
w2 = torch.rand(inter_dim, 1, requires_grad=True)
b1 = torch.rand(inter_dim, requires_grad=True)
b2 = torch.rand(1, requires_grad=True)
self.w1 = torch.nn.parameter.Parameter(w1, requires_grad=True)
self.w2 = torch.nn.parameter.Parameter(w2, requires_grad=True)
self.b1 = torch.nn.parameter.Parameter(b1, requires_grad=True)
self.b2 = torch.nn.parameter.Parameter(b2, requires_grad=True)
def forward(self, x):
out = torch.sigmoid(torch.matmul(x, torch.relu(self.w1)) + self.b1)
out = torch.matmul(out, torch.relu(self.w2)) + self.b2
return out
INIT_ARGS = {
'inter_dim': 8
}
ARGS = {
'x': torch.randn(2, 2)
}
if __name__ == '__main__':
model = QueryNet(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output: {output}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (2, 1) — shape (2, 1) as a later run recorded it
- 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| _create_scheduler |
Ran ran; our contract draft was wrong, not the code |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("949af0a83c093900") 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 CosineAnnealingWarmRestarts. 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
from torch.optim import SGD
torch.manual_seed(0)
# Define a minimal GradualWarmupScheduler class since it's used in the function
class GradualWarmupScheduler:
def __init__(self, optimizer, multiplier, total_epoch, after_scheduler):
self.optimizer = optimizer
self.multiplier = multiplier
self.total_epoch = total_epoch
self.after_scheduler = after_scheduler
# Create a simple model to optimize
model = nn.Linear(4, 2)
# Create an optimizer
optimizer = SGD(model.parameters(), lr=0.01)
# Define arguments for different scheduler types
# Test case 1: cosine_annealing
sched_name = 'cosine_annealing'
epochs = 100
params = {
't_mult': 2,
'eta_min': 0.00001
}
warmup_params = {}
ARGS = {
'sched_name': sched_name,
'optimizer': optimizer,
'epochs': epochs,
'params': params,
'warmup_params': warmup_params
}
- 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 CosineAnnealingWarmRestarts — a CosineAnnealingWarmRestarts output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a CosineAnnealingWarmRestarts 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
|
| create_query_strategy |
Ran ran; our contract draft was wrong, not the code |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("23f4e531c3c048ea") 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 DummyStrategy. 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 numpy as np
from torch.utils.data import Dataset, DataLoader
torch.manual_seed(0)
# Define a minimal model
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(4, 2)
def forward(self, x):
return self.fc(x)
# Define a minimal dataset
class SimpleDataset(Dataset):
def __init__(self, size=10):
self.size = size
self.data = torch.randn(size, 4)
self.labels = torch.randint(0, 2, (size,))
def __len__(self):
return self.size
def __getitem__(self, idx):
return self.data[idx], self.labels[idx]
# Define a minimal transform
class SimpleTransform:
def __call__(self, x):
return x
# Create mock query_strategies module with a dummy strategy class
class DummyStrategy:
def __init__(self, model, n_query, n_subset, is_labeled, dataset, transform,
sampler_name, batch_size, num_workers, steps_per_epoch, use_diverse, **params):
self.model = model
self.n_query = n_query
self.n_subset = n_subset
self.is_labeled = is_labeled
self.dataset = dataset
self.transform = transform
self.sampler_name = sampler_name
self.batch_size = batch_size
self.num_workers = num_workers
self.steps_per_epoch = steps_per_epoch
self.use_diverse = use_diverse
# Mock the query_strategies module
import sys
query_strategies_module = type(sys)('query_strategies')
query_strategies_module.RandomStrategy = DummyStrategy
sys.modules['query_strategies'] = query_strategies_module
# Build arguments
model = SimpleModel()
dataset = SimpleDataset(size=10)
is_labeled = np.array([True, True, False, False, False, True, False, False, True, False])
transform = SimpleTransform()
ARGS = {
'model': model,
'strategy_name': 'RandomStrategy',
'dataset': dataset,
'is_labeled': is_labeled,
'sampler_name': 'RandomSampler',
'transform': transform,
'n_query': 2,
'batch_size': 4,
'num_workers': 0,
'steps_per_epoch': 5,
'n_subset': 3,
'use_diverse': False,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DummyStrategy — a DummyStrategy output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DummyStrategy 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
|
| MQNet |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("3df5ed3b940bf8bd") How it ran |
| MetaLearning |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("31779aac1945ae25") How it ran |
| MetricModel |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("cc81fec9141abeef") How it ran |
| Strategy |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("d8dae434bb97677a") How it ran |
| create_scheduler |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("0a3075a2962b3ed1") How it ran |
| torch_seed |
Not yet run unverified (harvested, no recorded run) |
dsba-lab/openal/query_strategies/mqnet.py code served (permissive licence) · get_code("3340d617a0c960d9") How it ran |