Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vqvae/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(

self.d_head = self.d_model // self.n_heads
self.layernorm_qkv = nn.Sequential(
nn.LayerNorm(d_model), nn.Linear(d_model, d_model * 3, bias=bias)
nn.LayerNorm(d_model, bias=bias), nn.Linear(d_model, d_model * 3, bias=bias)
)
self.out_proj = nn.Linear(d_model, d_model, bias=bias)

Expand Down
2 changes: 1 addition & 1 deletion src/vqvae/quantizer_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_codebook(self,):
return self.codebook.weight

def indices2embedding(self, indices: torch.IntTensor) -> torch.Tensor:
z_q = self.codebook[indices]
z_q = self.codebook(indices)
return z_q

def forward(self, z: torch.Tensor) -> (torch.Tensor, torch.IntTensor, float):
Expand Down
12 changes: 6 additions & 6 deletions src/vqvae/transformer_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def __init__(
def forward(
self,
x: torch.Tensor,
attention_mask: torch.Tensor | None = None,
affine: Affine3D,
affine_mask: torch.Tensor,
attention_mask: torch.Tensor,
sequence_id: torch.Tensor | None = None,
affine: Affine3D | None = None,
affine_mask: torch.Tensor | None = None,
chain_id: torch.Tensor | None = None,
) -> tuple[torch.Tensor, torch.Tensor]:
"""
Expand All @@ -75,8 +75,8 @@ def forward(
Args:
x (torch.Tensor): The input tensor of shape (batch_size, sequence_length, d_model).
sequence_id (torch.Tensor): The sequence ID tensor of shape (batch_size, sequence_length).
affine (Affine3D | None): The affine transformation tensor or None.
affine_mask (torch.Tensor | None): The affine mask tensor or None.
affine (Affine3D): The affine transformation tensor.
affine_mask (torch.Tensor): The affine mask tensor.
chain_id (torch.Tensor): The protein chain tensor of shape (batch_size, sequence_length).
Only used in geometric attention.

Expand All @@ -89,4 +89,4 @@ def forward(
chain_id = torch.ones(size=batch_dims, dtype=torch.int64, device=x.device)
for block in self.blocks:
x = block(x, attention_mask, sequence_id, affine, affine_mask, chain_id)
return self.norm(x), x
return self.norm(x), x