rxnn 0.1.76__py3-none-any.whl → 0.1.78__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.
rxnn/rxt/models.py CHANGED
@@ -97,13 +97,13 @@ class RxTAlphaComponentBase(nn.Module, PyTorchModelHubMixin):
97
97
  if cross_att_type in ['mha', 'gqa', 'mqa']:
98
98
  cross_att_init = lambda: init_attention(embed_dim, att_heads, cross_att_type, att_groups, rope=rope,
99
99
  use_flash_attention=use_flash_attention, dropout=att_dropout,
100
- max_seq_len=seq_len, is_causal=is_causal)
100
+ max_seq_len=seq_len, is_causal=is_causal, rope_only_for_query=True)
101
101
  else:
102
102
  cross_att_init = lambda: init_experimental_attention(embed_dim, att_heads, cross_att_type, cross_att_groups or att_groups, rope=rope,
103
103
  use_flash_attention=use_flash_attention, dropout=att_dropout,
104
104
  max_seq_len=seq_len, is_causal=is_causal, num_experts=att_experts,
105
105
  num_query_experts=att_query_experts,
106
- num_query_groups=cross_att_query_groups or att_query_groups)
106
+ num_query_groups=cross_att_query_groups or att_query_groups, rope_only_for_query=True)
107
107
 
108
108
  layers = nn.ModuleList([
109
109
  ReactiveTransformerLayer(
@@ -40,13 +40,16 @@ class RotaryPositionalEmbedding(nn.Module):
40
40
  return q_embed
41
41
 
42
42
  def _prepare_freqs(self, seq_len: int, device: torch.device) -> torch.Tensor:
43
- if self.cache is None or self.cache.size(1) < seq_len:
43
+ cache_len = self.cache.size(1)
44
+ if self.cache is None or cache_len < seq_len:
44
45
  t = torch.arange(seq_len, device=device).type_as(self.inv_freq)
45
46
  freqs = torch.einsum('i,j->ij', t, self.inv_freq)
46
47
  self.cache = freqs
47
48
  return freqs[None, None, :, :]
48
- else:
49
+ elif cache_len == seq_len:
49
50
  return self.cache[None, None, :, :]
51
+ else:
52
+ return self.cache[:seq_len][None, None, :, :]
50
53
 
51
54
  def _rotate(self, x: torch.Tensor, freqs: torch.Tensor) -> torch.Tensor:
52
55
  x1 = x[..., 0::2]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rxnn
3
- Version: 0.1.76
3
+ Version: 0.1.78
4
4
  Summary: RxNN: Reactive Neural Networks Platform
5
5
  License: Apache-2.0
6
6
  Keywords: deep-learning,ai,machine-learning
@@ -23,8 +23,8 @@ Project-URL: Homepage, https://rxai.dev/rxnn
23
23
  Project-URL: Repository, https://github.com/RxAI-dev/rxnn/python
24
24
  Description-Content-Type: text/markdown
25
25
 
26
- <img src="https://raw.githubusercontent.com/RxAI-dev/RxNN/refs/heads/main/assets/logo_rxai.webp" width="300" />
27
- <img src="https://raw.githubusercontent.com/RxAI-dev/RxNN/refs/heads/main/assets/logo_rxnn.webp" width="300" />
26
+ <img src="https://raw.githubusercontent.com/RxAI-dev/RxNN/refs/heads/main/assets/logo/logo_rxai.webp" width="300" />
27
+ <img src="https://raw.githubusercontent.com/RxAI-dev/RxNN/refs/heads/main/assets/logo/logo_rxnn.webp" width="300" />
28
28
 
29
29
  # Reactive AI - RxNN
30
30
  ## Reactive Neural Networks Platform
@@ -7,7 +7,7 @@ rxnn/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  rxnn/memory/norm.py,sha256=Ofl8Q5NYEF9GQeO0bhM43tkTW91J0y6TSvTAOYMgloM,6278
8
8
  rxnn/memory/stm.py,sha256=EsD8slSP4_9dLuq6aFPDmuFe8PWilxh90so5Z3nm-ig,2057
9
9
  rxnn/rxt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- rxnn/rxt/models.py,sha256=9xJfb1rH7-QVO6PRsvUcbhskb1K7JTcE2ChwR4qT4EY,8711
10
+ rxnn/rxt/models.py,sha256=iUlSvdXrD1NVzZFmdC55qp4_3xoJj31FC40BGgYlf4Q,8763
11
11
  rxnn/training/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  rxnn/training/base.py,sha256=xPMA2Bg9-oUZvSZg67ls2p7Gk9pZ9IHUiIJwUzSe2K8,11766
13
13
  rxnn/training/bml.py,sha256=S1ZaXTybzeJH7uVFamCr4TPl2bLyZ5xmn_lSsjThTiM,19162
@@ -22,10 +22,10 @@ rxnn/transformers/layers.py,sha256=OX8CsFY9A7uqH1SLwyexR_5BNlwheYrJHCGXjF8Q7HU,7
22
22
  rxnn/transformers/mask.py,sha256=J0cfLVLt3SzS2ra3KcY4khrkhI975Dw4CjpUi3Sn25s,419
23
23
  rxnn/transformers/models.py,sha256=xbnn3FTNZFhaqq9A0XEM12ie_WL_58pPeq0qFXIgve0,7656
24
24
  rxnn/transformers/moe.py,sha256=j6jEx6Ip0zttlUZKKn82azxo95lkLZs-H2GLSMD88hY,5859
25
- rxnn/transformers/positional.py,sha256=2l38RS0Dini3f6Z3LUHr3XwWzg1UK7fO2C6wazWDAYU,4292
25
+ rxnn/transformers/positional.py,sha256=DE1TP3D6ikBPg3Ym0sP9F666LHuE70H0w-JEH5DfKPw,4415
26
26
  rxnn/transformers/sampler.py,sha256=poWBpxg1iuK5gEJtxHkk5VVfS9V48hs2Olqdhy_Gw8c,6548
27
27
  rxnn/utils.py,sha256=d5U8i5ukovgDyqiycc2AoxObTz_eF_bgo2MKvdtJ98s,467
28
- rxnn-0.1.76.dist-info/LICENSE,sha256=C8coDFIUYuOcke4JLPwTqahQUCyXyGq6WOaigOkx8tY,11275
29
- rxnn-0.1.76.dist-info/METADATA,sha256=Tf_ZnSlGebQalDujkooJ4p2MGv7_ff6uHTSORzxQ3Ck,16579
30
- rxnn-0.1.76.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
31
- rxnn-0.1.76.dist-info/RECORD,,
28
+ rxnn-0.1.78.dist-info/LICENSE,sha256=C8coDFIUYuOcke4JLPwTqahQUCyXyGq6WOaigOkx8tY,11275
29
+ rxnn-0.1.78.dist-info/METADATA,sha256=559E3b22oEiu6vXNnsi7xLCw0GeuYQmcdmOgHkcdlL0,16589
30
+ rxnn-0.1.78.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
31
+ rxnn-0.1.78.dist-info/RECORD,,
File without changes
File without changes