titans-pytorch 0.0.8__py3-none-any.whl → 0.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
titans_pytorch/titans.py CHANGED
@@ -311,7 +311,10 @@ class NeuralMemory(Module):
311
311
  past_state: tuple[dict[str, Tensor], dict[str, Tensor]] | None = None,
312
312
  return_next_memories = False
313
313
  ):
314
- batch = seq.shape[0]
314
+ batch, seq_len = seq.shape[:2]
315
+
316
+ if seq_len < self.chunk_size:
317
+ return torch.zeros_like(seq)
315
318
 
316
319
  if exists(past_state):
317
320
  past_state = tuple(TensorDict(d) for d in past_state)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: titans-pytorch
3
- Version: 0.0.8
3
+ Version: 0.0.9
4
4
  Summary: Titans
5
5
  Project-URL: Homepage, https://pypi.org/project/titans-pytorch/
6
6
  Project-URL: Repository, https://github.com/lucidrains/titans-pytorch
@@ -77,6 +77,18 @@ retrieved = mem(seq)
77
77
  assert seq.shape == retrieved.shape
78
78
  ```
79
79
 
80
+ ## Experiments
81
+
82
+ ```bash
83
+ $ pip install .[examples]
84
+ ```
85
+
86
+ Then
87
+
88
+ ```bash
89
+ $ python train.py
90
+ ```
91
+
80
92
  ## Citations
81
93
 
82
94
  ```bibtex
@@ -0,0 +1,7 @@
1
+ titans_pytorch/__init__.py,sha256=QKuJPCOJCdgtaPeKoHEkYkiQe65_LV9_8-cIMbBPU30,55
2
+ titans_pytorch/associative_scan.py,sha256=Y-iYqmFuG-NoCKu6kgql1mhowXTeJfyawi3eUIXamp0,2650
3
+ titans_pytorch/titans.py,sha256=0wnvhjMIe0Asjf7RVlGm1Ax8xmnDSgEi0rXoIqyoLo0,10078
4
+ titans_pytorch-0.0.9.dist-info/METADATA,sha256=IY6bB54p6mkO8R6j3nJ-bXBlMiukmJt85fa7Lp-HRWw,3311
5
+ titans_pytorch-0.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ titans_pytorch-0.0.9.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
7
+ titans_pytorch-0.0.9.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- titans_pytorch/__init__.py,sha256=QKuJPCOJCdgtaPeKoHEkYkiQe65_LV9_8-cIMbBPU30,55
2
- titans_pytorch/associative_scan.py,sha256=Y-iYqmFuG-NoCKu6kgql1mhowXTeJfyawi3eUIXamp0,2650
3
- titans_pytorch/titans.py,sha256=I8o_wauKQre87wl645Gy1nchPn5ckfZq4Q6pf5IpToU,9988
4
- titans_pytorch-0.0.8.dist-info/METADATA,sha256=70ENsVn58zYyJM0UKanESujf0xSQWTcWXBh5HY1frKk,3219
5
- titans_pytorch-0.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- titans_pytorch-0.0.8.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
7
- titans_pytorch-0.0.8.dist-info/RECORD,,