| ActionEmbeddings |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("95201a35b73fcc8b") 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, ActionEmbeddings: 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.image_feat_size = 3
self.angle_feat_size = 5
self.hidden_size = 4
self.hidden_dropout_prob = 0.1
config = Config()
# Create tiny tensors for forward pass
batch_size = 2
img_feat = torch.randn(batch_size, config.image_feat_size)
ang_feat = torch.randn(batch_size, config.angle_feat_size)
type_embeddings = torch.randn(batch_size, 1, config.hidden_size)
step_embedding = torch.randn(batch_size, config.hidden_size)
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 ActionEmbeddings — 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 ActionEmbeddings 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
|
| BertAttention |
Ran ran on a synthesized input |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("972bc2726cd67bc8") 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 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 math
from torch import nn
class Config:
def __init__(self):
self.hidden_size = 8
self.num_attention_heads = 2
self.attention_probs_dropout_prob = 0.1
self.hidden_dropout_prob = 0.1
self.layer_norm_eps = 1e-12
self.output_attentions = False
config = Config()
INIT_ARGS = {
'config': config
}
batch_size = 2
seq_length = 5
hidden_size = config.hidden_size
input_tensor = torch.randn(batch_size, seq_length, hidden_size)
attention_mask = torch.zeros(batch_size, 1, 1, seq_length)
ARGS = {
'input_tensor': input_tensor,
'attention_mask': attention_mask,
'head_mask': None,
'future_mask': 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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| BertLMPredictionHead |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("46726083e44b793d") 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, BertLMPredictionHead: 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
import math
torch.manual_seed(0)
def gelu(x):
"""Implementation of the gelu activation function."""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
def swish(x):
return x * torch.sigmoid(x)
ACT2FN = {'gelu': gelu, 'relu': torch.nn.functional.relu, 'swish': swish}
BertLayerNorm = torch.nn.LayerNorm
class BertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super(BertPredictionHeadTransform, self).__init__()
clip_size = 512
self.dense = nn.Linear(config.hidden_size, clip_size)
self.LayerNorm = BertLayerNorm(clip_size, eps=config.layer_norm_eps)
if isinstance(config.hidden_act, str):
self.transform_act_fn = ACT2FN[config.hidden_act]
else:
self.transform_act_fn = config.hidden_act
def forward(self, hidden_states):
hidden_states = self.dense(hidden_states)
hidden_states = self.transform_act_fn(hidden_states)
hidden_states = self.LayerNorm(hidden_states)
return hidden_states
class BertLMPredictionHead(nn.Module):
def __init__(self, config):
super(BertLMPredictionHead, self).__init__()
self.transform = BertPredictionHeadTransform(config)
clip_size = 512
self.decoder = nn.Linear(clip_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.zeros(config.vocab_size))
def forward(self, hidden_states):
hidden_states = self.transform(hidden_states)
hidden_states = self.decoder(hidden_states) + self.bias
return hidden_states
class Config:
def __init__(self):
self.hidden_size = 8
self.vocab_size = 16
self.layer_norm_eps = 1e-12
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 — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertLMPredictionHead — 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 BertLMPredictionHead 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
|
| BertOnlyMLMHead |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("8439e6da38dfae41") 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, BertOnlyMLMHead: 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
import math
torch.manual_seed(0)
def gelu(x):
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
def swish(x):
return x * torch.sigmoid(x)
ACT2FN = {'gelu': gelu, 'relu': torch.nn.functional.relu, 'swish': swish}
BertLayerNorm = torch.nn.LayerNorm
class BertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super(BertPredictionHeadTransform, self).__init__()
clip_size = 512
self.dense = nn.Linear(config.hidden_size, clip_size)
self.LayerNorm = BertLayerNorm(clip_size, eps=config.layer_norm_eps)
if isinstance(config.hidden_act, str):
self.transform_act_fn = ACT2FN[config.hidden_act]
else:
self.transform_act_fn = config.hidden_act
def forward(self, hidden_states):
hidden_states = self.dense(hidden_states)
hidden_states = self.transform_act_fn(hidden_states)
hidden_states = self.LayerNorm(hidden_states)
return hidden_states
class BertLMPredictionHead(nn.Module):
def __init__(self, config):
super(BertLMPredictionHead, self).__init__()
self.transform = BertPredictionHeadTransform(config)
clip_size = 512
self.decoder = nn.Linear(clip_size, config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.zeros(config.vocab_size))
def forward(self, hidden_states):
hidden_states = self.transform(hidden_states)
hidden_states = self.decoder(hidden_states) + self.bias
return hidden_states
class BertOnlyMLMHead(nn.Module):
def __init__(self, config):
super(BertOnlyMLMHead, self).__init__()
self.predictions = BertLMPredictionHead(config)
def forward(self, sequence_output):
prediction_scores = self.predictions(sequence_output)
return prediction_scores
class Config:
def __init__(self):
self.hidden_size = 16
self.vocab_size = 8
self.layer_norm_eps = 1e-12
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 — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertOnlyMLMHead — 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 BertOnlyMLMHead 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
|
| BertPredictionHeadTransform |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("fbfefa916c6de2bb") 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, BertPredictionHeadTransform: 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 import nn as nn_module
torch.manual_seed(0)
class Config:
def __init__(self):
self.hidden_size = 4
self.layer_norm_eps = 1e-12
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 — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type BertPredictionHeadTransform — 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 BertPredictionHeadTransform 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
|
| BertSelfAttention |
Ran ran on a synthesized input |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("a0efcc75e5e7e5de") 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 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 math
import torch
from torch import nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError('The hidden size (%d) is not a multiple of the number of attention heads (%d)' % (config.hidden_size, config.num_attention_heads))
self.output_attentions = config.output_attentions
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = int(config.hidden_size / config.num_attention_heads)
self.all_head_size = self.num_attention_heads * self.attention_head_size
self.query = nn.Linear(config.hidden_size, self.all_head_size)
self.key = nn.Linear(config.hidden_size, self.all_head_size)
self.value = nn.Linear(config.hidden_size, self.all_head_size)
self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
def transpose_for_scores(self, x):
new_x_shape = x.size()[:-1] + (self.num_attention_heads, self.attention_head_size)
x = x.view(*new_x_shape)
return x.permute(0, 2, 1, 3)
def forward(self, hidden_states, attention_mask, head_mask=None, future_mask=None):
mixed_query_layer = self.query(hidden_states)
mixed_key_layer = self.key(hidden_states)
mixed_value_layer = self.value(hidden_states)
query_layer = self.transpose_for_scores(mixed_query_layer)
key_layer = self.transpose_for_scores(mixed_key_layer)
value_layer = self.transpose_for_scores(mixed_value_layer)
attention_scores = torch.matmul(query_layer, key_layer.transpose(-1, -2))
attention_scores = attention_scores / math.sqrt(self.attention_head_size)
attention_scores = attention_scores + attention_mask
if future_mask is not None:
attention_scores = attention_scores.masked_fill(future_mask.unsqueeze(0).unsqueeze(1) != 0, float('-inf'))
attention_probs = nn.Softmax(dim=-1)(attention_scores)
attention_probs = self.dropout(attention_probs)
if head_mask is not None:
attention_probs = attention_probs * head_mask
context_layer = torch.matmul(attention_probs, value_layer)
context_layer = context_layer.permute(0, 2, 1, 3).contiguous()
new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,)
context_layer = context_layer.view(*new_context_layer_shape)
outputs = (context_layer, attention_scores) if self.output_attentions else (context_layer,)
return outputs
class Config:
def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, output_attentions):
self.hidden_size = hidden_size
self.num_attention_heads = num_attention_heads
self.attention_probs_dropout_prob = attention_probs_dropout_prob
self.output_attentions = output_attentions
INIT_ARGS = {
'config': Config(
hidden_size=8,
num_attention_heads=2,
attention_probs_dropout_prob=0.1,
output_attentions=True
)
}
ARGS = {
'hidden_states': torch.randn(2, 3, 8),
'attention_mask': torch.zeros(2, 1, 1, 3),
'head_mask': None,
'future_mask': 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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| InputSelfAttention |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("ab4507b7278676b1") 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, InputSelfAttention: 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.num_attention_heads = 2
self.attention_probs_dropout_prob = 0.1
self.hidden_dropout_prob = 0.1
self.layer_norm_eps = 1e-12
config = Config()
batch_size = 2
seq_length = 3
input_tensor = torch.randn(batch_size, seq_length, config.hidden_size)
input_mask = torch.ones(batch_size, 1, 1, seq_length)
ARGS = {
"config": config,
"ctx_dim": None,
}
- 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 InputSelfAttention — 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 InputSelfAttention 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
|
| InputXAttention |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("10473dc20e4ea297") 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, InputXAttention: 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.num_attention_heads = 2
self.attention_probs_dropout_prob = 0.1
self.hidden_dropout_prob = 0.1
self.layer_norm_eps = 1e-12
config = Config()
batch_size = 2
seq_len_input = 3
seq_len_ctx = 5
hidden_size = 4
input_tensor = torch.randn(batch_size, seq_len_input, hidden_size)
ctx_tensor = torch.randn(batch_size, seq_len_ctx, hidden_size)
input_mask = torch.ones(batch_size, 1, 1, seq_len_input)
ctx_att_mask = torch.ones(batch_size, 1, 1, seq_len_ctx)
ARGS = {
"config": config,
"ctx_dim": None,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- ipdb, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type InputXAttention — 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 InputXAttention 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
|
| ResidualAttentionBlock |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("e60a700608513530") 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, ResidualAttentionBlock: 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
from collections import OrderedDict
torch.manual_seed(0)
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: torch.Tensor):
orig_type = x.dtype
ret = super().forward(x.type(torch.float32))
return ret.type(orig_type)
class QuickGELU(nn.Module):
def forward(self, x: torch.Tensor):
return x * torch.sigmoid(1.702 * x)
class ResidualAttentionBlock(nn.Module):
def __init__(self, d_model: int, n_head: int, attn_mask: torch.Tensor=None):
super().__init__()
self.attn = nn.MultiheadAttention(d_model, n_head)
self.ln_1 = LayerNorm(d_model)
self.mlp = nn.Sequential(OrderedDict([('c_fc', nn.Linear(d_model, d_model * 4)), ('gelu', QuickGELU()), ('c_proj', nn.Linear(d_model * 4, d_model))]))
self.ln_2 = LayerNorm(d_model)
self.attn_mask = attn_mask
def attention(self, x: torch.Tensor):
attn_mask_ = self.attn_mask
if self.attn_mask is not None and hasattr(self.attn_mask, '__call__'):
attn_mask_ = self.attn_mask(x.size(0))
attn_mask_ = attn_mask_.to(dtype=x.dtype, device=x.device) if attn_mask_ is not None else None
return self.attn(x, x, x, need_weights=False, attn_mask=attn_mask_)[0]
def forward(self, x: torch.Tensor):
x = x + self.attention(self.ln_1(x))
x = x + self.mlp(self.ln_2(x))
return x
# Create a simple callable attn_mask that returns a mask tensor
def make_attn_mask(seq_len):
return torch.zeros((seq_len, seq_len), dtype=torch.float32)
ARGS = {
'd_model': 4,
'n_head': 2,
'attn_mask': make_attn_mask
}
- 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 ResidualAttentionBlock — 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 ResidualAttentionBlock 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
|
| Transformer |
Ran ran on a synthesized input · constructed an object; no result was computed |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("034d394f08c70794") 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, Transformer: 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)
# Parameters for Transformer
width = 8 # embedding dimension
layers = 2 # number of transformer layers
heads = 2 # number of attention heads
attn_mask = None # no attention mask (optional parameter)
ARGS = {
'width': width,
'layers': layers,
'heads': heads,
'attn_mask': attn_mask
}
- 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 Transformer — 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 Transformer 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
|
| VisualEmbeddings |
Ran ran on a synthesized input |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("8515b5135628725d") 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 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
from torch import nn
BertLayerNorm = torch.nn.LayerNorm
class VisualEmbeddings(nn.Module):
def __init__(self, config):
super().__init__()
self.cls_token = nn.Parameter(torch.zeros(1, 1, config.hidden_size))
self.pano_img_linear = nn.Linear(config.image_feat_size, config.hidden_size)
self.pano_img_layer_norm = BertLayerNorm(config.hidden_size, eps=1e-12)
self.pano_ang_linear = nn.Linear(config.angle_feat_size, config.hidden_size)
self.pano_ang_layer_norm = BertLayerNorm(config.hidden_size, eps=1e-12)
self.type_embedding = nn.Embedding(1, config.hidden_size)
self.layer_norm = BertLayerNorm(config.hidden_size, eps=1e-12)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
@property
def device(self):
return self.pano_img_linear.weight.device
def forward(self, pano_img_feats, pano_ang_feats, step_embedding=None, batch_size=None):
type_ids = torch.zeros((batch_size,)).long().to(self.device)
type_embeddings = self.type_embedding(type_ids).unsqueeze(1)
cls_embeddings = self.dropout(self.layer_norm(self.cls_token.expand(batch_size, -1, -1) + type_embeddings.squeeze(1)))
if pano_img_feats is not None:
batch_size, num_pano, _ = pano_img_feats.size()
pano_embeddings = self.pano_img_layer_norm(self.pano_img_linear(pano_img_feats)) + self.pano_ang_layer_norm(self.pano_ang_linear(pano_ang_feats)) + type_embeddings
pano_embeddings = pano_embeddings + step_embedding
pano_embeddings = self.layer_norm(pano_embeddings)
pano_embeddings = self.dropout(pano_embeddings)
else:
pano_embeddings = None
return (cls_embeddings, pano_embeddings)
class Config:
def __init__(self):
self.hidden_size = 8
self.image_feat_size = 4
self.angle_feat_size = 3
self.hidden_dropout_prob = 0.1
INIT_ARGS = {
'config': Config()
}
ARGS = {
'pano_img_feats': torch.randn(2, 5, 4),
'pano_ang_feats': torch.randn(2, 5, 3),
'step_embedding': torch.randn(2, 5, 8),
'batch_size': 2
}
if __name__ == '__main__':
model = VisualEmbeddings(**INIT_ARGS)
cls_emb, pano_emb = model(**ARGS)
print("cls_embeddings shape:", cls_emb.shape)
print("pano_embeddings shape:", pano_emb.shape if pano_emb is not None else 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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| BertLayer |
Not yet run unverified (harvested, no recorded run) |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("71b64ba0c2e09916") How it ran |
| LXRTXLayer |
Not yet run unverified (harvested, no recorded run) |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("1aa0b58638317139") How it ran |
| LxmertEncoder |
Not yet run unverified (harvested, no recorded run) |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("c7aa8c5278bebd66") How it ran |
| NavCMT |
Not yet run unverified (harvested, no recorded run) |
wxh1996/lana-vln/finetune_src/models/vilmodel_cmt_lana.py code served (permissive licence) · get_code("c8a9c4bd19048e94") How it ran |