hyper-connections 0.0.15__py3-none-any.whl → 0.0.16__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.
- hyper_connections/hyper_connections_with_multi_branch_inputs.py +12 -5
- {hyper_connections-0.0.15.dist-info → hyper_connections-0.0.16.dist-info}/METADATA +1 -1
- hyper_connections-0.0.16.dist-info/RECORD +7 -0
- hyper_connections-0.0.15.dist-info/RECORD +0 -7
- {hyper_connections-0.0.15.dist-info → hyper_connections-0.0.16.dist-info}/WHEEL +0 -0
- {hyper_connections-0.0.15.dist-info → hyper_connections-0.0.16.dist-info}/licenses/LICENSE +0 -0
|
@@ -57,12 +57,19 @@ class HyperConnections(Module):
|
|
|
57
57
|
self.num_residual_streams = num_residual_streams
|
|
58
58
|
self.num_branch_inputs = num_branch_inputs
|
|
59
59
|
|
|
60
|
-
init_residual_index = default(layer_index, randrange(num_residual_streams)) % num_residual_streams # just choose one random residual stream if layer index not given
|
|
61
|
-
|
|
62
60
|
self.static_beta = nn.Parameter(torch.ones(num_residual_streams, num_branch_inputs))
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
# make sure each branch input receives from different residual stream on init
|
|
63
|
+
|
|
64
|
+
stream_branches = num_residual_streams * num_branch_inputs
|
|
65
|
+
layer_index = default(layer_index, randrange(stream_branches))
|
|
66
|
+
layer_offset = layer_index % stream_branches * num_branch_inputs
|
|
67
|
+
|
|
68
|
+
stream_seq = torch.arange(num_residual_streams)
|
|
69
|
+
branch_input_seq = torch.arange(num_branch_inputs)
|
|
70
|
+
|
|
71
|
+
init_alpha0 = rearrange(stream_seq, 's -> s 1') + rearrange(branch_input_seq, 'bi -> 1 bi') + layer_offset
|
|
72
|
+
init_alpha0 = ((init_alpha0 % num_residual_streams) == 0).float()
|
|
66
73
|
|
|
67
74
|
self.static_alpha = nn.Parameter(torch.cat([init_alpha0, torch.eye(num_residual_streams)], dim = 1))
|
|
68
75
|
|
|
@@ -76,7 +83,7 @@ class HyperConnections(Module):
|
|
|
76
83
|
self.channel_first = channel_first
|
|
77
84
|
|
|
78
85
|
@classmethod
|
|
79
|
-
def get_expand_reduce_stream_functions(cls, num_streams):
|
|
86
|
+
def get_expand_reduce_stream_functions(cls, num_streams, disable = False):
|
|
80
87
|
if disable:
|
|
81
88
|
return (identity, identity)
|
|
82
89
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
hyper_connections/__init__.py,sha256=mAy66IuHqXM4XOyOZGt5mo2B2hfHdUk8jW31YnWNQTg,104
|
|
2
|
+
hyper_connections/hyper_connections.py,sha256=LoyiGGDH81MLUcF9WKT39lA9Y1CXUAd-SYM9tJGQ61A,8099
|
|
3
|
+
hyper_connections/hyper_connections_with_multi_branch_inputs.py,sha256=cdYND9EdrZp1Kircrdaxd0-d8KV6VWPQeBce0k3q7Vo,6451
|
|
4
|
+
hyper_connections-0.0.16.dist-info/METADATA,sha256=4n5JPHvfqf3IMsDCkw4h3uTGm4WRTnWVz3sMRwQFHTI,5076
|
|
5
|
+
hyper_connections-0.0.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
+
hyper_connections-0.0.16.dist-info/licenses/LICENSE,sha256=E7RGS7kpJIStk5za_-4DVhWEAamf65EU0CNML25mq4c,1066
|
|
7
|
+
hyper_connections-0.0.16.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
hyper_connections/__init__.py,sha256=mAy66IuHqXM4XOyOZGt5mo2B2hfHdUk8jW31YnWNQTg,104
|
|
2
|
-
hyper_connections/hyper_connections.py,sha256=LoyiGGDH81MLUcF9WKT39lA9Y1CXUAd-SYM9tJGQ61A,8099
|
|
3
|
-
hyper_connections/hyper_connections_with_multi_branch_inputs.py,sha256=6KHdqvjUZCyHwf7LVByMMuoQtnEHBxRxdt-4Bw9HPcA,6130
|
|
4
|
-
hyper_connections-0.0.15.dist-info/METADATA,sha256=DnZongXit3VTaT7DxmpK0RRfUhXqfUTjM32a-ofbrIw,5076
|
|
5
|
-
hyper_connections-0.0.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
hyper_connections-0.0.15.dist-info/licenses/LICENSE,sha256=E7RGS7kpJIStk5za_-4DVhWEAamf65EU0CNML25mq4c,1066
|
|
7
|
-
hyper_connections-0.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|