hyper-connections 0.3.4__tar.gz → 0.3.6__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.
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/PKG-INFO +3 -1
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/README.md +2 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/manifold_constrained_hyper_connections.py +3 -15
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/pyproject.toml +1 -1
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/.github/workflows/python-publish.yml +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/.github/workflows/test.yml +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/.gitignore +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/LICENSE +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper-connections.png +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/__init__.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/hyper_connections.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/hyper_connections_channel_first.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/hyper_connections_with_multi_branch_inputs.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/hyper_connections_with_multi_input_streams.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/hyper_connections/residuals.py +0 -0
- {hyper_connections-0.3.4 → hyper_connections-0.3.6}/tests/test_hyper_connections.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyper-connections
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Hyper-Connections
|
|
5
5
|
Project-URL: Homepage, https://pypi.org/project/hyper-connections/
|
|
6
6
|
Project-URL: Repository, https://github.com/lucidrains/hyper-connections
|
|
@@ -45,6 +45,8 @@ Description-Content-Type: text/markdown
|
|
|
45
45
|
|
|
46
46
|
Attempt to make multiple residual streams, proposed in [Hyper-Connections paper](https://arxiv.org/abs/2409.19606) out of Bytedance AI lab, accessible as an easy to use library, as well as for following any new research in this direction.
|
|
47
47
|
|
|
48
|
+
[Write up on mHC from Subhadip Mitra](https://subhadipmitra.com/blog/2026/deepseek-mhc-manifold-constrained-hyper-connections/)
|
|
49
|
+
|
|
48
50
|
## Install
|
|
49
51
|
|
|
50
52
|
```bash
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Attempt to make multiple residual streams, proposed in [Hyper-Connections paper](https://arxiv.org/abs/2409.19606) out of Bytedance AI lab, accessible as an easy to use library, as well as for following any new research in this direction.
|
|
6
6
|
|
|
7
|
+
[Write up on mHC from Subhadip Mitra](https://subhadipmitra.com/blog/2026/deepseek-mhc-manifold-constrained-hyper-connections/)
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -10,7 +10,7 @@ import torch.nn.functional as F
|
|
|
10
10
|
from torch.nn import Module, Sequential
|
|
11
11
|
from torch.utils._pytree import tree_flatten, tree_unflatten
|
|
12
12
|
|
|
13
|
-
from einops import rearrange, repeat, reduce, einsum
|
|
13
|
+
from einops import rearrange, repeat, reduce, einsum
|
|
14
14
|
from einops.layers.torch import Rearrange, Reduce
|
|
15
15
|
|
|
16
16
|
"""
|
|
@@ -40,14 +40,6 @@ def identity(t):
|
|
|
40
40
|
def add(x, y):
|
|
41
41
|
return x + y
|
|
42
42
|
|
|
43
|
-
def pack_one_with_inverse(t, pattern):
|
|
44
|
-
packed, packed_shape = pack([t], pattern)
|
|
45
|
-
|
|
46
|
-
def inverse(out):
|
|
47
|
-
return unpack(out, packed_shape, pattern)[0]
|
|
48
|
-
|
|
49
|
-
return packed, inverse
|
|
50
|
-
|
|
51
43
|
# sinkhorn
|
|
52
44
|
|
|
53
45
|
def l1norm(t, dim):
|
|
@@ -230,7 +222,7 @@ class ManifoldConstrainedHyperConnections(Module):
|
|
|
230
222
|
|
|
231
223
|
# they used layernorm in paper, but rmsnorm is fine given what we know now
|
|
232
224
|
|
|
233
|
-
self.norm = RMSNorm(dim
|
|
225
|
+
self.norm = RMSNorm(dim)
|
|
234
226
|
|
|
235
227
|
assert num_residual_streams > 0, '`num_residual_streams` must be greater than 0'
|
|
236
228
|
|
|
@@ -320,11 +312,7 @@ class ManifoldConstrainedHyperConnections(Module):
|
|
|
320
312
|
|
|
321
313
|
# norm
|
|
322
314
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
normed = self.norm(flattened_residuals) # they norm across flattened stream + dimension?
|
|
326
|
-
|
|
327
|
-
normed = inverse_pack(normed)
|
|
315
|
+
normed = self.norm(residuals)
|
|
328
316
|
|
|
329
317
|
# alpha for weighted sum of residuals going into branch
|
|
330
318
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|