| affine_grid_from_params |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/neural_networks.py code served (permissive licence) · get_code("7ec9e2d90b7f22d9") 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 Tensor, ndim 4, dtype family float, shape (2, 5, 6, 2) 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.functional as F
torch.manual_seed(0)
# theta: shape (B, 3) where B is batch size
# The function expects theta with last dimension = 3
# It uses: theta.size(0), theta.size(-1), theta[:, 0], theta[:, 1], theta[:, 2]
theta = torch.randn(2, 3)
# out_h: output height
out_h = 5
# out_w: output width
out_w = 6
# device: torch device
device = torch.device('cpu')
ARGS = {
'theta': theta,
'out_h': out_h,
'out_w': out_w,
'device': device
}
- 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 Tensor, ndim 4, dtype family float, shape (2, 5, 6, 2) — shape (2, 5, 6, 2) 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: none by the harness; any seed is in the setup block
|
| aggregate_model_data |
Ran ran, honoured the contract we drafted |
daviddebot/PGCM/plot_intervenability.py code served (permissive licence) · get_code("a5416eb3c35d2561") 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 DataFrame. 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 os
import pandas as pd
import tempfile
import shutil
# Create a temporary directory structure with test CSV files
temp_base_dir = tempfile.mkdtemp()
# Create the directory structure for the first path
path1 = os.path.join(temp_base_dir, 'model1')
os.makedirs(os.path.join(path1, 'epoch_final_test'), exist_ok=True)
# Create sample CSV data for path1
df1 = pd.DataFrame({
'nb_interventions': [1, 2, 3],
'c_accuracies': [0.85, 0.90, 0.92],
'y_accuracies': [0.80, 0.88, 0.91]
})
df1.to_csv(os.path.join(path1, 'epoch_final_test', 'intervenability_results.csv'), index=False)
# Create the directory structure for the second path
path2 = os.path.join(temp_base_dir, 'model2')
os.makedirs(os.path.join(path2, 'epoch_final_test'), exist_ok=True)
# Create sample CSV data for path2
df2 = pd.DataFrame({
'nb_interventions': [1, 2, 3],
'c_accuracies': [0.87, 0.89, 0.93],
'y_accuracies': [0.82, 0.87, 0.92]
})
df2.to_csv(os.path.join(path2, 'epoch_final_test', 'intervenability_results.csv'), index=False)
# Define the arguments for aggregate_model_data
ARGS = {
'paths': [path1, path2],
'use_standard_intervention': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
|
| bbox_xywh_to_xyxy |
Ran ran, violated the contract we drafted |
daviddebot/PGCM/datasets/sam_segment.py code served (permissive licence) · get_code("d5e7f5f226d76ff2") 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 ndarray, ndim 1, dtype family float, shape (4,) 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 numpy as np
# The function expects a list [x, y, w, h] representing a bounding box
# in xywh format (x, y position and width, height)
bbox = [10.0, 20.0, 30.0, 40.0]
ARGS = {
"bbox": bbox
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) 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: none by the harness; any seed is in the setup block
|
| build_cub_datasets |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/dataset.py code served (permissive licence) · get_code("62019a62c108f719") 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
import torch.nn.functional as F
from pathlib import Path
import tempfile
import os
torch.manual_seed(0)
# Create a temporary directory to act as dataset_root
temp_dir = tempfile.mkdtemp()
# Create minimal tensor files for train, val, test splits
# Each split has:
# - x: image embeddings (batch_size=2, embedding_dim=4)
# - c: concept annotations (batch_size=2, num_concepts=3)
# - y: labels (batch_size=2, num_classes=5)
num_samples_train = 2
num_samples_val = 2
num_samples_test = 2
num_concepts = 3
embedding_dim = 4
num_classes = 5
# Create train split
train_x = torch.randn(num_samples_train, embedding_dim)
train_c = torch.randint(0, 2, (num_samples_train, num_concepts)).float()
train_y = torch.randint(0, num_classes, (num_samples_train,))
torch.save(train_x, os.path.join(temp_dir, 'train_x.pt'))
torch.save(train_c, os.path.join(temp_dir, 'train_c.pt'))
torch.save(train_y, os.path.join(temp_dir, 'train_y.pt'))
# Create val split
val_x = torch.randn(num_samples_val, embedding_dim)
val_c = torch.randint(0, 2, (num_samples_val, num_concepts)).float()
val_y = torch.randint(0, num_classes, (num_samples_val,))
torch.save(val_x, os.path.join(temp_dir, 'val_x.pt'))
torch.save(val_c, os.path.join(temp_dir, 'val_c.pt'))
torch.save(val_y, os.path.join(temp_dir, 'val_y.pt'))
# Create test split
test_x = torch.randn(num_samples_test, embedding_dim)
test_c = torch.randint(0, 2, (num_samples_test, num_concepts)).float()
test_y = torch.randint(0, num_classes, (num_samples_test,))
torch.save(test_x, os.path.join(temp_dir, 'test_x.pt'))
torch.save(test_c, os.path.join(temp_dir, 'test_c.pt'))
torch.save(test_y, os.path.join(temp_dir, 'test_y.pt'))
ARGS = {
'dataset_root': temp_dir
}
- 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
|
| build_object_filename |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/datasets/sam_segment.py code served (permissive licence) · get_code("6c98a07322c92f4e") 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 = {
'obj': {
'idx': 1,
'size': 'large',
'color': 'red',
'shape': 'cube',
'material': 'metal'
}
}
- 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
|
| calc_segmentation_loss |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/model.py code served (permissive licence) · get_code("d1eeb612f7b2197b") 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 Tensor, ndim 0, dtype family float, shape () 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
torch.manual_seed(0)
# Create small tensors for segmentation loss calculation
# pred_logits: model predictions (logits before sigmoid)
# gt_mask: ground truth binary mask
batch_size = 2
height = 4
width = 3
pred_logits = torch.randn(batch_size, height, width)
gt_mask = torch.randint(0, 2, (batch_size, height, width)).float()
ARGS = {
"pred_logits": pred_logits,
"gt_mask": gt_mask,
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| calc_segmentation_loss |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/pretrain_segmenter.py code served (permissive licence) · get_code("9583b5f7cd306680") 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 Tensor, ndim 0, dtype family float, shape () 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.functional as F
torch.manual_seed(0)
# Create small tensors for segmentation task
# pred_logits: raw model output (logits) for binary segmentation
# Should have shape (batch_size, height, width) or similar
batch_size = 2
height = 4
width = 3
pred_logits = torch.randn(batch_size, height, width)
gt_mask = torch.randint(0, 2, (batch_size, height, width)).float()
ARGS = {
"pred_logits": pred_logits,
"gt_mask": gt_mask,
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| calculate_kl_loss |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/utils.py code served (permissive licence) · get_code("3b0c341b684d7558") 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 Tensor, ndim 0, dtype family float, shape () 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
torch.manual_seed(0)
# The function expects:
# - z_posterior_mean: a tensor with shape (batch_size, latent_dim)
# It uses .pow(2) method
# - z_posterior_logvar: a tensor with shape (batch_size, latent_dim)
# It uses .exp() method
# Both tensors are summed over dim=1 and then mean() is called on the result
batch_size = 2
latent_dim = 4
z_posterior_mean = torch.randn(batch_size, latent_dim)
z_posterior_logvar = torch.randn(batch_size, latent_dim)
ARGS = {
"z_posterior_mean": z_posterior_mean,
"z_posterior_logvar": z_posterior_logvar,
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| collect_all_dataset_data |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/plot_intervenability.py code served (permissive licence) · get_code("bb1afd03629e0b74") 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 os
import tempfile
import pandas as pd
import shutil
# Create temporary directory structure with test CSV files
temp_dir = tempfile.mkdtemp()
def create_test_csv(path, num_rows=5):
"""Create a test CSV file with intervenability results"""
os.makedirs(path, exist_ok=True)
data = {
'nb_interventions': [1, 2, 3, 1, 2],
'c_accuracies': [0.85, 0.90, 0.92, 0.87, 0.89],
'y_accuracies': [0.80, 0.88, 0.91, 0.82, 0.87]
}
df = pd.DataFrame(data)
csv_path = os.path.join(path, 'intervenability_results.csv')
df.to_csv(csv_path, index=False)
return csv_path
def create_standard_intervention_csv(path, num_rows=5):
"""Create a test CSV file with standard intervention results"""
os.makedirs(path, exist_ok=True)
data = {
'nb_interventions': [1, 2, 3, 1, 2],
'c_accuracies': [0.80, 0.85, 0.88, 0.82, 0.86],
'y_accuracies': [0.75, 0.83, 0.87, 0.77, 0.84]
}
df = pd.DataFrame(data)
csv_path = os.path.join(path, 'intervenability_results_standard_pgcm.csv')
df.to_csv(csv_path, index=False)
return csv_path
# Create base paths for different datasets and models
base_path_1 = os.path.join(temp_dir, 'dataset1_seed1')
base_path_2 = os.path.join(temp_dir, 'dataset1_seed2')
base_path_3 = os.path.join(temp_dir, 'dataset2_seed1')
base_path_4 = os.path.join(temp_dir, 'dataset2_pgcm_seed1')
# Create test CSV files
create_test_csv(os.path.join(base_path_1, 'epoch_final_test'))
create_test_csv(os.path.join(base_path_2, 'epoch_final_test'))
create_test_csv(os.path.join(base_path_3, 'epoch_final_test'))
create_standard_intervention_csv(os.path.join(base_path_4, 'epoch_final_test'))
# Define dataset_model_paths structure
dataset_model_paths = {
'dataset1': {
'model_baseline': [base_path_1, base_path_2],
'model_pgcm': [base_path_1],
},
'dataset2': {
'model_baseline': [base_path_3],
'model_pgcm*': [base_path_4],
}
}
ARGS = {
'dataset_model_paths': dataset_model_paths,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — 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
|
| compute_balanced_accuracy_batch |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/utils.py code served (permissive licence) · get_code("41ea1c28833e991c") 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 Tensor, ndim 0, dtype family float, shape () 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
torch.manual_seed(0)
# Create small test tensors for binary classification
# y_true: ground truth labels (0 or 1), shape (batch_size, num_labels)
# y_pred_bin: binary predictions (0 or 1), shape (batch_size, num_labels)
batch_size = 2
num_labels = 4
# Ground truth: 2 samples, 4 labels
y_true = torch.tensor([
[1, 0, 1, 0],
[0, 1, 1, 1]
], dtype=torch.long)
# Binary predictions: 2 samples, 4 labels
y_pred_bin = torch.tensor([
[1, 0, 1, 1],
[0, 1, 0, 1]
], dtype=torch.long)
ARGS = {
'y_true': y_true,
'y_pred_bin': y_pred_bin,
'eps': 1e-10
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| crop_and_center_on_canvas |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/datasets/build_presegmented_clevr.py code served (permissive licence) · get_code("0e31c60805029bf3") 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 Image. 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.
from PIL import Image
import numpy as np
# Create a simple RGB image for testing
img_array = np.random.randint(0, 256, (100, 120, 3), dtype=np.uint8)
img = Image.fromarray(img_array, mode='RGB')
# Define bounding box: [x, y, w, h]
bbox = [10, 15, 50, 40]
# Define target canvas resolution
resolution = 64
ARGS = {
'img': img,
'bbox': bbox,
'resolution': resolution
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
|
| dice_loss |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/model.py code served (permissive licence) · get_code("1d289b2010985269") 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 Tensor, ndim 0, dtype family float, shape () 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
torch.manual_seed(0)
# Create small tensors for dice_loss
# pred_logits: logits from model (will be passed through sigmoid)
# target_mask: binary mask for ground truth
# Both need to be viewable as 1D (flattened)
pred_logits = torch.randn(2, 4, dtype=torch.float32) # batch=2, features=4
target_mask = torch.randint(0, 2, (2, 4), dtype=torch.float32) # binary mask, same shape
smooth = 1.0
ARGS = {
"pred_logits": pred_logits,
"target_mask": target_mask,
"smooth": smooth,
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| dice_loss |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/pretrain_segmenter.py code served (permissive licence) · get_code("88cec5163f22f7e0") 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 Tensor, ndim 0, dtype family float, shape () 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
torch.manual_seed(0)
# Create small tensor arguments for dice_loss function
# pred_logits: logits tensor that will be passed through sigmoid
pred_logits = torch.randn(2, 4)
# target_mask: binary mask tensor with same shape as pred_logits
target_mask = torch.randint(0, 2, (2, 4)).float()
# smooth: smoothing constant (default 1.0)
smooth = 1.0
ARGS = {
"pred_logits": pred_logits,
"target_mask": target_mask,
"smooth": smooth,
}
- 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 Tensor, ndim 0, dtype family float, shape () — shape () 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: none by the harness; any seed is in the setup block
|
| get_concept_balance |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/utils.py code served (permissive licence) · get_code("2e5ed0486069f16d") 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. 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)
# Parameters
DEVICE = 'cpu'
num_concepts = 3
num_objects = 2
# Create a simple data loader
# Each batch is a tuple of (images, masks, concept_labels, other)
# concept_labels shape: (batch_size, num_objects, num_concepts) for 3D case
def create_train_loader(batch_size=2, num_batches=2):
batches = []
for _ in range(num_batches):
# Dummy image tensor
images = torch.randn(batch_size, 3, 32, 32)
# Dummy masks tensor
masks = torch.randint(0, 2, (batch_size, 1, 32, 32))
# Concept labels: 3D tensor (batch_size, num_objects, num_concepts)
concept_labels = torch.randint(0, 2, (batch_size, num_objects, num_concepts), dtype=torch.float32)
# Dummy fourth element
other = torch.randn(batch_size, 4)
batches.append((images, masks, concept_labels, other))
return batches
train_loader = create_train_loader(batch_size=2, num_batches=2)
ARGS = {
'train_loader': train_loader,
'num_concepts': num_concepts,
'num_objects': num_objects,
'DEVICE': DEVICE
}
- 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 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
|
| get_cub_dataloaders |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/datasets/build_cub_embeddings.py code served (permissive licence) · get_code("879f4cd91c2f7a5e") 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. 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 os
import pickle
import tempfile
import torch
from PIL import Image
import numpy as np
torch.manual_seed(0)
# Create a temporary directory structure for the CUB dataset
tmpdir = tempfile.mkdtemp()
data_dir = os.path.join(tmpdir, 'class_attr_data_10')
cub_dir = os.path.join(tmpdir, 'CUB_200_2011')
images_dir = os.path.join(cub_dir, 'images')
os.makedirs(data_dir, exist_ok=True)
os.makedirs(images_dir, exist_ok=True)
# Create dummy images
for i in range(6):
img = Image.new('RGB', (256, 256), color=(73, 109, 137))
img_path = os.path.join(images_dir, f'dummy_{i}.jpg')
img.save(img_path)
# Create pickle files with sample data
train_data = [
{
'img_path': 'CUB_200_2011/images/dummy_0.jpg',
'attribute_label': [1, 0, 1, 0],
'class_label': 0
},
{
'img_path': 'CUB_200_2011/images/dummy_1.jpg',
'attribute_label': [0, 1, 0, 1],
'class_label': 1
}
]
val_data = [
{
'img_path': 'CUB_200_2011/images/dummy_2.jpg',
'attribute_label': [1, 1, 0, 0],
'class_label': 0
},
{
'img_path': 'CUB_200_2011/images/dummy_3.jpg',
'attribute_label': [0, 0, 1, 1],
'class_label': 1
}
]
test_data = [
{
'img_path': 'CUB_200_2011/images/dummy_4.jpg',
'attribute_label': [1, 0, 0, 1],
'class_label': 0
},
{
'img_path': 'CUB_200_2011/images/dummy_5.jpg',
'attribute_label': [0, 1, 1, 0],
'class_label': 1
}
]
with open(os.path.join(data_dir, 'train.pkl'), 'wb') as f:
pickle.dump(train_data, f)
with open(os.path.join(data_dir, 'val.pkl'), 'wb') as f:
pickle.dump(val_data, f)
with open(os.path.join(data_dir, 'test.pkl'), 'wb') as f:
pickle.dump(test_data, f)
ARGS = {
'batch_size': 2,
'cub_data_root': data_dir
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- 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, 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
|
| load_cub_split |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/dataset.py code served (permissive licence) · get_code("8b4e05e5c3ca1e03") 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. 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 os
from pathlib import Path
import tempfile
torch.manual_seed(0)
# Create a temporary directory to hold the test data files
temp_dir = tempfile.mkdtemp()
# Create dummy tensor files that the function will load
batch_size = 2
feature_dim = 4
num_classes = 5
# Create and save tensors for train split
x_train = torch.randn(batch_size, feature_dim)
c_train = torch.randn(batch_size, 3, 2) # 3D tensor to test max(dim=1)
y_train = torch.tensor([0, 1])
torch.save(x_train, Path(temp_dir) / 'train_x.pt')
torch.save(c_train, Path(temp_dir) / 'train_c.pt')
torch.save(y_train, Path(temp_dir) / 'train_y.pt')
# Create and save tensors for val split
x_val = torch.randn(batch_size, feature_dim)
c_val = torch.randn(batch_size, 2) # 2D tensor
y_val = torch.tensor([[1, 0, 0, 0, 0], [0, 1, 0, 0, 0]])
torch.save(x_val, Path(temp_dir) / 'val_x.pt')
torch.save(c_val, Path(temp_dir) / 'val_c.pt')
torch.save(y_val, Path(temp_dir) / 'val_y.pt')
# Create and save tensors for test split
x_test = torch.randn(batch_size, feature_dim)
c_test = torch.randn(batch_size, 2)
y_test = torch.tensor([2, 3])
torch.save(x_test, Path(temp_dir) / 'test_x.pt')
torch.save(c_test, Path(temp_dir) / 'test_c.pt')
torch.save(y_test, Path(temp_dir) / 'test_y.pt')
ARGS = {
'dataset_root': temp_dir,
'split': 'train',
'num_classes': num_classes
}
- 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 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
|
| load_cub_splits |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/dataset.py code served (permissive licence) · get_code("5774828abce829e5") 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 os
import tempfile
from pathlib import Path
import torch
import torch.nn.functional as F
torch.manual_seed(0)
# Create a temporary directory to hold the mock CUB data files
temp_dir = tempfile.mkdtemp()
# Create mock data files for each split
for split in ('train', 'val', 'test'):
# x: small tensor of embeddings
x = torch.randn(2, 4)
torch.save(x, Path(temp_dir) / f'{split}_x.pt')
# c: small tensor of concept activations
c = torch.randn(2, 3, 5) # 3D tensor that will be max-reduced
torch.save(c, Path(temp_dir) / f'{split}_c.pt')
# y: class labels as 1D tensor
y = torch.tensor([0, 1], dtype=torch.long)
torch.save(y, Path(temp_dir) / f'{split}_y.pt')
# Define the arguments for load_cub_splits
ARGS = {
'dataset_root': temp_dir
}
- 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
|
| load_intervenability_data |
Ran ran, honoured the contract we drafted |
daviddebot/PGCM/plot_intervenability.py code served (permissive licence) · get_code("bd44204d0c27a308") 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 DataFrame. 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 os
import pandas as pd
import tempfile
import shutil
# Create a temporary directory structure with the required CSV file
temp_base = tempfile.mkdtemp()
epoch_final_test_dir = os.path.join(temp_base, 'epoch_final_test')
os.makedirs(epoch_final_test_dir, exist_ok=True)
# Create a minimal CSV file for the standard intervention case
csv_path_standard = os.path.join(epoch_final_test_dir, 'intervenability_results_standard_pgcm.csv')
df_standard = pd.DataFrame({
'layer': [0, 1, 2],
'intervention_effect': [0.5, 0.7, 0.3]
})
df_standard.to_csv(csv_path_standard, index=False)
# Create a minimal CSV file for the regular case
csv_path_regular = os.path.join(epoch_final_test_dir, 'intervenability_results.csv')
df_regular = pd.DataFrame({
'layer': [0, 1, 2],
'intervention_effect': [0.6, 0.8, 0.4]
})
df_regular.to_csv(csv_path_regular, index=False)
ARGS = {
'base_path': temp_base,
'use_standard_intervention': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
|
| obj_filename |
Ran ran; our contract draft was wrong, not the code |
daviddebot/PGCM/datasets/build_presegmented_clevr.py code served (permissive licence) · get_code("9d3e673b7aa5676b") 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
import numpy as np
torch.manual_seed(0)
# The function obj_filename expects a dict with keys:
# 'idx', 'size', 'color', 'shape', 'material'
# These are used to construct a filename string
obj = {
'idx': 42,
'size': 'large',
'color': 'red',
'shape': 'cube',
'material': 'metal'
}
ARGS = {
'obj': obj
}
- 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 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
|
| obj_to_concept_vec |
Ran ran, honoured the contract we drafted |
daviddebot/PGCM/datasets/build_presegmented_clevr.py code served (permissive licence) · get_code("b0c25d378bd1ce97") 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 Tensor, ndim 1, dtype family float, shape (15,) 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
torch.manual_seed(0)
# Define the object dictionary with all required attributes
obj = {
'size': 'large',
'color': 'red',
'shape': 'cube',
'material': 'rubber'
}
ARGS = {
'obj': obj
}
- 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 Tensor, ndim 1, dtype family float, shape (15,) — shape (15,) 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: none by the harness; any seed is in the setup block
|
| build_segmenter |
Not yet run unverified (harvested, no recorded run) |
daviddebot/PGCM/neural_networks.py code served (permissive licence) · get_code("6347691bc1348387") How it ran |