| GRUEncoder |
Ran ran on a synthesized input · constructed an object; no result was computed |
clovaai/FocusSeq2Seq/models.py code served (permissive licence) · get_code("5b9354b55563c25f") 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, GRUEncoder: 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 GRUEncoder(nn.Module):
def __init__(self, word_embed_size=300, answer_position_embed_size=16, ner_embed_size=16, pos_embed_size=16, case_embed_size=16, hidden_size=300, dropout_p=0.2, task='QG'):
super().__init__()
self.task = task
if task == 'QG':
input_size = word_embed_size + answer_position_embed_size + ner_embed_size + pos_embed_size + case_embed_size
else:
input_size = word_embed_size
self.rnn = nn.GRU(input_size=input_size, hidden_size=hidden_size // 2, batch_first=True, num_layers=1, bidirectional=True)
self.hidden_size = hidden_size
self.dropout = nn.Dropout(dropout_p)
if task == 'QG':
self.word_embed = nn.Embedding(100, word_embed_size, padding_idx=0)
self.answer_position_embed = nn.Embedding(50, answer_position_embed_size, padding_idx=0)
self.ner_embed = nn.Embedding(50, ner_embed_size, padding_idx=0)
self.pos_embed = nn.Embedding(50, pos_embed_size, padding_idx=0)
self.case_embed = nn.Embedding(50, case_embed_size, padding_idx=0)
else:
self.word_embed = nn.Embedding(100, word_embed_size, padding_idx=0)
def forward(self, source_WORD_encoding, answer_position_BIO_encoding=None, ner_encoding=None, pos_encoding=None, case_encoding=None, PAD_ID=0):
pad_mask = source_WORD_encoding == PAD_ID
source_len = (~pad_mask).long().sum(dim=1)
source_len_sorted, idx_sorted = torch.sort(source_len, dim=0, descending=True)
_, idx_unsort = torch.sort(idx_sorted, dim=0)
if self.task == 'QG':
source_WORD_encoding = source_WORD_encoding[idx_sorted]
answer_position_BIO_encoding = answer_position_BIO_encoding[idx_sorted]
ner_encoding = ner_encoding[idx_sorted]
pos_encoding = pos_encoding[idx_sorted]
case_encoding = case_encoding[idx_sorted]
word_embedding = self.word_embed(source_WORD_encoding)
answer_position_embedding = self.answer_position_embed(answer_position_BIO_encoding)
ner_embedding = self.ner_embed(ner_encoding)
pos_embedding = self.pos_embed(pos_encoding)
case_embedding = self.case_embed(case_encoding)
enc_input = torch.cat([word_embedding, answer_position_embedding, ner_embedding, pos_embedding, case_embedding], dim=2)
else:
source_WORD_encoding = source_WORD_encoding[idx_sorted]
word_embedding = self.word_embed(source_WORD_encoding)
enc_input = word_embedding
enc_input = self.dropout(enc_input)
enc_input = pack_padded_sequence(enc_input, source_len_sorted, batch_first=True)
enc_outputs, h = self.rnn(enc_input)
enc_outputs, _ = pad_packed_sequence(enc_outputs, batch_first=True)
enc_outputs = enc_outputs[idx_unsort]
h = h.index_select(1, idx_unsort)
return (enc_outputs, h)
model = GRUEncoder(
word_embed_size=32,
answer_position_embed_size=8,
ner_embed_size=8,
pos_embed_size=8,
case_embed_size=8,
hidden_size=64,
dropout_p=0.2,
task='QG'
)
batch_size = 2
seq_len = 4
source_WORD_encoding = torch.randint(1, 50, (batch_size, seq_len))
answer_position_BIO_encoding = torch.randint(0, 30, (batch_size, seq_len))
ner_encoding = torch.randint(0, 30, (batch_size, seq_len))
pos_encoding = torch.randint(0, 30, (batch_size, seq_len))
case_encoding = torch.randint(0, 30, (batch_size, seq_len))
ARGS = {
'word_embed_size': 32,
'answer_position_embed_size': 8,
'ner_embed_size': 8,
'pos_embed_size': 8,
'case_embed_size': 8,
'hidden_size': 64,
'dropout_p': 0.2,
'task': 'QG'
}
- 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 GRUEncoder — 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 GRUEncoder 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
|
| ParallelDecoder |
Ran ran on a synthesized input |
clovaai/FocusSeq2Seq/models.py code served (permissive licence) · get_code("8c86add14c1d23db") 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 torch.nn as nn
# INIT_ARGS for ParallelDecoder.__init__
INIT_ARGS = {
'embed_size': 8,
'enc_hidden_size': 12,
'dec_hidden_size': 10,
'n_mixture': 3,
'threshold': 0.15,
'task': 'QG'
}
# ARGS for ParallelDecoder.forward
B = 2
max_source_len = 5
ARGS = {
'enc_outputs': torch.randn(B, max_source_len, INIT_ARGS['enc_hidden_size']),
's': torch.randn(B, INIT_ARGS['dec_hidden_size']),
'source_WORD_encoding': torch.randint(0, 100, (B, max_source_len)),
'mixture_id': torch.randint(0, INIT_ARGS['n_mixture'], (B,)),
'focus_input': None,
'train': True,
'max_decoding_len': None
}
- 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)
|
| ParallelSelector |
Ran ran on a synthesized input · constructed an object; no result was computed |
clovaai/FocusSeq2Seq/models.py code served (permissive licence) · get_code("fbd0b841504c9ce7") 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, ParallelSelector: 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)
# Define the GRUEncoder class first
class GRUEncoder(nn.Module):
def __init__(self, word_embed_size=300, answer_position_embed_size=16, ner_embed_size=16, pos_embed_size=16, case_embed_size=16, hidden_size=300, dropout_p=0.2, task='QG'):
super().__init__()
self.task = task
if task == 'QG':
input_size = word_embed_size + answer_position_embed_size + ner_embed_size + pos_embed_size + case_embed_size
else:
input_size = word_embed_size
self.rnn = nn.GRU(input_size=input_size, hidden_size=hidden_size // 2, batch_first=True, num_layers=1, bidirectional=True)
self.hidden_size = hidden_size
self.dropout = nn.Dropout(dropout_p)
self.word_embed = nn.Embedding(100, word_embed_size, padding_idx=0)
if task == 'QG':
self.answer_position_embed = nn.Embedding(10, answer_position_embed_size)
self.ner_embed = nn.Embedding(10, ner_embed_size)
self.pos_embed = nn.Embedding(10, pos_embed_size)
self.case_embed = nn.Embedding(10, case_embed_size)
def forward(self, source_WORD_encoding, answer_position_BIO_encoding=None, ner_encoding=None, pos_encoding=None, case_encoding=None, PAD_ID=0):
pad_mask = source_WORD_encoding == PAD_ID
source_len = (~pad_mask).long().sum(dim=1)
source_len_sorted, idx_sorted = torch.sort(source_len, dim=0, descending=True)
_, idx_unsort = torch.sort(idx_sorted, dim=0)
if self.task == 'QG':
source_WORD_encoding = source_WORD_encoding[idx_sorted]
answer_position_BIO_encoding = answer_position_BIO_encoding[idx_sorted]
ner_encoding = ner_encoding[idx_sorted]
pos_encoding = pos_encoding[idx_sorted]
case_encoding = case_encoding[idx_sorted]
word_embedding = self.word_embed(source_WORD_encoding)
answer_position_embedding = self.answer_position_embed(answer_position_BIO_encoding)
ner_embedding = self.ner_embed(ner_encoding)
pos_embedding = self.pos_embed(pos_encoding)
case_embedding = self.case_embed(case_encoding)
enc_input = torch.cat([word_embedding, answer_position_embedding, ner_embedding, pos_embedding, case_embedding], dim=2)
else:
source_WORD_encoding = source_WORD_encoding[idx_sorted]
word_embedding = self.word_embed(source_WORD_encoding)
enc_input = word_embedding
enc_input = self.dropout(enc_input)
enc_input = pack_padded_sequence(enc_input, source_len_sorted, batch_first=True)
enc_outputs, h = self.rnn(enc_input)
enc_outputs, _ = pad_packed_sequence(enc_outputs, batch_first=True)
enc_outputs = enc_outputs[idx_unsort]
h = h.index_select(1, idx_unsort)
return (enc_outputs, h)
# Define ParallelSelector class
class ParallelSelector(nn.Module):
def __init__(self, word_embed_size=300, answer_position_embed_size=16, ner_embed_size=16, pos_embed_size=16, case_embed_size=16, enc_hidden_size=300, dec_hidden_size=300, num_layers=1, dropout_p=0.2, n_mixture=5, task='QG', threshold=0.15):
super().__init__()
self.task = task
self.enc_hidden_size = enc_hidden_size
self.dec_hidden_size = dec_hidden_size
self.n_mixture = n_mixture
self.encoder = GRUEncoder(word_embed_size, answer_position_embed_size, ner_embed_size, pos_embed_size, case_embed_size, enc_hidden_size, task=task)
def forward(self):
pass
# Create arguments for ParallelSelector
ARGS = {
'word_embed_size': 300,
'answer_position_embed_size': 16,
'ner_embed_size': 16,
'pos_embed_size': 16,
'case_embed_size': 16,
'enc_hidden_size': 300,
'dec_hidden_size': 300,
'num_layers': 1,
'dropout_p': 0.2,
'n_mixture': 5,
'task': 'QG',
'threshold': 0.15
}
- 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 ParallelSelector — 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 ParallelSelector 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
|
| repeat |
Ran ran; our contract draft was wrong, not the code |
clovaai/FocusSeq2Seq/models.py code served (permissive licence) · get_code("f0d5ad048814d336") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (6, 4, 3) 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)
# Test case 1: torch.Tensor input
tensor_input = torch.randn(2, 4, 3)
# Test case 2: list input (list of numpy arrays or similar copyable objects)
class CopyableArray:
def __init__(self, data):
self.data = data
def copy(self):
return CopyableArray(self.data.copy())
list_input = [CopyableArray(__import__('numpy').array([1, 2, 3])),
CopyableArray(__import__('numpy').array([4, 5, 6]))]
# K parameter - repetition factor
K = 3
# Define arguments - test with tensor input
ARGS = {
"tensor": tensor_input,
"K": K
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 3, dtype family float, shape (6, 4, 3) — shape (6, 4, 3) 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
|
| FocusSelector |
Not yet run unverified (harvested, no recorded run) |
clovaai/FocusSeq2Seq/models.py code served (permissive licence) · get_code("710c6122db670130") How it ran |