| fn_u_dot_v |
Ran ran on a synthesized input |
QipengGuo/CycleGT/g2t_model.py code served (permissive licence) · get_code("314b38325447aa3c") 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 function. 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 small stand-in class for edge_batch
class EdgeBatch:
def __init__(self, src, dst):
self.src = src
self.dst = dst
# Define the node feature dictionaries
# n1 and n2 are keys into edge_batch.src and edge_batch.dst respectively
# n3 is the key for the output dictionary
n1 = "node_features_1"
n2 = "node_features_2"
n3 = "output"
# Create sample tensors for src and dst
# The function does: edge_batch.src[n1].unsqueeze(-2) @ edge_batch.dst[n2].unsqueeze(-1)
# So src[n1] should be shape (batch, feature_dim1) and dst[n2] should be (batch, feature_dim2)
# After unsqueeze(-2) and unsqueeze(-1): (batch, 1, feature_dim1) @ (batch, feature_dim2, 1)
# This requires feature_dim1 == feature_dim2 for matmul, result is (batch, 1, 1)
# Then squeeze(-1).squeeze(-1) gives (batch,)
batch_size = 2
feature_dim = 4
src_dict = {
n1: torch.randn(batch_size, feature_dim)
}
dst_dict = {
n2: torch.randn(batch_size, feature_dim)
}
edge_batch = EdgeBatch(src=src_dict, dst=dst_dict)
ARGS = {
"n1": n1,
"n2": n2,
"n3": n3
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| len2mask |
Ran ran on a synthesized input |
QipengGuo/CycleGT/g2t_model.py code served (permissive licence) · get_code("5c03dd3d31813206") 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 2, dtype family float, shape (3, 5) 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)
ARGS = {
"lens": [3, 5, 2],
"device": torch.device("cpu"),
}
- 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 2, dtype family float, shape (3, 5) — shape (3, 5) 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
|
| pad |
Ran ran on a synthesized input |
QipengGuo/CycleGT/data.py code served (permissive licence) · get_code("8c6d439b6387a0ac") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 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
torch.manual_seed(0)
# Test case 1: list of lists with out_type='list', flatten=False
var_len_list_1 = [
['a', 'b'],
['c', 'd', 'e'],
['f']
]
# Test case 2: list of tensors with out_type='tensor', flatten=False
var_len_list_2 = [
torch.randn(2, 4),
torch.randn(3, 4),
torch.randn(1, 4)
]
# Test case 3: list of lists with out_type='list', flatten=True
var_len_list_3 = [
['x', 'y'],
['z']
]
ARGS = {
'var_len_list': var_len_list_1,
'out_type': 'list',
'flatten': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| replace_ent |
Ran ran on a synthesized input |
QipengGuo/CycleGT/g2t_model.py code served (permissive licence) · get_code("60bbf647af9f6265") 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 2, dtype family float, shape (4, 3) as a later run recorded it. 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, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
# x: tensor of shape (batch_size, ) with integer values
# Some values >= V (which get masked and replaced), some < V
x = torch.tensor([1, 5, 2, 8], dtype=torch.long) # batch_size=4
# V: vocabulary size threshold
V = 4
# emb: embedding layer that maps indices to embeddings
emb = nn.Embedding(num_embeddings=10, embedding_dim=3)
# ent: tensor of shape (batch_size, num_entities) containing entity embeddings
# The function indexes it with [batch_idx, entity_idx]
# mask selects which positions in x are >= V (out-of-vocab)
# For x=[1, 5, 2, 8] with V=4: mask positions 1 and 3 have values >= V
# So we need ent with shape matching the indexing: (batch_size, some_entity_dim)
# The function does: ent[torch.arange(len(idx)).cuda(), idx]
# So ent needs shape (batch_size, max_entity_index)
# Since (x - V) for out-of-vocab gives us indices, and max(x - V) = 8 - 4 = 4
# We need ent to have shape (batch_size, entity_embedding_dim) where entity embeddings match emb output
ent = torch.randn(4, 5, 3) # (batch_size=4, max_entity_idx=5, embedding_dim=3)
ARGS = {
"x": x,
"ent": ent,
"V": V,
"emb": emb,
}
- 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 2, dtype family float, shape (4, 3) — shape (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
|
| scan_data |
Ran ran on a synthesized input |
QipengGuo/CycleGT/data.py code served (permissive licence) · get_code("6dbd77a491f089ee") 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 dict. 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 copy
class Vocab(object):
def __init__(self, max_vocab=2 ** 31, min_freq=-1, sp=['<PAD>', '<BOS>', '<EOS>', '<UNK>', '<ROOT>']):
self.i2s = []
self.s2i = {}
self.wf = {}
self.inv = {}
self.max_vocab, self.min_freq, self.sp = (max_vocab, min_freq, copy.deepcopy(sp))
def __len__(self):
return len(self.i2s)
def __str__(self):
return 'Total ' + str(len(self.i2s)) + str(self.i2s[:10])
def merge(self, _vocab):
self.wf.update(_vocab.wf)
self.inv.update(_vocab.inv)
self.sp = list(set(self.sp + _vocab.sp))
def update(self, token, inv=False, sp=False):
if isinstance(token, list):
for t in token:
self.update(t, inv=inv, sp=sp)
else:
self.wf[token] = self.wf.get(token, 0) + 1
if inv:
self.wf[token + '_INV'] = self.wf.get(token + '_INV', 0) + 1
self.inv[token] = token + '_INV'
if sp and token not in self.sp:
self.sp.append(token)
def get_inv(self, idx):
return self.__call__(self.inv.get(self.i2s[idx], '<UNK>'))
def build(self):
self.i2s.extend(self.sp)
sort_kv = sorted(self.wf.items(), key=lambda x: x[1], reverse=True)
for k, v in sort_kv:
if len(self.i2s) < self.max_vocab and v >= self.min_freq and (k not in self.sp):
self.i2s.append(k)
self.s2i.update(list(zip(self.i2s, range(len(self.i2s)))))
def __call__(self, x, ents=[]):
if isinstance(x, list):
return [self(y) for y in x]
if isinstance(x, int):
if x >= len(self.i2s):
return ents[int(x - len(self.i2s))]
return self.i2s[x]
else:
if x[0] == '<' and x[-1] == '>' and ('_' in x):
try:
t = len(self.s2i) + int(x.split('_')[1][:-1])
except:
print(x)
return len(self.s2i) + int(x.split('_')[1][:-1])
return self.s2i.get(x, self.s2i['<UNK>'])
def scan_data(datas, vocab=None, sp=False):
MF = -1
if vocab is None:
vocab = {'text': Vocab(min_freq=MF), 'entity': Vocab(min_freq=MF), 'relation': Vocab()}
for data in datas:
vocab['text'].update(data['text'].split(), sp=sp)
vocab['entity'].update(sum(data['entities'], []), sp=sp)
vocab['relation'].update([x[1] for x in data['relations']], inv=True)
return vocab
datas = [
{
'text': 'the quick brown fox',
'entities': [['animal'], ['color']],
'relations': [('fox', 'jumps', 'fence'), ('color', 'describes', 'fox')]
},
{
'text': 'a lazy dog sleeps',
'entities': [['animal'], ['state']],
'relations': [('dog', 'is', 'lazy')]
}
]
ARGS = {
'datas': datas,
'vocab': None,
'sp': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
|
| scan_data |
Ran ran on a synthesized input |
krantirk/CycleGT/data.py code served (permissive licence) · get_code("c872d48a4b771716") 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 dict. 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 copy
class Vocab(object):
def __init__(self, max_vocab=2 ** 31, min_freq=-1, sp=['<PAD>', '<BOS>', '<EOS>', '<UNK>', '<ROOT>']):
self.i2s = []
self.s2i = {}
self.wf = {}
self.inv = {}
self.max_vocab, self.min_freq, self.sp = (max_vocab, min_freq, copy.deepcopy(sp))
def __len__(self):
return len(self.i2s)
def __str__(self):
return 'Total ' + str(len(self.i2s)) + str(self.i2s[:10])
def merge(self, _vocab):
self.wf.update(_vocab.wf)
self.inv.update(_vocab.inv)
self.sp = list(set(self.sp + _vocab.sp))
def update(self, token, inv=False, sp=False):
if isinstance(token, list):
for t in token:
self.update(t, inv=inv, sp=sp)
else:
self.wf[token] = self.wf.get(token, 0) + 1
if inv:
self.wf[token + '_INV'] = self.wf.get(token + '_INV', 0) + 1
self.inv[self.wf[token]] = token + '_INV'
if sp and token not in self.sp:
self.sp.append(token)
def get_inv(self, idx):
return self.__call__(self.inv.get(idx, '<UNK>'))
def build(self):
self.i2s.extend(self.sp)
sort_kv = sorted(self.wf.items(), key=lambda x: x[1], reverse=True)
for k, v in sort_kv:
if len(self.i2s) < self.max_vocab and v >= self.min_freq and (k not in self.sp):
self.i2s.append(k)
self.s2i.update(list(zip(self.i2s, range(len(self.i2s)))))
def __call__(self, x, ents=[]):
if isinstance(x, list):
return [self(y) for y in x]
if isinstance(x, int):
if x >= len(self.i2s):
return ents[int(x - len(self.i2s))]
return self.i2s[x]
else:
if x[0] == '<' and x[-1] == '>' and ('_' in x):
try:
t = len(self.s2i) + int(x.split('_')[1][:-1])
except:
print(x)
return len(self.s2i) + int(x.split('_')[1][:-1])
return self.s2i.get(x, self.s2i['<UNK>'])
def scan_data(datas, vocab=None, sp=False):
MF = -1
if vocab is None:
vocab = {'text': Vocab(min_freq=MF), 'entity': Vocab(min_freq=MF), 'relation': Vocab()}
for data in datas:
vocab['text'].update(data['text'].split(), sp=sp)
vocab['entity'].update(sum(data['entities'], []), sp=sp)
vocab['relation'].update([x[1] for x in data['relations']], inv=True)
return vocab
datas = [
{
'text': 'hello world test',
'entities': [['entity1', 'entity2'], ['entity3']],
'relations': [('subj1', 'reltype1', 'obj1'), ('subj2', 'reltype2', 'obj2')]
},
{
'text': 'foo bar baz',
'entities': [['entity4'], ['entity5', 'entity6']],
'relations': [('subj3', 'reltype3', 'obj3')]
}
]
ARGS = {
'datas': datas,
'vocab': None,
'sp': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
|
| write_txt |
Ran ran on a synthesized input |
QipengGuo/CycleGT/data.py code served (permissive licence) · get_code("dc15c58b53be8221") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 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
torch.manual_seed(0)
class TextVocab:
"""Stand-in vocabulary that maps tokens to strings"""
def __init__(self):
self.token_to_word = {
0: '<PAD>',
1: '<BOS>',
2: '<EOS>',
3: 'hello',
4: 'world',
5: 'test',
}
self.word_to_token = {v: k for k, v in self.token_to_word.items()}
def __call__(self, token_or_word):
"""Support both token->word and word->token lookups"""
if isinstance(token_or_word, int):
return self.token_to_word.get(token_or_word, f'<UNK_{token_or_word}>')
else:
return self.word_to_token.get(token_or_word, -1)
def __len__(self):
return len(self.token_to_word)
text_vocab = TextVocab()
batch = {
'raw_ent_text': [
[['entity', 'one'], ['entity', 'two']], # entities for batch 0
[['entity', 'three']], # entities for batch 1
]
}
seqs = [
[1, 3, 4, 2], # <BOS> hello world <EOS>
[1, 5, 6, 2], # <BOS> test entity_ref <EOS>
]
ARGS = {
'batch': batch,
'seqs': seqs,
'text_vocab': text_vocab,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|