x-transformers 1.30.0__py3-none-any.whl → 1.30.1__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.
- x_transformers/x_transformers.py +9 -6
- {x_transformers-1.30.0.dist-info → x_transformers-1.30.1.dist-info}/METADATA +1 -1
- {x_transformers-1.30.0.dist-info → x_transformers-1.30.1.dist-info}/RECORD +6 -6
- {x_transformers-1.30.0.dist-info → x_transformers-1.30.1.dist-info}/LICENSE +0 -0
- {x_transformers-1.30.0.dist-info → x_transformers-1.30.1.dist-info}/WHEEL +0 -0
- {x_transformers-1.30.0.dist-info → x_transformers-1.30.1.dist-info}/top_level.txt +0 -0
x_transformers/x_transformers.py
CHANGED
@@ -444,24 +444,27 @@ class RotaryEmbedding(Module):
|
|
444
444
|
|
445
445
|
@autocast(enabled = False)
|
446
446
|
def forward(self, t):
|
447
|
-
max_pos = t.max()+1
|
447
|
+
max_pos = t.max() + 1
|
448
448
|
|
449
449
|
freqs = torch.einsum('i , j -> i j', t.type_as(self.inv_freq), self.inv_freq) / self.interpolation_factor
|
450
|
-
freqs = torch.
|
450
|
+
freqs = torch.stack((freqs, freqs), dim = -1)
|
451
|
+
freqs = rearrange(freqs, '... d r -> ... (d r)')
|
451
452
|
|
452
453
|
if not exists(self.scale):
|
453
454
|
return freqs, 1.
|
454
455
|
|
455
456
|
power = (t - (max_pos // 2)) / self.scale_base
|
456
457
|
scale = self.scale ** rearrange(power, 'n -> n 1')
|
457
|
-
scale = torch.
|
458
|
+
scale = torch.stack((scale, scale), dim = -1)
|
459
|
+
scale = rearrange(scale, '... d r -> ... (d r)')
|
458
460
|
|
459
461
|
return freqs, scale
|
460
462
|
|
461
463
|
def rotate_half(x):
|
462
|
-
x = rearrange(x, '... (
|
463
|
-
x1, x2 = x.unbind(dim = -
|
464
|
-
|
464
|
+
x = rearrange(x, '... (d r) -> ... d r', r = 2)
|
465
|
+
x1, x2 = x.unbind(dim = -1)
|
466
|
+
x = torch.stack((-x2, x1), dim = -1)
|
467
|
+
return rearrange(x, '... d r -> ... (d r)')
|
465
468
|
|
466
469
|
@autocast(enabled = False)
|
467
470
|
def apply_rotary_pos_emb(t, freqs, scale = 1):
|
@@ -4,11 +4,11 @@ x_transformers/autoregressive_wrapper.py,sha256=uX8Mb0zLsQrZECt_9UGt35g7tC05Rk3n
|
|
4
4
|
x_transformers/continuous.py,sha256=WO52n9lFAXv5-SGadi2cApGF8dkouN8QSTEOuC7erj8,6180
|
5
5
|
x_transformers/dpo.py,sha256=LjvWgCkqTl-UuehrzQ8nkX5guLr4whYwsmm7SKSwdls,3450
|
6
6
|
x_transformers/nonautoregressive_wrapper.py,sha256=ys_p8obc7lTeeodCqvkRKxOXQ1C9T3j5Jwr-JbVgnXk,10432
|
7
|
-
x_transformers/x_transformers.py,sha256=
|
7
|
+
x_transformers/x_transformers.py,sha256=EEfqwI-NANzrQf10Tc_bRSdjWOIEJdhxOfzeKY4osyI,66137
|
8
8
|
x_transformers/xl_autoregressive_wrapper.py,sha256=DCx4n0_c1tFai4nOqaWVnqx2p9eutsZsDMiMP1ckxNU,4117
|
9
9
|
x_transformers/xval.py,sha256=QE1ltYZTR_eGgIHPP2BrMWVWVLqMW-OpDZh87BSmQEg,8563
|
10
|
-
x_transformers-1.30.
|
11
|
-
x_transformers-1.30.
|
12
|
-
x_transformers-1.30.
|
13
|
-
x_transformers-1.30.
|
14
|
-
x_transformers-1.30.
|
10
|
+
x_transformers-1.30.1.dist-info/LICENSE,sha256=As9u198X-U-vph5noInuUfqsAG2zX_oXPHDmdjwlPPY,1066
|
11
|
+
x_transformers-1.30.1.dist-info/METADATA,sha256=gkmRLAvk0l9_vkrTVBIWLnFq_cEtCYrI8oI3B07d9B8,661
|
12
|
+
x_transformers-1.30.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
13
|
+
x_transformers-1.30.1.dist-info/top_level.txt,sha256=hO6KGpFuGucRNEtRfme4A_rGcM53AKwGP7RVlRIxS5Q,15
|
14
|
+
x_transformers-1.30.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|