| evaluate |
Ran ran on a synthesized input |
spotify-research/il-by-rl/d4rl_train.py code served (permissive licence) · get_code("16e011ab8b9dc3a6") 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 float64, ndim 0, 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
import numpy as np
torch.manual_seed(0)
# Create a minimal environment that matches the expected interface
class SimpleEnv:
def __init__(self):
self.obs_dim = 4
self.action_dim = 2
self.step_count = 0
self.max_steps = 5
def reset(self):
self.step_count = 0
return np.random.randn(self.obs_dim).astype(np.float32)
def step(self, action):
self.step_count += 1
obs = np.random.randn(self.obs_dim).astype(np.float32)
reward = float(np.random.randn())
terminated = self.step_count >= self.max_steps
info = {}
return obs, reward, terminated, info
# Create a minimal SAC agent that matches the expected interface
class SimpleSAC(nn.Module):
def __init__(self, obs_dim=4, action_dim=2):
super().__init__()
self.policy = nn.Linear(obs_dim, action_dim)
def act(self, obs_list, deterministic=True):
# obs_list is a list of observations
# Convert to tensor and forward through policy
obs_array = np.array(obs_list, dtype=np.float32)
obs_tensor = torch.from_numpy(obs_array)
with torch.no_grad():
actions = self.policy(obs_tensor)
# Return list of actions (one per observation)
actions_np = actions.numpy()
if actions_np.ndim == 1:
actions_np = actions_np.reshape(1, -1)
return [actions_np[i] for i in range(actions_np.shape[0])]
env = SimpleEnv()
sac = SimpleSAC(obs_dim=4, action_dim=2)
ARGS = {
"env": env,
"sac": sac,
"n_episodes": 2
}
- 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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
- 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
|
| execute |
Ran ran on a synthesized input |
spotify-research/il-by-rl/utils.py code served (permissive licence) · get_code("25bd681eec65f985") 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 int, ndim 0, dtype family int, 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)
def sample_function():
"""A simple callable that returns a value"""
return 42
ARGS = {
"function": sample_function
}
- 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 int, ndim 0, dtype family int, 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_small_dataset |
Ran ran on a synthesized input |
spotify-research/il-by-rl/utils.py code served (permissive licence) · get_code("56439c9c4f8ee150") 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 math
import numpy as np
# Create small numpy arrays for observations and expert actions
np.random.seed(0)
dataset_size = 10
obs_dim = 4
action_dim = 3
# full_obs_t: shape (dataset_size, obs_dim)
full_obs_t = np.random.randn(dataset_size, obs_dim).astype(np.float32)
# full_expert_a_t: shape (dataset_size, action_dim)
full_expert_a_t = np.random.randn(dataset_size, action_dim).astype(np.float32)
ARGS = {
"percent_data": 50,
"dataset_size": dataset_size,
"full_obs_t": full_obs_t,
"full_expert_a_t": full_expert_a_t,
}
- 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 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
|
| make_buffer_next |
Ran ran on a synthesized input |
spotify-research/il-by-rl/train_il_functions.py code served (permissive licence) · get_code("b75128f3d89fb6e7") 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 3, 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 copy
import torch
torch.manual_seed(0)
# The function make_buffer_next takes a buffer parameter
# It uses copy.deepcopy() on it and calls .pop(0) on it
# So buffer needs to be a list-like object that supports pop()
# Create a simple buffer as a list of tensors or dicts
buffer = [
torch.randn(2, 4),
torch.randn(2, 4),
torch.randn(2, 4),
]
ARGS = {
"buffer": buffer,
}
- 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 list, ndim 3, 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
|
| optimization_step |
Ran ran on a synthesized input |
spotify-research/il-by-rl/train_bc_functions.py code served (permissive licence) · get_code("315c8276b87bb7ac") 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 float, 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
import numpy as np
torch.manual_seed(0)
# Define a simple actor model that satisfies the function's requirements
class SimpleActor(nn.Module):
def __init__(self, obs_dim=4, action_dim=3):
super().__init__()
self.fc = nn.Linear(obs_dim, action_dim * 2) # output mean and stdev
def forward(self, obs, deterministic=False, with_log_prob=False, with_stdev=False):
x = self.fc(obs)
mean = x[:, :x.shape[1]//2]
stdev = torch.abs(x[:, x.shape[1]//2:]) + 0.01 # ensure positive
if with_stdev:
return mean, stdev
return mean
# Create model
bc_actor = SimpleActor(obs_dim=4, action_dim=3)
# Parameters
batch_size_bc = 2
small_dataset_size = 5
obs_dim = 4
action_dim = 3
# Create small dataset tensors
smallds_obs_t = torch.randn(small_dataset_size, obs_dim)
smallds_expert_a_t = torch.randn(small_dataset_size, action_dim)
# Create optimizer
optimizer = torch.optim.Adam(bc_actor.parameters(), lr=0.001)
# Create RNG (numpy random)
rng = np.random.RandomState(42)
# Losses list
losses = []
ARGS = {
"bc_actor": bc_actor,
"batch_size_bc": batch_size_bc,
"losses": losses,
"optimizer": optimizer,
"rng": rng,
"small_dataset_size": small_dataset_size,
"smallds_expert_a_t": smallds_expert_a_t,
"smallds_obs_t": smallds_obs_t,
}
- 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 float, 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
|
| update |
Ran ran on a synthesized input |
spotify-research/il-by-rl/d4rl_train.py code served (permissive licence) · get_code("c311e1212eabc873") 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 torch
import torch.nn as nn
import numpy as np
torch.manual_seed(0)
# Define a minimal SAC agent with required methods
class MinimalSAC(nn.Module):
def __init__(self):
super().__init__()
self.critic_net = nn.Linear(8, 1)
self.actor_net = nn.Linear(4, 3)
self.temp_net = nn.Linear(4, 1)
def update_critic(self, obs_ts, act_ts, rew_tp1s, obs_tp1s, ter_tp1s):
# Method is called with lists of observations, actions, rewards, next obs, terminals
return torch.tensor(0.5, dtype=torch.float32)
def update_actor(self, obs_ts):
# Method is called with list of observations
return torch.tensor(0.3, dtype=torch.float32)
def update_temp(self, obs_ts):
# Method is called with list of observations
return torch.tensor(0.1, dtype=torch.float32)
def update_target(self):
# No-op method
pass
# Create a buffer as a list of tuples
# Each element: (obs, action, reward, terminal_flag)
# The function accesses buffer[index] and buffer[index+1]
# buffer[index][0] = obs_t
# buffer[index][1] = action_t
# buffer[index+1][2] = reward_{t+1}
# buffer[index+1][0] = obs_{t+1}
# buffer[index+1][3] = terminal_{t+1}
# buffer[index][3][0] = terminal_t (checked to skip)
buffer = []
for i in range(10):
obs = torch.randn(4, dtype=torch.float32)
action = torch.randn(3, dtype=torch.float32)
reward = torch.tensor(0.5, dtype=torch.float32)
terminal = torch.tensor([False], dtype=torch.bool)
buffer.append((obs, action, reward, terminal))
sac = MinimalSAC()
batch_size = 2
train_actor = True
ARGS = {
'buffer': buffer,
'sac': sac,
'batch_size': batch_size,
'train_actor': train_actor
}
- 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 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
|
| update |
Ran ran on a synthesized input |
spotify-research/il-by-rl/d4rl_train_sqil.py code served (permissive licence) · get_code("52dbc718a25a63ce") 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 torch
import numpy as np
from torch import nn
torch.manual_seed(0)
np.random.seed(0)
# Stand-in SAC agent with required methods
class StandInSAC(nn.Module):
def __init__(self):
super().__init__()
self.fc = nn.Linear(4, 4)
def update_critic(self, obs_ts, act_ts, rew_tp1s, obs_tp1s, ter_tp1s):
return 0.5
def update_actor(self, obs_ts):
return 0.3
def update_temp(self, obs_ts):
return 0.1
def update_target(self):
pass
# Create buffer entries: (obs, act, reward, terminal)
# obs is shape (4,), act is shape (3,), reward is scalar, terminal is array
def create_buffer_entry():
obs = np.random.randn(4).astype(np.float32)
act = np.random.randn(3).astype(np.float32)
reward = np.float32(np.random.randn())
terminal = np.array([False])
return (obs, act, reward, terminal)
# Create buffers with enough entries to sample from
buffer = [create_buffer_entry() for _ in range(100)]
buffer_il = [create_buffer_entry() for _ in range(100)]
# Ensure no terminal states at sampled indices to avoid skipping
for i in range(len(buffer) - 1):
buffer[i] = (buffer[i][0], buffer[i][1], buffer[i][2], np.array([False]))
for i in range(len(buffer_il) - 1):
buffer_il[i] = (buffer_il[i][0], buffer_il[i][1], buffer_il[i][2], np.array([False]))
sac = StandInSAC()
batch_size = 4
ARGS = {
'buffer': buffer,
'buffer_il': buffer_il,
'sac': sac,
'batch_size': batch_size,
'train_actor': True
}
- 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 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
|
| get_binary_reward |
Not yet run unverified (harvested, no recorded run) |
spotify-research/il-by-rl/train_il_functions.py code served (permissive licence) · get_code("58f5a0296ffac801") How it ran |