| BertEmbeddingsEx |
Ran ran on a synthesized input |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("12c02fdc7a3ef516") 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
from transformers.models.bert.modeling_bert import BertConfig
from typing import Optional
# Minimal config for BERT
config = BertConfig(
vocab_size=100,
hidden_size=4,
num_hidden_layers=2,
num_attention_heads=2,
intermediate_size=8,
hidden_act="gelu",
hidden_dropout_prob=0.1,
attention_probs_dropout_prob=0.1,
max_position_embeddings=512,
type_vocab_size=2,
initializer_range=0.02,
layer_norm_eps=1e-12,
pad_token_id=0,
)
INIT_ARGS = {
"config": config,
}
ARGS = {
"input_ids": torch.randint(0, 100, (2, 3), dtype=torch.long),
"token_type_ids": None,
"position_ids": None,
"inputs_embeds": None,
"past_key_values_length": 0,
}
if __name__ == "__main__":
from __main__ import LayerNormEx, BertEmbeddingsEx
# Construct the class
embeddings_ex = BertEmbeddingsEx(**INIT_ARGS)
# Call the forward method
output = embeddings_ex(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output dtype: {output.dtype}")
print("Success!")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- __main__, torch, transformers — 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)
|
| BertIntermediateEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("abc2a5159b60c88e") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertIntermediateEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torch import nn
torch.manual_seed(0)
class Config:
def __init__(self):
self.hidden_size = 4
self.intermediate_size = 8
self.hidden_act = "gelu"
config = Config()
ARGS = {
"config": config
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertIntermediateEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertIntermediateEx 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
|
| BertLMPredictionHeadEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("8f34abe0617b5f97") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertLMPredictionHeadEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
from torch import nn
torch.manual_seed(0)
# Define a minimal config class
class Config:
def __init__(self):
self.hidden_size = 4
self.hidden_act = "gelu" # string activation
self.layer_norm_eps = 1e-12
self.vocab_size = 5
# Create config instance
config = Config()
# Create a small hidden_states tensor
# Shape: (batch_size=2, sequence_length=3, hidden_size=4)
hidden_states = torch.randn(2, 3, 4)
ARGS = {
"config": config
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertLMPredictionHeadEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertLMPredictionHeadEx 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
|
| BertOutputEx |
Ran ran on a synthesized input |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("ba319340870887ba") 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
from torch import nn
CONSTANT_MAX_MASK_VAL = 1.0
class LayerNormEx(torch.nn.LayerNorm):
def forward(self, input_vec, ln_mask, in_growth=False, debug_print=False):
if not in_growth:
assert ln_mask is not None
weighted_mean = torch.mean(input_vec, dim=-1, keepdim=True)
weighted_var = torch.mean(torch.square(input_vec - weighted_mean), dim=-1, keepdim=True)
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
else:
weighted_mean = torch.sum(input_vec * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
weighted_var = torch.sum(torch.square(input_vec - weighted_mean) * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
class BertOutputEx(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = LayerNormEx(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
self.hidden_size = config.hidden_size
self.old_hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.in_grow_dim = False
self.in_grow_input = False
self.grow_mask_vec = None
self.debug_print = False
self.grow_mask_vec = torch.ones(self.hidden_size, dtype=self.dense.weight.dtype, device=self.dense.weight.device)
self.grow_mask_vec[:] = CONSTANT_MAX_MASK_VAL
def set_mask(self, target_dim, val):
if target_dim is not None:
new_mask = torch.ones(target_dim, dtype=self.dense.weight.dtype)
new_mask[self.old_hidden_size:] = val
self.grow_mask_vec = new_mask
self.grow_mask_vec = self.grow_mask_vec.to(self.dense.weight.device)
else:
self.grow_mask_vec[self.old_hidden_size:] = val
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
hidden_states = self.dense(hidden_states)
hidden_states = self.dropout(hidden_states)
hidden_states = self.LayerNorm(hidden_states + input_tensor, self.grow_mask_vec, self.in_grow_dim)
if self.in_grow_dim:
hidden_states = hidden_states * self.grow_mask_vec
return hidden_states
class Config:
def __init__(self):
self.intermediate_size = 6
self.hidden_size = 4
self.layer_norm_eps = 1e-12
self.hidden_dropout_prob = 0.1
INIT_ARGS = {
'config': Config()
}
ARGS = {
'hidden_states': torch.randn(2, 6),
'input_tensor': torch.randn(2, 4)
}
if __name__ == '__main__':
model = BertOutputEx(**INIT_ARGS)
output = model(**ARGS)
print("Output shape:", output.shape)
print("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 — 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)
|
| BertPoolerEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("f76bc6941b23b53c") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertPoolerEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
from torch import nn
torch.manual_seed(0)
class Config:
def __init__(self, hidden_size):
self.hidden_size = hidden_size
config = Config(hidden_size=4)
ARGS = {
'config': config
}
- 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 BertPoolerEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertPoolerEx 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
|
| BertPreTrainingHeadsEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("b3a39bfd6444ea7c") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertPreTrainingHeadsEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
from torch import nn
torch.manual_seed(0)
class Config:
def __init__(self):
self.hidden_size = 4
self.vocab_size = 8
self.hidden_act = "gelu"
self.layer_norm_eps = 1e-12
config = Config()
sequence_output = torch.randn(2, 3, 4)
pooled_output = torch.randn(2, 4)
ARGS = {
"config": config,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertPreTrainingHeadsEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertPreTrainingHeadsEx 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
|
| BertPredictionHeadTransformEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("dcb1a915dcc1578a") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertPredictionHeadTransformEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
from torch import nn
torch.manual_seed(0)
class ConfigStandIn:
def __init__(self):
self.hidden_size = 4
self.hidden_act = "gelu"
self.layer_norm_eps = 1e-12
config = ConfigStandIn()
hidden_states = torch.randn(2, 3, 4)
ARGS = {
"config": config
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertPredictionHeadTransformEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertPredictionHeadTransformEx 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
|
| BertSelfAttentionEx |
Ran ran on a synthesized input · constructed an object; no result was computed |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("dc33918b0246bfa2") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BertSelfAttentionEx: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torch import nn
import math
torch.manual_seed(0)
class MockConfig:
def __init__(self):
self.num_attention_heads = 2
self.hidden_size = 128
self.attention_probs_dropout_prob = 0.1
self.max_position_embeddings = 512
self.position_embedding_type = 'absolute'
self.is_decoder = False
config = MockConfig()
hidden_states = torch.randn(2, 4, 128)
attention_mask = torch.ones(2, 1, 1, 4)
head_mask = None
encoder_hidden_states = None
encoder_attention_mask = None
past_key_value = None
output_attentions = False
ARGS = {
'config': config,
'position_embedding_type': None,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertSelfAttentionEx — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BertSelfAttentionEx 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
|
| BertSelfOutputEx |
Ran ran on a synthesized input |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("f3837d1329cfa0a9") 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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torch import nn
CONSTANT_ATTENTION_HEAD_SIZE = 64
CONSTANT_MAX_MASK_VAL = 1.0
class LayerNormEx(torch.nn.LayerNorm):
def forward(self, input_vec, ln_mask, in_growth=False, debug_print=False):
if not in_growth:
assert ln_mask is not None
weighted_mean = torch.mean(input_vec, dim=-1, keepdim=True)
weighted_var = torch.mean(torch.square(input_vec - weighted_mean), dim=-1, keepdim=True)
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
else:
weighted_mean = torch.sum(input_vec * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
weighted_var = torch.sum(torch.square(input_vec - weighted_mean) * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
class BertSelfOutputEx(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(CONSTANT_ATTENTION_HEAD_SIZE * config.num_attention_heads, config.hidden_size)
self.LayerNorm = LayerNormEx(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
self.in_grow_dim = False
self.in_grow_input = False
self.grow_mask_vec = None
self.hidden_size = config.hidden_size
self.old_hidden_size = config.hidden_size
self.all_head_size = config.hidden_size
self.debug_print = False
self.grow_mask_vec = torch.ones(self.hidden_size, dtype=self.dense.weight.dtype, device=self.dense.weight.device)
self.grow_mask_vec[:] = CONSTANT_MAX_MASK_VAL
def set_mask(self, target_dim, val):
if target_dim is not None:
new_mask = torch.ones(target_dim, dtype=self.dense.weight.dtype)
new_mask[self.old_hidden_size:] = val
self.grow_mask_vec = new_mask
self.grow_mask_vec = self.grow_mask_vec.to(self.dense.weight.device)
else:
self.grow_mask_vec[self.old_hidden_size:] = val
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
if self.debug_print and hidden_states.device == torch.device(type='cuda', index=2):
print('attention output')
print(hidden_states[0][0][:10])
print('attention input')
print(input_tensor[0][0])
hidden_states = self.dense(hidden_states)
hidden_states = self.dropout(hidden_states)
hidden_states = self.LayerNorm(hidden_states + input_tensor, self.grow_mask_vec, self.in_grow_dim)
if self.in_grow_dim:
hidden_states = hidden_states * self.grow_mask_vec
if self.debug_print and hidden_states.device == torch.device(type='cuda', index=2):
print('output of self_output')
print(hidden_states[0][0])
return hidden_states
class Config:
def __init__(self):
self.num_attention_heads = 2
self.hidden_size = 8
self.layer_norm_eps = 1e-12
self.hidden_dropout_prob = 0.1
INIT_ARGS = {
'config': Config()
}
ARGS = {
'hidden_states': torch.randn(2, 3, CONSTANT_ATTENTION_HEAD_SIZE * 2),
'input_tensor': torch.randn(2, 3, 8)
}
if __name__ == '__main__':
model = BertSelfOutputEx(**INIT_ARGS)
output = model(**ARGS)
print("Output shape:", output.shape)
print("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 — 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)
|
| LayerNormEx |
Ran ran on a synthesized input |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("a2517173045b652b") 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
INIT_ARGS = {
'normalized_shape': 4,
'eps': 1e-5,
'elementwise_affine': True,
}
ARGS = {
'input_vec': torch.randn(2, 3, 4),
'ln_mask': torch.ones(2, 3, 4),
'in_growth': False,
'debug_print': False,
}
if __name__ == '__main__':
layer_norm_ex = torch.nn.LayerNorm(**INIT_ARGS)
# Monkey-patch the forward method
original_forward = layer_norm_ex.forward
def new_forward(input_vec, ln_mask, in_growth=False, debug_print=False):
if not in_growth:
assert ln_mask is not None
weighted_mean = torch.mean(input_vec, dim=-1, keepdim=True)
weighted_var = torch.mean(torch.square(input_vec - weighted_mean), dim=-1, keepdim=True)
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + layer_norm_ex.eps)
output = output * layer_norm_ex.weight + layer_norm_ex.bias
return output
else:
weighted_mean = torch.sum(input_vec * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
weighted_var = torch.sum(torch.square(input_vec - weighted_mean) * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + layer_norm_ex.eps)
output = output * layer_norm_ex.weight + layer_norm_ex.bias
return output
layer_norm_ex.forward = new_forward
result = layer_norm_ex(**ARGS)
print("Output shape:", result.shape)
print("Output:", result)
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 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)
|
| count_parameters |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("c03c6d119d2ac973") 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
from accelerate.utils.other import extract_model_from_parallel
torch.manual_seed(0)
class SimpleModel(nn.Module):
def __init__(self):
super().__init__()
self.linear1 = nn.Linear(4, 3)
self.linear2 = nn.Linear(3, 2)
def forward(self, x):
x = self.linear1(x)
x = self.linear2(x)
return x
model = SimpleModel()
ARGS = {
"model": model
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- accelerate, 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
|
| expand_embedding |
Ran ran; our contract draft was wrong, not the code |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("a0b27279fea1a125") 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 Embedding. 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
from torch import nn
torch.manual_seed(0)
# Create a small old embedding to expand
vocab_size = 10
old_in_num = 4
old_embedding = nn.Embedding(vocab_size, old_in_num)
old_embedding.weight.data.normal_(mean=0.0, std=0.02)
# New embedding dimension (larger than old)
new_in_num = 7
# Create a simple args object with required attributes
class Args:
def __init__(self):
pass
args = Args()
ARGS = {
"old_embedding": old_embedding,
"new_in_num": new_in_num,
"vocab_size": vocab_size,
"args": args
}
- 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 Embedding — a Embedding output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Embedding 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
|
| expand_linear |
Ran ran; our contract draft was wrong, not the code |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("8162611121d247e7") 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 Linear. 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
from torch import nn
torch.manual_seed(0)
class LayerNormEx(torch.nn.LayerNorm):
def forward(self, input_vec, ln_mask, in_growth=False, debug_print=False):
if not in_growth:
assert ln_mask is not None
weighted_mean = torch.mean(input_vec, dim=-1, keepdim=True)
weighted_var = torch.mean(torch.square(input_vec - weighted_mean), dim=-1, keepdim=True)
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
else:
weighted_mean = torch.sum(input_vec * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
weighted_var = torch.sum(torch.square(input_vec - weighted_mean) * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
def init_weight_ex(module, initializer_range=0.02, reference_module=None):
if reference_module is not None:
if isinstance(module, nn.Linear):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_b, mean_b = torch.std_mean(reference_module.bias)
std_w, mean_w, std_b, mean_b = (std_w.item(), mean_w.item(), std_b.item(), mean_b.item())
module.weight.data.normal_(mean=mean_w, std=std_w)
if module.bias is not None:
module.bias.data.normal_(mean=mean_b, std=std_b)
elif isinstance(module, nn.Embedding):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_w, mean_w = (std_w.item(), mean_w.item())
module.weight.data.normal_(mean=mean_w, std=std_w)
if module.padding_idx is not None:
module.weight.data[module.padding_idx].zero_()
elif isinstance(module, LayerNormEx):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_b, mean_b = torch.std_mean(reference_module.bias)
std_w, mean_w, std_b, mean_b = (std_w.item(), mean_w.item(), std_b.item(), mean_b.item())
module.bias.data.normal_(mean=mean_b, std=std_b)
module.weight.data.normal_(mean=mean_w, std=std_w)
elif isinstance(module, nn.Linear):
module.weight.data.normal_(mean=0.0, std=initializer_range)
if module.bias is not None:
module.bias.data.zero_()
elif isinstance(module, nn.Embedding):
module.weight.data.normal_(mean=0.0, std=initializer_range)
if module.padding_idx is not None:
module.weight.data[module.padding_idx].zero_()
elif isinstance(module, LayerNormEx) or isinstance(module, torch.nn.LayerNorm):
module.bias.data.zero_()
module.weight.data.fill_(1.0)
def expand_linear(old_linear, new_out_num, new_in_num, args, extra=None):
old_out_num, old_in_num = old_linear.weight.size()
if old_in_num > new_in_num or old_out_num > new_out_num:
raise ValueError('New Linear smaller than old')
has_bias = old_linear.bias is not None
new_linear = nn.Linear(new_in_num, new_out_num, bias=has_bias)
init_weight_ex(new_linear, reference_module=None)
new_linear.weight.data[:old_out_num, :old_in_num] = old_linear.weight.data[:, :]
if has_bias:
new_linear.bias.data[:old_out_num] = old_linear.bias.data[:]
return new_linear
old_linear = nn.Linear(3, 2, bias=True)
old_linear.weight.data.normal_(mean=0.0, std=0.02)
old_linear.bias.data.zero_()
new_out_num = 4
new_in_num = 5
args = {
"initializer_range": 0.02
}
extra_dict = {"key": "value"}
ARGS = {
"old_linear": old_linear,
"new_out_num": new_out_num,
"new_in_num": new_in_num,
"args": args,
"extra": extra_dict
}
- 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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
|
| expand_norm |
Ran ran; our contract draft was wrong, not the code |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("519d9bcfb16dcf6c") 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 LayerNormEx. 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
from torch import nn
torch.manual_seed(0)
class LayerNormEx(torch.nn.LayerNorm):
def forward(self, input_vec, ln_mask, in_growth=False, debug_print=False):
if not in_growth:
assert ln_mask is not None
weighted_mean = torch.mean(input_vec, dim=-1, keepdim=True)
weighted_var = torch.mean(torch.square(input_vec - weighted_mean), dim=-1, keepdim=True)
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
else:
weighted_mean = torch.sum(input_vec * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
weighted_var = torch.sum(torch.square(input_vec - weighted_mean) * ln_mask, dim=-1, keepdim=True) / torch.tensor(torch.sum(ln_mask).item())
output = (input_vec - weighted_mean) / torch.sqrt(weighted_var + self.eps)
output = output * self.weight + self.bias
return output
def init_weight_ex(module, initializer_range=0.02, reference_module=None):
if reference_module is not None:
if isinstance(module, nn.Linear):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_b, mean_b = torch.std_mean(reference_module.bias)
std_w, mean_w, std_b, mean_b = (std_w.item(), mean_w.item(), std_b.item(), mean_b.item())
module.weight.data.normal_(mean=mean_w, std=std_w)
if module.bias is not None:
module.bias.data.normal_(mean=mean_b, std=std_b)
elif isinstance(module, nn.Embedding):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_w, mean_w = (std_w.item(), mean_w.item())
module.weight.data.normal_(mean=mean_w, std=std_w)
if module.padding_idx is not None:
module.weight.data[module.padding_idx].zero_()
elif isinstance(module, LayerNormEx):
std_w, mean_w = torch.std_mean(reference_module.weight)
std_b, mean_b = torch.std_mean(reference_module.bias)
std_w, mean_w, std_b, mean_b = (std_w.item(), mean_w.item(), std_b.item(), mean_b.item())
module.bias.data.normal_(mean=mean_b, std=std_b)
module.weight.data.normal_(mean=mean_w, std=std_w)
elif isinstance(module, nn.Linear):
module.weight.data.normal_(mean=0.0, std=initializer_range)
if module.bias is not None:
module.bias.data.zero_()
elif isinstance(module, nn.Embedding):
module.weight.data.normal_(mean=0.0, std=initializer_range)
if module.padding_idx is not None:
module.weight.data[module.padding_idx].zero_()
elif isinstance(module, LayerNormEx) or isinstance(module, torch.nn.LayerNorm):
module.bias.data.zero_()
module.weight.data.fill_(1.0)
def expand_norm(old_ln, new_out_num, args):
old_out_num = old_ln.weight.size()[0]
if old_out_num >= new_out_num:
raise ValueError('New LN smaller than or equal to old')
new_ln = LayerNormEx(new_out_num, eps=1e-12)
init_weight_ex(new_ln, reference_module=None)
new_ln.weight.data[:old_out_num] = old_ln.weight.data[:]
new_ln.bias.data[:old_out_num] = old_ln.bias.data[:]
return new_ln
old_ln = LayerNormEx(4, eps=1e-12)
init_weight_ex(old_ln, reference_module=None)
args = {}
ARGS = {
"old_ln": old_ln,
"new_out_num": 8,
"args": args
}
- 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 LayerNormEx — a LayerNormEx output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LayerNormEx 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
|
| prepare_eval_per_device |
Ran ran; our contract draft was wrong, not the code |
cofe-ai/msg/run_grow_bert.py code served (permissive licence) · get_code("ee96c6045e2257e2") 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 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
torch.manual_seed(0)
# Create small tensors for MLM predictions (batch_size=2, seq_len=3, vocab_size=4)
mlm_preds = torch.randn(2, 3, 4)
# Create small tensors for NSP predictions (batch_size=2, num_classes=2)
nsp_preds = torch.randn(2, 2)
# Create MLM labels (batch_size=2, seq_len=3) with some -100 values for masking
mlm_labels = torch.tensor([[1, -100, 2], [0, 1, -100]])
# Create NSP labels (batch_size=2)
nsp_labels = torch.tensor([0, 1])
ARGS = {
"mlm_preds": mlm_preds,
"nsp_preds": nsp_preds,
"mlm_labels": mlm_labels,
"nsp_labels": nsp_labels,
}
- 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 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
|
| static_mask_single |
Ran ran; our contract draft was wrong, not the code |
cofe-ai/msg/preprocess_bert_data.py code served (permissive licence) · get_code("681bc51b62ed3855") 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 tuple, ndim 2, dtype family int; 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 numpy as np
class MockTokenizer:
def __init__(self):
self.mask_token_id = 103
self.vocab_size = 30522
def __len__(self):
return self.vocab_size
def get_special_tokens_mask(self, token_ids, already_has_special_tokens=False):
# Return a mask where special tokens (like [CLS], [SEP], [PAD]) are marked as 1
# For this mock, mark positions 0 and len-1 as special tokens
mask = [0] * len(token_ids)
if len(token_ids) > 0:
mask[0] = 1 # [CLS] token
if len(token_ids) > 1:
mask[-1] = 1 # [SEP] token
return mask
# Create example input: a list of token IDs
example = np.array([101, 2054, 2003, 102], dtype=np.int64) # [CLS] what is [SEP]
# Create tokenizer
tokenizer = MockTokenizer()
ARGS = {
"example": example,
"tokenizer": tokenizer
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 2, dtype family int — 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
|
| BertAttentionEx |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("ae85ec1873dd1703") How it ran |
| BertEncoderEx |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("1ccc2565fa59af1d") How it ran |
| BertLayerEx |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("86592733e07a8723") How it ran |
| grow_block |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("c969b61fcdd66216") How it ran |
| grow_dim_intermediate |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("2c3575cfa3435b09") How it ran |
| grow_dim_nsp |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("596cf53dd41ddb02") How it ran |
| grow_dim_output |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("fb20ae8f1b2151e9") How it ran |
| grow_dim_pooler |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("ac46a64ea2608233") How it ran |
| grow_dim_self_att |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("baaac4ac9de4e27a") How it ran |
| grow_dim_self_output |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("88e9fafdee923a80") How it ran |
| grow_dim_transform |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("06fa339e87bd096d") How it ran |
| grow_embedding |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("d1ada439198d07ca") How it ran |
| grow_head_num |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("42d5058f41beae5b") How it ran |
| grow_ops |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("109797f27864fd02") How it ran |
| init_weight_ex |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("ea16063f081619fc") How it ran |
| stack_block |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("18d7d645c49b39b9") How it ran |
| transfer_states |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("ef5ff778ebe66fa5") How it ran |
| vanilla_copy |
Not yet run unverified (harvested, no recorded run) |
cofe-ai/msg/model_ex/grow_ops_v2.py code served (permissive licence) · get_code("8179d1035ab4a2dd") How it ran |