| evaluate_nrmse |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_nrmse.py code served (permissive licence) · get_code("f2e6b6f209b21099") 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
from torch import Tensor
torch.manual_seed(0)
class MockModel(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def run_rollout(self, targets, num_measurements, random=False):
"""
Returns: designs, observations, tokens
"""
batch_size = targets.shape[0]
designs = torch.randn(batch_size, num_measurements, 3)
observations = torch.randn(batch_size, num_measurements, 2)
tokens = torch.randint(0, 10, (batch_size, num_measurements, 5))
return designs, observations, tokens
def make_history(self, tokens):
"""
Takes tokens and returns history representation
"""
batch_size = tokens.shape[0]
history = torch.randn(batch_size, 7)
return history
def sample_posterior(self, history, num_samples=1):
"""
Takes history and returns posterior samples
"""
batch_size = history.shape[0]
preds = torch.randn(batch_size, num_samples, 4)
return preds
model = MockModel()
targets = torch.randn(2, 4)
ARGS = {
"model": model,
"targets": targets,
"num_measurements": 10,
"num_samples": 1,
"random": False,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, torchmetrics — 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
|
| evaluate_spce |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_lf_spce.py code served (permissive licence) · get_code("c8ab61367c9d29bc") 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 as nn
import math
from dataclasses import dataclass
from typing import Literal, Optional
torch.manual_seed(0)
# Stand-in simulator class
class StandInSimulator(nn.Module):
def __init__(self, dim_design=2, dim_obs=3, k=1, d=4):
super().__init__()
self.dim_design = dim_design
self.dim_obs = dim_obs
self.k = k
self.d = d
def sample_prior(self, n):
"""Sample n parameter vectors from prior"""
return torch.randn(n, self.k, self.d)
def log_like_hist(self, theta, X, Y):
"""
Compute log likelihood history.
theta: (batch, ..., k, d) or (batch, 1, k, d)
X: (batch, T, dim_design)
Y: (batch, T, dim_obs)
Returns: (batch, L) where L is number of theta samples or (batch, 1) for single theta
"""
# Flatten theta to (batch * num_samples, k, d)
if theta.dim() == 4:
batch_size, num_samples, k, d = theta.shape
theta_flat = theta.view(batch_size * num_samples, k, d)
else:
batch_size = theta.shape[0]
num_samples = 1
theta_flat = theta
# Simple dummy log likelihood: sum over observations
batch_actual = X.shape[0]
T = X.shape[1]
# Compute a dummy likelihood value for each theta
ll = torch.randn(batch_actual, num_samples)
return ll
def rollout_measurements(self, theta, T, adaptive):
"""
Generate measurement trajectory.
theta: (batch, k, d)
Returns: locs (dummy), all_tokens list of (batch, T, dim_design + dim_obs)
"""
batch_size = theta.shape[0]
all_tokens = []
for t in range(T):
# Each token is (batch, dim_design + dim_obs)
token = torch.randn(batch_size, self.dim_design + self.dim_obs)
all_tokens.append(token)
locs = None
return locs, all_tokens
# Stand-in model class
class StandInModel(nn.Module):
def __init__(self):
super().__init__()
self.simulator = StandInSimulator(dim_design=2, dim_obs=3, k=1, d=4)
def rollout_measurements(self, theta, T, adaptive):
"""Delegate to simulator"""
return self.simulator.rollout_measurements(theta, T, adaptive)
@dataclass
class EvalCfg:
T: int = 30
L: int = 512
runs: int = 200
policy: Literal['random', 'model'] = 'random'
seed: Optional[int] = 123
chunk: int = 65536
batch_size: int = 1
n_rand_xi: int = 128
# Create instances
model = StandInModel()
cfg = EvalCfg(
T=5,
L=8,
runs=2,
policy='random',
seed=123,
chunk=65536,
batch_size=1,
n_rand_xi=128
)
ARGS = {
'model': model,
'cfg': cfg
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, tqdm — 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
|
| evaluate_spce_stepwise |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_lf_spce.py code served (permissive licence) · get_code("5e1d7c710d13972d") 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 as nn
import math
torch.manual_seed(0)
class MockSimulator(nn.Module):
def __init__(self):
super().__init__()
self.dim_design = 2
self.dim_obs = 3
self.k = 4
self.d = 5
def sample_prior(self, n):
return torch.randn(n, self.k, self.d)
def log_like_hist(self, theta, X, Y):
if theta.dim() == 3:
batch_size = theta.shape[0]
return torch.randn(batch_size, 1)
else:
batch_size = theta.shape[0]
L = theta.shape[1]
return torch.randn(batch_size, L)
class MockModel(nn.Module):
def __init__(self):
super().__init__()
self.simulator = MockSimulator()
self.dim_design = 2
self.dim_obs = 3
def rollout_measurements(self, theta0, T, adaptive):
batch_size = theta0.shape[0]
locs = [torch.randn(batch_size, 2) for _ in range(T)]
all_tokens = [torch.randn(batch_size, self.dim_design + self.dim_obs) for _ in range(T)]
return locs, all_tokens
model = MockModel()
cfg_dict = {
'T': 5,
'L': 8,
'runs': 2,
'policy': 'random',
'seed': 123,
'chunk': 65536,
'batch_size': 1,
'n_rand_xi': 128,
}
from dataclasses import dataclass
from typing import Literal, Optional
@dataclass
class EvalCfg:
T: int = 30
L: int = 512
runs: int = 200
policy: Literal['random', 'model'] = 'random'
seed: Optional[int] = 123
chunk: int = 65536
batch_size: int = 1
n_rand_xi: int = 128
cfg = EvalCfg(
T=5,
L=8,
runs=2,
policy='random',
seed=123,
chunk=65536,
batch_size=1,
n_rand_xi=128,
)
ARGS = {
'model': model,
'cfg': cfg,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, tqdm — 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
|
| find_experiment_root_from_ckpt |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/callbacks/ckpt_utils_loc_diffusion.py code served (permissive licence) · get_code("5e84a2292e2981ef") 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 PosixPath. 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 tempfile
import os
from pathlib import Path
# Create a temporary directory structure that matches the expected checkpoint layout
tmpdir = tempfile.mkdtemp()
run_name = "test_run_12345"
run_root = Path(tmpdir) / "ckpts" / run_name
run_root.mkdir(parents=True, exist_ok=True)
# Create the periodic subdirectory
periodic_dir = run_root / "periodic"
periodic_dir.mkdir(exist_ok=True)
# Create a marker file to indicate this is a valid run root
(run_root / "RUN").touch()
# Create a checkpoint file in the periodic directory
ckpt_path = periodic_dir / "epoch0123.pt"
ckpt_path.touch()
ARGS = {
"ckpt_path": str(ckpt_path)
}
- 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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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_batched_contrastive_thetas |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_posterior_new_metric_SN.py code served (permissive licence) · get_code("03917098f18c505f") 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, 6, 3, 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 torch
import torch.nn as nn
torch.manual_seed(0)
class SimpleSimulator(nn.Module):
def __init__(self, k, d):
super().__init__()
self.k = k
self.d = d
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.simulator = SimpleSimulator(k=3, d=4)
def forward(self, T, arg2, L, condition=None):
# T: time steps, arg2: unused, L: latent dim, condition: conditioning tensor
# Returns tensor of shape (B, L, K, D)
B = condition.size(0)
K = self.simulator.k
D = self.simulator.d
return torch.randn(B, L, K, D)
class Config:
def __init__(self):
self.T = 5
self.L = 6
# Create instances
model = SimpleModel()
h = torch.randn(2, 7) # B=2, feature dim=7
cfg = Config()
ARGS = {
"model": model,
"h": h,
"cfg": cfg
}
- 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, 6, 3, 4) — shape (2, 6, 3, 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
|
| get_eval_output_dir |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/callbacks/ckpt_utils_loc_diffusion.py code served (permissive licence) · get_code("f97690d198849968") 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 PosixPath. 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 tempfile
from pathlib import Path
import os
# Create a temporary directory structure that mimics a checkpoint hierarchy
tmpdir = tempfile.mkdtemp()
# Create a nested directory structure for checkpoints
run_name = "test_run_123"
ckpt_dir = Path(tmpdir) / "ckpts" / run_name / "periodic"
ckpt_dir.mkdir(parents=True, exist_ok=True)
# Create a RUN marker file at the run root to satisfy find_experiment_root_from_ckpt
run_root = Path(tmpdir) / "ckpts" / run_name
(run_root / "RUN").touch()
# Create a checkpoint file
ckpt_file = ckpt_dir / "epoch0123.pt"
ckpt_file.touch()
# Define the arguments for get_eval_output_dir
ARGS = {
"ckpt_path": str(ckpt_file),
"subdir": "eval_output"
}
- 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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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_history_state_from_tokens |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_posterior_new_metric_SN.py code served (permissive licence) · get_code("e66ebf423f6677c3") 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 2, dtype family float, shape (2, 8) 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)
class MockHistoryEncoder(nn.Module):
def __init__(self, input_dim, output_dim, max_observations):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.max_observations = max_observations
self.linear = nn.Linear(input_dim, output_dim)
def forward(self, seq, lengths):
# seq shape: (B, max_observations, input_dim)
# lengths shape: (B,)
# return shape: (B, max_observations, output_dim)
B, S, D = seq.shape
h_all = self.linear(seq)
return h_all
class MockModel(nn.Module):
def __init__(self, max_observations=5, token_dim=4, hidden_dim=8):
super().__init__()
self.max_observations = max_observations
self.token_dim = token_dim
self.hidden_dim = hidden_dim
self.history_encoder = MockHistoryEncoder(token_dim, hidden_dim, max_observations)
def forward(self, x):
return x
model = MockModel(max_observations=5, token_dim=4, hidden_dim=8)
B = 2
S = 3
all_tokens = [torch.randn(B, 4) for _ in range(S)]
ARGS = {
"model": model,
"all_tokens": all_tokens,
}
- 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 2, dtype family float, shape (2, 8) — shape (2, 8) 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
|
| quantile |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/callbacks/quantile.py code served (permissive licence) · get_code("88c2df5557003a6c") 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 (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 torch
from math import ceil, floor
torch.manual_seed(0)
# Create a small tensor with distinct dimensions for probing
tensor = torch.randn(2, 4)
# Test with different parameter combinations
ARGS = {
'tensor': tensor,
'q': 0.5,
'dim': 0,
'keepdim': False,
'interpolation': 'linear',
'out': None,
}
- 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 (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
|
| spce_gL |
Ran ran; our contract draft was wrong, not the code |
bayesflow-org/JADAI/src/jadai/evaluation/eval_lf_spce.py code served (permissive licence) · get_code("4b15500950b3a939") 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 (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 as nn
torch.manual_seed(0)
class MockSimulator(nn.Module):
def __init__(self, k=2, d=4):
super().__init__()
self.k = k
self.d = d
def log_like_hist(self, theta, X, Y):
# theta shape: (..., k, d) or (batch, k, d)
# X shape: (batch, 3)
# Y shape: (batch, 5)
# Returns shape: (batch, 1) or (batch,)
if theta.dim() == 3:
batch_size = theta.shape[0]
else:
batch_size = theta.shape[0]
return torch.randn(batch_size, 1)
def sample_prior(self, n):
# Returns shape: (n, k, d)
return torch.randn(n, self.k, self.d)
# Create simulator
simulator = MockSimulator(k=2, d=4)
# Create input tensors
batch_size = 2
theta0 = torch.randn(batch_size, simulator.k, simulator.d)
X = torch.randn(batch_size, 3)
Y = torch.randn(batch_size, 5)
L = 3
# Optional: pre-computed contrastive thetas
thetas_contrastive = None
ARGS = {
"simulator": simulator,
"theta0": theta0,
"X": X,
"Y": Y,
"L": L,
"thetas_contrastive": thetas_contrastive,
}
- 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 (2,) — shape (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
|
| init_wandb_and_ckpt_dir |
Not yet run unverified (harvested, no recorded run) |
bayesflow-org/JADAI/src/jadai/callbacks/run_ckpt_periodic_loc_diffusion.py code served (permissive licence) · get_code("3fe1126a69e0f7bb") How it ran |
| resolve_checkpoint |
Not yet run unverified (harvested, no recorded run) |
bayesflow-org/JADAI/src/jadai/callbacks/ckpt_utils_loc_diffusion.py code served (permissive licence) · get_code("e27cab06beb0fdd2") How it ran |