titans-pytorch 0.0.8__tar.gz → 0.0.9__tar.gz

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.
@@ -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
@@ -30,6 +30,18 @@ retrieved = mem(seq)
30
30
  assert seq.shape == retrieved.shape
31
31
  ```
32
32
 
33
+ ## Experiments
34
+
35
+ ```bash
36
+ $ pip install .[examples]
37
+ ```
38
+
39
+ Then
40
+
41
+ ```bash
42
+ $ python train.py
43
+ ```
44
+
33
45
  ## Citations
34
46
 
35
47
  ```bibtex
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "titans-pytorch"
3
- version = "0.0.8"
3
+ version = "0.0.9"
4
4
  description = "Titans"
5
5
  authors = [
6
6
  { name = "Phil Wang", email = "lucidrains@gmail.com" }
@@ -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)
File without changes
File without changes
File without changes
File without changes