x-transformers 1.30.1__py3-none-any.whl → 1.30.2__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 +5 -2
- {x_transformers-1.30.1.dist-info → x_transformers-1.30.2.dist-info}/METADATA +1 -1
- {x_transformers-1.30.1.dist-info → x_transformers-1.30.2.dist-info}/RECORD +6 -6
- {x_transformers-1.30.1.dist-info → x_transformers-1.30.2.dist-info}/LICENSE +0 -0
- {x_transformers-1.30.1.dist-info → x_transformers-1.30.2.dist-info}/WHEEL +0 -0
- {x_transformers-1.30.1.dist-info → x_transformers-1.30.2.dist-info}/top_level.txt +0 -0
x_transformers/x_transformers.py
CHANGED
@@ -468,7 +468,8 @@ def rotate_half(x):
|
|
468
468
|
|
469
469
|
@autocast(enabled = False)
|
470
470
|
def apply_rotary_pos_emb(t, freqs, scale = 1):
|
471
|
-
rot_dim, seq_len = freqs.shape[-1], t.shape[-2]
|
471
|
+
rot_dim, seq_len, orig_dtype = freqs.shape[-1], t.shape[-2], t.dtype
|
472
|
+
|
472
473
|
freqs = freqs[-seq_len:, :]
|
473
474
|
scale = scale[-seq_len:, :] if isinstance(scale, torch.Tensor) else scale
|
474
475
|
|
@@ -478,7 +479,9 @@ def apply_rotary_pos_emb(t, freqs, scale = 1):
|
|
478
479
|
# partial rotary embeddings, Wang et al. GPT-J
|
479
480
|
t, t_unrotated = t[..., :rot_dim], t[..., rot_dim:]
|
480
481
|
t = (t * freqs.cos() * scale) + (rotate_half(t) * freqs.sin() * scale)
|
481
|
-
|
482
|
+
out = torch.cat((t, t_unrotated), dim = -1)
|
483
|
+
|
484
|
+
return out.type(orig_dtype)
|
482
485
|
|
483
486
|
# norms
|
484
487
|
|
@@ -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=uwooxffSXL2vTxLhDnkxF7fMe0gaCFW5WinuiR0fQpU,66191
|
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.2.dist-info/LICENSE,sha256=As9u198X-U-vph5noInuUfqsAG2zX_oXPHDmdjwlPPY,1066
|
11
|
+
x_transformers-1.30.2.dist-info/METADATA,sha256=ih2I-SzJQe_qASq_WzOwNuGKKrNTe5mvTba0ZrnMdfI,661
|
12
|
+
x_transformers-1.30.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
13
|
+
x_transformers-1.30.2.dist-info/top_level.txt,sha256=hO6KGpFuGucRNEtRfme4A_rGcM53AKwGP7RVlRIxS5Q,15
|
14
|
+
x_transformers-1.30.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|