| AttentionLayer |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("20f9e4ff9f91acdd") 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, AttentionLayer: 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
import torch.nn as nn
torch.manual_seed(0)
# Define the AttentionLayer class
class AttentionLayer(nn.Module):
def __init__(self, size: int, level_projection_size: int=0, n_labels=None, n_level: int=1):
"""
The init function
:param args: the input parameters from commandline
:param size: the input size of the layer, it is normally the output size of other DNN models,
such as CNN, RNN
"""
super(AttentionLayer, self).__init__()
self.size = size
self.d_a = size
self.n_labels = n_labels
self.n_level = n_level
self.level_projection_size = level_projection_size
self.linear = nn.Linear(self.size, self.size, bias=False)
self.first_linears = nn.ModuleList([nn.Linear(self.size, self.d_a, bias=False) for _ in range(self.n_level)])
self.second_linears = nn.ModuleList([nn.Linear(self.d_a, self.n_labels[label_lvl], bias=False) for label_lvl in range(self.n_level)])
self.third_linears = nn.ModuleList([nn.Linear(self.size + (self.level_projection_size if label_lvl > 0 else 0), self.n_labels[label_lvl], bias=True) for label_lvl in range(self.n_level)])
self._init_weights(mean=0.0, std=0.03)
def _init_weights(self, mean=0.0, std=0.03) -> None:
"""
Initialise the weights
:param mean:
:param std:
:return: None
"""
for first_linear in self.first_linears:
torch.nn.init.normal(first_linear.weight, mean, std)
if first_linear.bias is not None:
first_linear.bias.data.fill_(0)
for linear in self.second_linears:
torch.nn.init.normal(linear.weight, mean, std)
if linear.bias is not None:
linear.bias.data.fill_(0)
for linear in self.third_linears:
torch.nn.init.normal(linear.weight, mean, std)
def forward(self, x, previous_level_projection=None, label_level=0, masks=None):
"""
:param x: [batch_size x max_len x dim (i.e., self.size)]
:param previous_level_projection: the embeddings for the previous level output
:param label_level: the current label level
:return:
Weighted average output: [batch_size x dim (i.e., self.size)]
Attention weights
"""
weights = torch.nn.functional.tanh(self.first_linears[label_level](x))
att_weights = self.second_linears[label_level](weights)
att_weights = torch.nn.functional.softmax(att_weights, 1).transpose(1, 2)
if len(att_weights.size()) != len(x.size()):
att_weights = att_weights.squeeze()
context_vector = att_weights @ x
batch_size = context_vector.size(0)
if previous_level_projection is not None:
temp = [context_vector, previous_level_projection.repeat(1, self.n_labels[label_level]).view(batch_size, self.n_labels[label_level], -1)]
context_vector = torch.cat(temp, dim=2)
weighted_output = self.third_linears[label_level].weight.mul(context_vector).sum(dim=2).add(self.third_linears[label_level].bias)
return (context_vector, weighted_output, att_weights)
@staticmethod
def l2_matrix_norm(m):
"""
Frobenius norm calculation
:param m: {Variable} ||AAT - I||
:return: regularized value
"""
return torch.sum(torch.sum(torch.sum(m ** 2, 1), 1) ** 0.5)
# Build arguments for instantiation
size = 4
level_projection_size = 3
n_labels = [5, 6]
n_level = 2
ARGS = {
'size': size,
'level_projection_size': level_projection_size,
'n_labels': n_labels,
'n_level': n_level
}
- 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 AttentionLayer — 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 AttentionLayer 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
|
| Biaffine |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("76e45ef6c44759d5") 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, Biaffine: 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)
ARGS = {
"n_x": 4,
"n_y": 3,
"n_out": 2,
"dropout": 0.0,
"scale": 1,
"bias_x": True,
"bias_y": True,
"init": nn.init.zeros_,
}
- 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 Biaffine — 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 Biaffine 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
|
| ClassifierOutputData |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("6d9fe586ae7ef880") 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, ClassifierOutputData: 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
import torch.nn as nn
torch.manual_seed(0)
# Create a simple classifier output tensor
# The classifier_output is expected to be a tensor or array-like object
classifier_output = torch.randn(2, 4)
ARGS = {
"classifier_output": classifier_output
}
- 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 ClassifierOutputData — 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 ClassifierOutputData 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
|
| HiddenData |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("bd4bdc8c3912e008") 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, HiddenData: 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
torch.manual_seed(0)
# Create small tensors for intent and slot hidden states
batch_size = 2
intent_dim = 4
slot_dim = 3
seq_len = 5
# intent_hidden: sentence-level hidden state (batch_size, intent_dim)
intent_hidden = torch.randn(batch_size, intent_dim)
# slot_hidden: token-level hidden state (batch_size, seq_len, slot_dim)
slot_hidden = torch.randn(batch_size, seq_len, slot_dim)
ARGS = {
'intent_hidden': intent_hidden,
'slot_hidden': slot_hidden,
}
- 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 HiddenData — 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 HiddenData 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
|
| HierCoAttention |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("1aea0ea71dc05a0c") 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, HierCoAttention: 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
import torch.nn as nn
torch.manual_seed(0)
# Build valid arguments for HierCoAttention
# The forward method expects:
# - inps: a list of tensors, one per layer
# - Each tensor should be [batch_size, seq_len, dim]
# - dims parameter defines the dimensions of each layer
batch_size = 2
seq_len = 3
# Define distinct dimensions for each layer
dims = [4, 5, 6]
out_dim = 7
dropout_rate = 0.1
# Create input tensors matching the dims
# Each input should be [batch_size, seq_len, dims[i]]
inps = [
torch.randn(batch_size, seq_len, dims[0]),
torch.randn(batch_size, seq_len, dims[1]),
torch.randn(batch_size, seq_len, dims[2])
]
ARGS = {
'dims': dims,
'out_dim': out_dim,
'dropout_rate': dropout_rate
}
- 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 HierCoAttention — 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 HierCoAttention 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
|
| InputData |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("509aa2db2cfdac72") 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, InputData: 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 typing import List
torch.manual_seed(0)
# Create a minimal tokenized data object
class TokenizedData:
def __init__(self, input_ids, attention_mask, token_type_ids=None):
self.input_ids = input_ids
self.attention_mask = attention_mask
self.token_type_ids = token_type_ids
# Create sample tensors
batch_size = 2
seq_length = 4
input_ids = torch.randint(0, 100, (batch_size, seq_length))
attention_mask = torch.ones((batch_size, seq_length))
token_type_ids = torch.zeros((batch_size, seq_length))
tokenized_data = TokenizedData(
input_ids=input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids
)
# Create slot labels (batch_size x seq_length)
slot = torch.randint(0, 5, (batch_size, seq_length))
# Create intent labels (batch_size,)
intent = torch.randint(0, 3, (batch_size,))
# Create inputs list with tokenized_data, slot, and intent
inputs = [tokenized_data, slot, intent]
ARGS = {
'inputs': inputs
}
- 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 InputData — 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 InputData 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
|
| IntentClassifier |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("91a4992b8037340b") 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, IntentClassifier: 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)
ARGS = {
"input_dim": 4,
"num_intent_labels": 3,
"dropout_rate": 0.5,
}
- 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 IntentClassifier — 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 IntentClassifier 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
|
| LSTMEncoder |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("bc60bad9ec5a23e7") 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, LSTMEncoder: 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
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
torch.manual_seed(0)
class LSTMEncoder(nn.Module):
"""
Encoder structure based on bidirectional LSTM.
"""
def __init__(self, embedding_dim, hidden_dim, dropout_rate):
super(LSTMEncoder, self).__init__()
self.__embedding_dim = embedding_dim
self.__hidden_dim = hidden_dim // 2
self.__dropout_rate = dropout_rate
self.__dropout_layer = nn.Dropout(self.__dropout_rate)
self.__lstm_layer = nn.LSTM(input_size=self.__embedding_dim, hidden_size=self.__hidden_dim, batch_first=True, bidirectional=True, dropout=self.__dropout_rate, num_layers=1)
def forward(self, embedded_text, seq_lens):
""" Forward process for LSTM Encoder.
(batch_size, max_sent_len)
-> (batch_size, max_sent_len, word_dim)
-> (batch_size, max_sent_len, hidden_dim)
:param embedded_text: padded and embedded input text.
:param seq_lens: is the length of original input text.
:return: is encoded word hidden vectors.
"""
dropout_text = self.__dropout_layer(embedded_text)
packed_text = pack_padded_sequence(dropout_text, seq_lens.cpu(), batch_first=True, enforce_sorted=False)
lstm_hiddens, _ = self.__lstm_layer(packed_text)
padded_hiddens, _ = pad_packed_sequence(lstm_hiddens, batch_first=True)
return padded_hiddens
# Setup for forward() call
embedded_text = torch.randn(2, 5, 4)
seq_lens = torch.tensor([5, 3])
ARGS = {
"embedding_dim": 4,
"hidden_dim": 8,
"dropout_rate": 0.5,
}
- 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 LSTMEncoder — 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 LSTMEncoder 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
|
| OutputData |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("67e1067f976ff55d") 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, OutputData: 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
import json
import tempfile
import os
class ClassifierOutputData:
"""Classifier output data structure of all classifier components
"""
def __init__(self, classifier_output):
self.classifier_output = classifier_output
self.output_embedding = None
class OutputData:
"""output data class
"""
def __init__(self, intent_ids=None, slot_ids=None):
"""init output data class
if intent_ids is None and slot_ids is None:
this class can be used to save all OutputData in the history by 'merge_output_data(X:OutputData)'
else:
this class can be used to model output management.
Args:
intent_ids (Any, optional): list(Tensor) of intent ids / logits / strings. Defaults to None.
slot_ids (Any, optional): list(Tensor) of slot ids / ids / strings. Defaults to None.
"""
if intent_ids is None and slot_ids is None:
self.intent_ids = []
self.slot_ids = []
else:
if isinstance(intent_ids, ClassifierOutputData):
self.intent_ids = intent_ids.classifier_output
else:
self.intent_ids = intent_ids
if isinstance(slot_ids, ClassifierOutputData):
self.slot_ids = slot_ids.classifier_output
else:
self.slot_ids = slot_ids
def map_output(self, slot_map=None, intent_map=None):
""" map intent or slot ids to intent or slot string.
Args:
slot_map (dict, optional): slot id-to-string map. Defaults to None.
intent_map (dict, optional): intent id-to-string map. Defaults to None.
"""
if self.slot_ids is not None:
if slot_map:
self.slot_ids = [[slot_map[x] if x >= 0 else '#' for x in sid] for sid in self.slot_ids]
if self.intent_ids is not None:
if intent_map:
self.intent_ids = [[intent_map[x] for x in sid] if isinstance(sid, list) else intent_map[sid] for sid in self.intent_ids]
def merge_output_data(self, output: 'OutputData'):
"""merge another OutData object with slot and intent
Args:
output (OutputData): another OutputData object
"""
if output.slot_ids is not None:
self.slot_ids += output.slot_ids
if output.intent_ids is not None:
self.intent_ids += output.intent_ids
def save(self, path: str, original_dataset=None):
""" save all OutputData in the history
Args:
path (str): save dir path
original_dataset(Iterable): original dataset
"""
with open(f'{path}/outputs.jsonl', 'w') as f:
if original_dataset is not None:
for i, s, d in zip(self.intent_ids, self.slot_ids, original_dataset):
f.write(json.dumps({'pred_intent': i, 'pred_slot': s, 'text': d['text'], 'golden_intent': d['intent'], 'golden_slot': d['slot']}, ensure_ascii=False) + '\n')
else:
for i, s in zip(self.intent_ids, self.slot_ids):
f.write(json.dumps({'pred_intent': i, 'pred_slot': s}, ensure_ascii=False) + '\n')
torch.manual_seed(0)
intent_ids_list = [['intent_0', 'intent_1'], ['intent_1']]
slot_ids_list = [[0, 1, 2], [1, 2]]
ARGS = {
'intent_ids': intent_ids_list,
'slot_ids': slot_ids_list
}
- 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 OutputData — 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 OutputData 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
|
| SlotClassifier |
Ran ran on a synthesized input · constructed an object; no result was computed |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("a53ceab9d9206669") 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, SlotClassifier: 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
import torch.nn as nn
torch.manual_seed(0)
# Define the SlotClassifier class
class SlotClassifier(nn.Module):
def __init__(self, input_dim, num_slot_labels, attention_embedding_size=200, dropout_rate=0.0):
super(SlotClassifier, self).__init__()
self.num_slot_labels = num_slot_labels
self.attention_embedding_size = attention_embedding_size
output_dim = self.attention_embedding_size
self.linear_slot = nn.Linear(input_dim, self.attention_embedding_size, bias=False)
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Linear(output_dim, num_slot_labels)
self.tanh = nn.Tanh()
self.relu = nn.LeakyReLU(0.2)
def forward(self, x):
x = self.linear_slot(x)
x = self.relu(x)
x = self.dropout(x)
return (x, self.linear(x))
# Create tiny input tensor: batch size 2, input_dim 4
input_dim = 4
num_slot_labels = 3
attention_embedding_size = 5
dropout_rate = 0.1
x = torch.randn(2, input_dim)
# Define arguments for SlotClassifier
ARGS = {
'input_dim': input_dim,
'num_slot_labels': num_slot_labels,
'attention_embedding_size': attention_embedding_size,
'dropout_rate': dropout_rate
}
- 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 SlotClassifier — 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 SlotClassifier 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
|
| perform_attention |
Ran ran; our contract draft was wrong, not the code |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("61aefcc9ef93024d") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import torch.nn.functional as F
torch.manual_seed(0)
# Create a minimal model with the required attributes and methods
class MinimalAttentionModel(nn.Module):
def __init__(self, n_levels=2):
super().__init__()
self.attention_mode = 'label'
# Create attention method for the model
self.attention_test = nn.Module()
# Create projection_linears for each level
self.projection_linears_test = nn.ModuleList([
nn.Linear(4, 4) for _ in range(n_levels)
])
def __getattr__(self, name):
# Override to handle dynamic attention method calls
if name.startswith('attention_'):
# Return a callable that mimics attention behavior
def attention_fn(all_output, previous_level_projection, label_level=0):
batch_size = all_output.shape[0]
# context_vector: (batch, 4)
context_vector = torch.randn(batch_size, 4)
# weighted_output: (batch, 4)
weighted_output = torch.randn(batch_size, 4)
# attention_weight: (batch, 3)
attention_weight = torch.randn(batch_size, 3)
return context_vector, weighted_output, attention_weight
return attention_fn
else:
return super().__getattr__(name)
model = MinimalAttentionModel(n_levels=2)
# Set the attention_mode explicitly
model.attention_mode = 'label'
# Arguments for perform_attention
ARGS = {
'model': model,
'name': 'test',
'all_output': torch.randn(2, 4), # batch=2, dim=4
'last_output': torch.randn(2, 4), # batch=2, dim=4
'n_labels': 5,
'n_levels': 2
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| MISCADecoderV1 |
Not yet run unverified (harvested, no recorded run) |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("b20b13d50bda8ea3") How it ran |
| init_attention_layer |
Not yet run unverified (harvested, no recorded run) |
LightChen233/OpenSLU/model/decoder/misca_decoder_1.py code served (permissive licence) · get_code("163e9a71242cc549") How it ran |