metacontroller-pytorch 0.0.22__py3-none-any.whl → 0.0.24__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.
@@ -26,6 +26,9 @@ from discrete_continuous_embed_readout import Embed, Readout, EmbedAndReadout
26
26
 
27
27
  from assoc_scan import AssocScan
28
28
 
29
+ from torch_einops_utils import pad_at_dim
30
+ from torch_einops_utils.save_load import save_load
31
+
29
32
  # constants
30
33
 
31
34
  LinearNoBias = partial(Linear, bias = False)
@@ -46,14 +49,6 @@ def default(*args):
46
49
  return arg
47
50
  return None
48
51
 
49
- def pad_at_dim(t, pad: tuple[int, int], dim = -1, value = 0.):
50
- if pad == (0, 0):
51
- return t
52
-
53
- dims_from_right = (- dim - 1) if dim < 0 else (t.ndim - dim - 1)
54
- zeros = ((0, 0) * dims_from_right)
55
- return F.pad(t, (*zeros, *pad), value = value)
56
-
57
52
  # tensor helpers
58
53
 
59
54
  def straight_through(src, tgt):
@@ -69,6 +64,7 @@ MetaControllerOutput = namedtuple('MetaControllerOutput', (
69
64
  'switch_loss'
70
65
  ))
71
66
 
67
+ @save_load()
72
68
  class MetaController(Module):
73
69
  def __init__(
74
70
  self,
@@ -278,6 +274,7 @@ TransformerOutput = namedtuple('TransformerOutput', (
278
274
  'prev_hiddens'
279
275
  ))
280
276
 
277
+ @save_load()
281
278
  class Transformer(Module):
282
279
  def __init__(
283
280
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metacontroller-pytorch
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: Transformer Metacontroller
5
5
  Project-URL: Homepage, https://pypi.org/project/metacontroller/
6
6
  Project-URL: Repository, https://github.com/lucidrains/metacontroller
@@ -39,7 +39,8 @@ Requires-Dist: discrete-continuous-embed-readout>=0.1.12
39
39
  Requires-Dist: einops>=0.8.1
40
40
  Requires-Dist: einx>=0.3.0
41
41
  Requires-Dist: loguru
42
- Requires-Dist: memmap-replay-buffer>=0.0.1
42
+ Requires-Dist: memmap-replay-buffer>=0.0.23
43
+ Requires-Dist: torch-einops-utils>=0.0.16
43
44
  Requires-Dist: torch>=2.5
44
45
  Requires-Dist: x-evolution>=0.1.23
45
46
  Requires-Dist: x-mlps-pytorch
@@ -0,0 +1,6 @@
1
+ metacontroller/__init__.py,sha256=lj7IOGpN--qMxJWbB-4SGqoPXG7Hd4mgtToTRSyTZ58,57
2
+ metacontroller/metacontroller.py,sha256=Ocm_2hCBvV2coYg4tQ4kYd0LQHgHWiz1l-c9lR7Z_fM,13941
3
+ metacontroller_pytorch-0.0.24.dist-info/METADATA,sha256=5xKHBecV3iRSK-JbNwOQ0iv6KSz_sIN--ar_M05-EWQ,4363
4
+ metacontroller_pytorch-0.0.24.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
+ metacontroller_pytorch-0.0.24.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
6
+ metacontroller_pytorch-0.0.24.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- metacontroller/__init__.py,sha256=lj7IOGpN--qMxJWbB-4SGqoPXG7Hd4mgtToTRSyTZ58,57
2
- metacontroller/metacontroller.py,sha256=kmfq4XSeh_tT30n3ctG1ggTgA0hVtV2eNKMqKr_jChc,14084
3
- metacontroller_pytorch-0.0.22.dist-info/METADATA,sha256=zxsjz3enrR60enivkdcCYLd2Xjpg8d5EUydakRjYOAQ,4320
4
- metacontroller_pytorch-0.0.22.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
5
- metacontroller_pytorch-0.0.22.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
6
- metacontroller_pytorch-0.0.22.dist-info/RECORD,,