Skip to content
Open
Changes from 1 commit
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
Next Next commit
Change TrivialMemoryModel to ResidualMemoryModel
  • Loading branch information
PierreQuinton committed Dec 19, 2025
commit ba590dca2d19258fa9b5b07aeb3cd5706c668de8
6 changes: 3 additions & 3 deletions src/recursion/models/trivial_memory_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from recursion.dataset.repeat_after_k import make_sequences


class TrivialMemoryModel(nn.Module):
class ResidualMemoryModel(nn.Module):
def __init__(self, memory_dim: int):
super().__init__()

Expand All @@ -32,7 +32,7 @@ def forward(self, input: Tensor, memory: Tensor) -> tuple[Tensor, Tensor]:
x = self.relu(self.fc1(x))
x = self.fc2(x)

return x
return x + memory


batch_size = 16
Expand All @@ -41,7 +41,7 @@ def forward(self, input: Tensor, memory: Tensor) -> tuple[Tensor, Tensor]:

memory_dim = 8

model = TrivialMemoryModel(memory_dim)
model = ResidualMemoryModel(memory_dim)
head = nn.Linear(memory_dim, 1)
memory = torch.zeros(batch_size, memory_dim)
criterion = nn.BCEWithLogitsLoss(reduction="none")
Expand Down