| DSConv |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("186c4f54da0b3d2f") 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 3, dtype family float, shape (2, 8, 16) 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 DSConv(nn.Module):
def __init__(self, in_ch, out_ch, kernel_size, stride=1, padding=0, dilation=1):
super().__init__()
self.depthwise = nn.Sequential(nn.Conv1d(in_ch, in_ch, kernel_size, stride, padding, dilation=dilation, groups=in_ch, bias=False), nn.BatchNorm1d(in_ch), nn.ReLU6(inplace=True))
self.pointwise = nn.Sequential(nn.Conv1d(in_ch, out_ch, kernel_size=1, bias=False), nn.BatchNorm1d(out_ch), nn.ReLU6(inplace=True))
def forward(self, x):
return self.pointwise(self.depthwise(x))
INIT_ARGS = {
'in_ch': 4,
'out_ch': 8,
'kernel_size': 3,
'stride': 1,
'padding': 1,
'dilation': 1,
}
ARGS = {
'x': torch.randn(2, 4, 16),
}
if __name__ == '__main__':
model = DSConv(**INIT_ARGS)
output = model(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
- 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 3, dtype family float, shape (2, 8, 16) — shape (2, 8, 16) 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)
|
| ECG_Encoder_ResNet |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("de641cdd23a33180") 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, 64) 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 ResBlock(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=5, stride=stride, padding=2, bias=False)
self.bn1 = nn.BatchNorm1d(out_channels)
self.relu = nn.ReLU(inplace=True)
self.conv2 = nn.Conv1d(out_channels, out_channels, kernel_size=5, stride=1, padding=2, bias=False)
self.bn2 = nn.BatchNorm1d(out_channels)
self.downsample = None
if stride != 1 or in_channels != out_channels:
self.downsample = nn.Sequential(nn.Conv1d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False), nn.BatchNorm1d(out_channels))
def forward(self, x):
identity = x
if self.downsample is not None:
identity = self.downsample(x)
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out += identity
out = self.relu(out)
return out
class ECG_Encoder_ResNet(nn.Module):
def __init__(self, output_dim=256):
super(ECG_Encoder_ResNet, self).__init__()
self.conv1 = nn.Conv1d(1, 32, kernel_size=15, stride=2, padding=7, bias=False)
self.bn1 = nn.BatchNorm1d(32)
self.relu = nn.ReLU(inplace=True)
self.maxpool = nn.MaxPool1d(kernel_size=3, stride=2, padding=1)
self.layer1 = self._make_layer(32, 64, blocks=2, stride=2)
self.layer2 = self._make_layer(64, 128, blocks=2, stride=2)
self.layer3 = self._make_layer(128, 256, blocks=2, stride=2)
self.layer4 = self._make_layer(256, 256, blocks=2, stride=2)
self.avgpool = nn.AdaptiveAvgPool1d(1)
self.fc = nn.Linear(256, output_dim)
def _make_layer(self, in_channels, out_channels, blocks, stride):
layers = []
layers.append(ResBlock(in_channels, out_channels, stride))
for _ in range(1, blocks):
layers.append(ResBlock(out_channels, out_channels, stride=1))
return nn.Sequential(*layers)
def forward(self, x):
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
x = self.maxpool(x)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
x = self.avgpool(x)
x = torch.flatten(x, 1)
x = self.fc(x)
return x
INIT_ARGS = {
'output_dim': 64
}
ARGS = {
'x': torch.randn(2, 1, 512)
}
if __name__ == '__main__':
model = ECG_Encoder_ResNet(**INIT_ARGS)
model.eval()
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, 64) — shape (2, 64) 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)
|
| EnvelopeBranch |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("300163b9306e2fa8") 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 3, dtype family float, shape (2, 4, 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
class EnvelopeBranch(nn.Module):
def __init__(self, stride=2):
super().__init__()
self.pool = nn.AvgPool1d(kernel_size=5, stride=stride, padding=2)
def forward(self, x):
return self.pool(torch.abs(x))
INIT_ARGS = {
'stride': 2
}
ARGS = {
'x': torch.randn(2, 4, 16)
}
if __name__ == '__main__':
module = EnvelopeBranch(**INIT_ARGS)
output = module(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
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 3, dtype family float, shape (2, 4, 8) — shape (2, 4, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| HybridEffNetEncoder |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("b1dfbc030b5b1b30") 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; 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 collections import OrderedDict
INIT_ARGS = {
'in_channel': 1,
'depth': [1, 1],
'channels': [4, 6, 8],
'expansion': 2
}
# Create input tensor with shape (batch=2, in_channel=1, feature_dim=16)
input_tensor = torch.randn(2, 1, 16)
ARGS = {
'x': input_tensor
}
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, 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 — 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)
|
| MBConv |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("e94a071c89ce6097") 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 3, dtype family float, shape (2, 8, 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
from collections import OrderedDict
class Bottleneck(nn.Module):
def __init__(self, in_channel, out_channel, expansion, activation, stride=1, padding=1):
super().__init__()
self.stride = stride
hidden_dim = in_channel * expansion
self.conv1 = nn.Conv1d(in_channel, hidden_dim, kernel_size=1, bias=False)
self.b0 = nn.BatchNorm1d(hidden_dim)
self.conv2 = nn.Conv1d(hidden_dim, hidden_dim, kernel_size=3, groups=hidden_dim, padding=padding, stride=stride, bias=False)
self.b1 = nn.BatchNorm1d(hidden_dim)
self.conv3 = nn.Conv1d(hidden_dim, out_channel, kernel_size=1, stride=1, bias=False)
self.b2 = nn.BatchNorm1d(out_channel)
self.d = nn.Dropout(p=0.1)
self.act = activation(inplace=True)
def forward(self, x):
use_res_connect = self.stride == 1 and x.shape[1] == self.conv3.out_channels
y = self.act(self.b0(self.conv1(x)))
y = self.act(self.b1(self.conv2(y)))
y = self.b2(self.conv3(y))
y = self.d(y)
return x + y if use_res_connect else y
class MBConv(nn.Module):
def __init__(self, in_channel, out_channels, expansion, layers, activation=nn.ReLU6, stride=2):
super().__init__()
self.stack = OrderedDict()
self.stack['s0'] = Bottleneck(in_channel, out_channels, expansion, activation, stride=stride)
for i in range(1, layers):
self.stack['s' + str(i)] = Bottleneck(out_channels, out_channels, expansion, activation, stride=1)
self.stack = nn.Sequential(self.stack)
def forward(self, x):
return self.stack(x)
INIT_ARGS = {
'in_channel': 4,
'out_channels': 8,
'expansion': 2,
'layers': 2,
'activation': nn.ReLU6,
'stride': 2,
}
ARGS = {
'x': torch.randn(2, 4, 16),
}
if __name__ == '__main__':
model = MBConv(**INIT_ARGS)
model.eval()
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 3, dtype family float, shape (2, 8, 8) — shape (2, 8, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| MultiScaleEnvelopeStem |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("55ac875449460c73") 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 3, dtype family float, shape (2, 16, 32) 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 DSConv(nn.Module):
def __init__(self, in_ch, out_ch, kernel_size, stride=1, padding=0, dilation=1):
super().__init__()
self.depthwise = nn.Sequential(nn.Conv1d(in_ch, in_ch, kernel_size, stride, padding, dilation=dilation, groups=in_ch, bias=False), nn.BatchNorm1d(in_ch), nn.ReLU6(inplace=True))
self.pointwise = nn.Sequential(nn.Conv1d(in_ch, out_ch, kernel_size=1, bias=False), nn.BatchNorm1d(out_ch), nn.ReLU6(inplace=True))
def forward(self, x):
return self.pointwise(self.depthwise(x))
class EnvelopeBranch(nn.Module):
def __init__(self, stride=2):
super().__init__()
self.pool = nn.AvgPool1d(kernel_size=5, stride=stride, padding=2)
def forward(self, x):
return self.pool(torch.abs(x))
class MultiScaleEnvelopeStem(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
assert out_channels % 4 == 0
branch_c = out_channels // 4
self.branch_high = DSConv(in_channels, branch_c, kernel_size=3, stride=2, padding=1)
self.branch_mid = DSConv(in_channels, branch_c, kernel_size=7, stride=2, padding=3)
self.branch_low = DSConv(in_channels, branch_c, kernel_size=7, stride=2, padding=12, dilation=4)
self.branch_env_pre = EnvelopeBranch(stride=2)
self.branch_env_post = nn.Sequential(nn.Conv1d(in_channels, branch_c, 1, bias=False), nn.BatchNorm1d(branch_c), nn.ReLU6(inplace=True))
self.fusion = nn.Sequential(nn.Conv1d(branch_c * 4, out_channels, kernel_size=1, bias=False), nn.BatchNorm1d(out_channels), nn.ReLU6(inplace=True))
def forward(self, x):
h, m, l, e = (self.branch_high(x), self.branch_mid(x), self.branch_low(x), self.branch_env_post(self.branch_env_pre(x)))
return self.fusion(torch.cat([h, m, l, e], dim=1))
INIT_ARGS = {
'in_channels': 3,
'out_channels': 16,
}
ARGS = {
'x': torch.randn(2, 3, 64),
}
if __name__ == '__main__':
model = MultiScaleEnvelopeStem(**INIT_ARGS)
model.eval()
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Expected shape: (2, 16, 16)")
- 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 3, dtype family float, shape (2, 16, 32) — shape (2, 16, 32) 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)
|
| ResBlock |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("adb9d7776b9364c5") 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 3, dtype family float, shape (2, 4, 16) 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 ResBlock(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=5, stride=stride, padding=2, bias=False)
self.bn1 = nn.BatchNorm1d(out_channels)
self.relu = nn.ReLU(inplace=True)
self.conv2 = nn.Conv1d(out_channels, out_channels, kernel_size=5, stride=1, padding=2, bias=False)
self.bn2 = nn.BatchNorm1d(out_channels)
self.downsample = None
if stride != 1 or in_channels != out_channels:
self.downsample = nn.Sequential(nn.Conv1d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False), nn.BatchNorm1d(out_channels))
def forward(self, x):
identity = x
if self.downsample is not None:
identity = self.downsample(x)
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out += identity
out = self.relu(out)
return out
INIT_ARGS = {
'in_channels': 3,
'out_channels': 4,
'stride': 1
}
ARGS = {
'x': torch.randn(2, 3, 16)
}
if __name__ == '__main__':
model = ResBlock(**INIT_ARGS)
model.eval()
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Expected shape: (2, 4, 16)")
- 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 3, dtype family float, shape (2, 4, 16) — shape (2, 4, 16) 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)
|
| RespBasicBlock |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("4c83191c74f35d99") 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 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 torch
import torch.nn as nn
# INIT_ARGS for RespBasicBlock.__init__(in_channels, out_channels, stride=1)
INIT_ARGS = {
'in_channels': 8,
'out_channels': 12,
'stride': 2
}
# ARGS for forward(x)
# Input shape: (batch_size, in_channels, sequence_length)
ARGS = {
'x': torch.randn(2, 8, 16)
}
- 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 3, 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)
|
| RespBranchEncoder |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("bb1357a8098ad9d1") 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, 256) 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
# Construct the class
class RespBasicBlock(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(RespBasicBlock, self).__init__()
self.resp_conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1, bias=False)
self.resp_bn1 = nn.BatchNorm1d(out_channels)
self.resp_gelu = nn.GELU()
self.resp_conv2 = nn.Conv1d(out_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False)
self.resp_bn2 = nn.BatchNorm1d(out_channels)
self.resp_downsample = None
if stride != 1 or in_channels != out_channels:
self.resp_downsample = nn.Sequential(nn.Conv1d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False), nn.BatchNorm1d(out_channels))
def forward(self, x):
identity = x
out = self.resp_conv1(x)
out = self.resp_bn1(out)
out = self.resp_gelu(out)
out = self.resp_conv2(out)
out = self.resp_bn2(out)
if self.resp_downsample is not None:
identity = self.resp_downsample(x)
out += identity
out = self.resp_gelu(out)
return out
class RespBranchEncoder(nn.Module):
def __init__(self):
super(RespBranchEncoder, self).__init__()
self.resp_stem = nn.Sequential(nn.Conv1d(1, 32, kernel_size=7, stride=2, padding=3, bias=False), nn.BatchNorm1d(32), nn.GELU(), nn.MaxPool1d(kernel_size=3, stride=2, padding=1))
self.resp_layer1 = RespBasicBlock(32, 32, stride=1)
self.resp_layer2 = RespBasicBlock(32, 64, stride=2)
self.resp_layer3 = RespBasicBlock(64, 128, stride=2)
self.resp_layer4 = RespBasicBlock(128, 256, stride=2)
self.resp_avgpool = nn.AdaptiveAvgPool1d(1)
def forward(self, x):
x = self.resp_stem(x)
x = self.resp_layer1(x)
x = self.resp_layer2(x)
x = self.resp_layer3(x)
x = self.resp_layer4(x)
x = self.resp_avgpool(x)
return x.flatten(1)
INIT_ARGS = {}
ARGS = {
'x': torch.randn(2, 1, 256)
}
if __name__ == '__main__':
model = RespBranchEncoder(**INIT_ARGS)
model.eval()
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, 256) — shape (2, 256) 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)
|
| RespTriStreamModel |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("a2fb964d893f99e7") 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, 128) 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 RespBasicBlock(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(RespBasicBlock, self).__init__()
self.resp_conv1 = nn.Conv1d(in_channels, out_channels, kernel_size=3, stride=stride, padding=1, bias=False)
self.resp_bn1 = nn.BatchNorm1d(out_channels)
self.resp_gelu = nn.GELU()
self.resp_conv2 = nn.Conv1d(out_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False)
self.resp_bn2 = nn.BatchNorm1d(out_channels)
self.resp_downsample = None
if stride != 1 or in_channels != out_channels:
self.resp_downsample = nn.Sequential(nn.Conv1d(in_channels, out_channels, kernel_size=1, stride=stride, bias=False), nn.BatchNorm1d(out_channels))
def forward(self, x):
identity = x
out = self.resp_conv1(x)
out = self.resp_bn1(out)
out = self.resp_gelu(out)
out = self.resp_conv2(out)
out = self.resp_bn2(out)
if self.resp_downsample is not None:
identity = self.resp_downsample(x)
out += identity
out = self.resp_gelu(out)
return out
class RespBranchEncoder(nn.Module):
def __init__(self):
super(RespBranchEncoder, self).__init__()
self.resp_stem = nn.Sequential(nn.Conv1d(1, 32, kernel_size=7, stride=2, padding=3, bias=False), nn.BatchNorm1d(32), nn.GELU(), nn.MaxPool1d(kernel_size=3, stride=2, padding=1))
self.resp_layer1 = RespBasicBlock(32, 32, stride=1)
self.resp_layer2 = RespBasicBlock(32, 64, stride=2)
self.resp_layer3 = RespBasicBlock(64, 128, stride=2)
self.resp_layer4 = RespBasicBlock(128, 256, stride=2)
self.resp_avgpool = nn.AdaptiveAvgPool1d(1)
def forward(self, x):
x = self.resp_stem(x)
x = self.resp_layer1(x)
x = self.resp_layer2(x)
x = self.resp_layer3(x)
x = self.resp_layer4(x)
x = self.resp_avgpool(x)
return x.flatten(1)
class RespTriStreamModel(nn.Module):
def __init__(self, output_dim=256):
super(RespTriStreamModel, self).__init__()
self.resp_flow_encoder = RespBranchEncoder()
self.resp_thor_encoder = RespBranchEncoder()
self.resp_abdo_encoder = RespBranchEncoder()
self.resp_projector = nn.Sequential(nn.Linear(768, 512, bias=False), nn.BatchNorm1d(512), nn.GELU(), nn.Dropout(0.2), nn.Linear(512, output_dim, bias=False))
def forward(self, x):
x_flow = x[:, 0:1, :]
x_thor = x[:, 1:2, :]
x_abdo = x[:, 2:3, :]
feat_flow = self.resp_flow_encoder(x_flow)
feat_thor = self.resp_thor_encoder(x_thor)
feat_abdo = self.resp_abdo_encoder(x_abdo)
resp_combined = torch.cat([feat_flow, feat_thor, feat_abdo], dim=1)
resp_out = self.resp_projector(resp_combined)
return resp_out
INIT_ARGS = {
'output_dim': 128
}
ARGS = {
'x': torch.randn(2, 3, 256)
}
- 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, 128) — shape (2, 128) 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)
|
| RoPETransformerLayer |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("196f0de89b434a95") 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 3, dtype family float, shape (2, 3, 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
import torch.nn.functional as F
class RotaryPositionalEmbeddings(nn.Module):
def __init__(self, d_model, max_seq_len=10000):
super().__init__()
inv_freq = 1.0 / 10000 ** (torch.arange(0, d_model, 2).float() / d_model)
self.register_buffer('inv_freq', inv_freq)
def forward(self, x, seq_len=None):
if seq_len is None:
seq_len = x.shape[1]
t = torch.arange(seq_len, device=x.device, dtype=self.inv_freq.dtype)
freqs = torch.einsum('i,j->ij', t, self.inv_freq)
emb = torch.cat((freqs, freqs), dim=-1)
return emb[None, :, :]
def apply_rotary_pos_emb(x, cos, sin):
def rotate_half(x):
x1, x2 = x.chunk(2, dim=-1)
return torch.cat((-x2, x1), dim=-1)
return x * cos + rotate_half(x) * sin
class RoPETransformerLayer(nn.Module):
def __init__(self, d_model, nhead, dim_feedforward=1024, dropout=0.1):
super().__init__()
self.nhead = nhead
self.head_dim = d_model // nhead
self.q_proj = nn.Linear(d_model, d_model)
self.k_proj = nn.Linear(d_model, d_model)
self.v_proj = nn.Linear(d_model, d_model)
self.out_proj = nn.Linear(d_model, d_model)
self.linear1 = nn.Linear(d_model, dim_feedforward)
self.dropout = nn.Dropout(dropout)
self.linear2 = nn.Linear(dim_feedforward, d_model)
self.norm1 = nn.LayerNorm(d_model)
self.norm2 = nn.LayerNorm(d_model)
self.dropout1 = nn.Dropout(dropout)
self.dropout2 = nn.Dropout(dropout)
self.rope = RotaryPositionalEmbeddings(self.head_dim)
def forward(self, src):
B, N, C = src.shape
x = self.norm1(src)
q = self.q_proj(x).view(B, N, self.nhead, self.head_dim).transpose(1, 2)
k = self.k_proj(x).view(B, N, self.nhead, self.head_dim).transpose(1, 2)
v = self.v_proj(x).view(B, N, self.nhead, self.head_dim).transpose(1, 2)
cos_sin = self.rope(v, seq_len=N)
cos, sin = (cos_sin.cos(), cos_sin.sin())
cos, sin = (cos.unsqueeze(1), sin.unsqueeze(1))
q = apply_rotary_pos_emb(q, cos, sin)
k = apply_rotary_pos_emb(k, cos, sin)
attn_output = F.scaled_dot_product_attention(q, k, v)
attn_output = attn_output.transpose(1, 2).contiguous().view(B, N, C)
src = src + self.dropout1(self.out_proj(attn_output))
x = self.norm2(src)
x = self.linear2(self.dropout(F.gelu(self.linear1(x))))
src = src + self.dropout2(x)
return src
INIT_ARGS = {
'd_model': 8,
'nhead': 2,
'dim_feedforward': 16,
'dropout': 0.1
}
ARGS = {
'src': torch.randn(2, 3, 8)
}
if __name__ == '__main__':
model = RoPETransformerLayer(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Expected shape: {ARGS['src'].shape}")
assert output.shape == ARGS['src'].shape, "Output shape mismatch"
print("Success!")
- 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 3, dtype family float, shape (2, 3, 8) — shape (2, 3, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| RotaryPositionalEmbeddings |
Ran ran on a synthesized input |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("3aa1c6232f1025f9") 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 3, dtype family float, shape (1, 5, 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
class RotaryPositionalEmbeddings(nn.Module):
def __init__(self, d_model, max_seq_len=10000):
super().__init__()
inv_freq = 1.0 / 10000 ** (torch.arange(0, d_model, 2).float() / d_model)
self.register_buffer('inv_freq', inv_freq)
def forward(self, x, seq_len=None):
if seq_len is None:
seq_len = x.shape[1]
t = torch.arange(seq_len, device=x.device, dtype=self.inv_freq.dtype)
freqs = torch.einsum('i,j->ij', t, self.inv_freq)
emb = torch.cat((freqs, freqs), dim=-1)
return emb[None, :, :]
INIT_ARGS = {
'd_model': 8,
'max_seq_len': 10000,
}
ARGS = {
'x': torch.randn(2, 5, 8),
'seq_len': None,
}
if __name__ == '__main__':
model = RotaryPositionalEmbeddings(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output:\n{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 3, dtype family float, shape (1, 5, 8) — shape (1, 5, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| apply_rotary_pos_emb |
Ran ran; our contract draft was wrong, not the code |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("0f92704bc4a6e1f6") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 3, dtype family float, shape (2, 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
torch.manual_seed(0)
# Create small tensors for the function
# x: input tensor that will be rotated, shape (batch=2, seq_len=3, dim=4)
x = torch.randn(2, 3, 4)
# cos: cosine positional embedding, same shape as x
cos = torch.randn(2, 3, 4)
# sin: sine positional embedding, same shape as x
sin = torch.randn(2, 3, 4)
ARGS = {
"x": x,
"cos": cos,
"sin": sin,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 3, dtype family float, shape (2, 3, 4) — shape (2, 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
|
| Bottleneck |
Not yet run unverified (harvested, no recorded run) |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("68f38c0292702117") How it ran |
| FiveModalSleepModel |
Not yet run unverified (harvested, no recorded run) |
AutoBrain-sleep/OmniSleep/src/omnisleep/models.py code served (permissive licence) · get_code("d2a198a26c4643fe") How it ran |