x-transformers 2.11.11__py3-none-any.whl → 2.11.14__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.
Potentially problematic release.
This version of x-transformers might be problematic. Click here for more details.
- x_transformers/free_transformer.py +4 -0
- x_transformers/x_transformers.py +4 -1
- {x_transformers-2.11.11.dist-info → x_transformers-2.11.14.dist-info}/METADATA +1 -1
- {x_transformers-2.11.11.dist-info → x_transformers-2.11.14.dist-info}/RECORD +6 -6
- {x_transformers-2.11.11.dist-info → x_transformers-2.11.14.dist-info}/WHEEL +0 -0
- {x_transformers-2.11.11.dist-info → x_transformers-2.11.14.dist-info}/licenses/LICENSE +0 -0
|
@@ -282,6 +282,10 @@ class FreeTransformer(Module):
|
|
|
282
282
|
if not is_tensor(latents):
|
|
283
283
|
latents = tensor(latents, device = self.device)
|
|
284
284
|
|
|
285
|
+
if latents.dtype in (torch.int, torch.long):
|
|
286
|
+
# if given as indices
|
|
287
|
+
latents = F.one_hot(latents, self.binary_mapper.num_codes).float()
|
|
288
|
+
|
|
285
289
|
if latents.ndim == 1: # repeat latents
|
|
286
290
|
latents = repeat(latents, 'd -> b 1 d', b = batch)
|
|
287
291
|
elif latents.ndim == 2:
|
x_transformers/x_transformers.py
CHANGED
|
@@ -740,11 +740,14 @@ def apply_rotary_pos_emb(t, freqs, scale = 1):
|
|
|
740
740
|
rot_dim, seq_len, orig_dtype = freqs.shape[-1], t.shape[-2], t.dtype
|
|
741
741
|
|
|
742
742
|
freqs = freqs[:, -seq_len:, :]
|
|
743
|
-
scale = scale[:, -seq_len:, :] if
|
|
743
|
+
scale = scale[:, -seq_len:, :] if is_tensor(scale) else scale
|
|
744
744
|
|
|
745
745
|
if t.ndim == 4 and freqs.ndim == 3:
|
|
746
746
|
freqs = rearrange(freqs, 'b n d -> b 1 n d')
|
|
747
747
|
|
|
748
|
+
if is_tensor(scale):
|
|
749
|
+
scale = rearrange(scale, 'b n d -> b 1 n d')
|
|
750
|
+
|
|
748
751
|
# partial rotary embeddings, Wang et al. GPT-J
|
|
749
752
|
t, t_unrotated = t[..., :rot_dim], t[..., rot_dim:]
|
|
750
753
|
t = (t * freqs.cos() * scale) + (rotate_half(t) * freqs.sin() * scale)
|
|
@@ -5,16 +5,16 @@ x_transformers/belief_state_wrapper.py,sha256=YLUMk6t2MhFBEw5lHDDHJHcoCxTIkHvxTN
|
|
|
5
5
|
x_transformers/continuous.py,sha256=WwpQCjyVY4PtuEAOFY68zqgklbF9I7AL5w6874YlDe8,13249
|
|
6
6
|
x_transformers/dpo.py,sha256=xt4OuOWhU8pN3OKN2LZAaC2NC8iiEnchqqcrPWVqf0o,3521
|
|
7
7
|
x_transformers/entropy_based_tokenizer.py,sha256=F2lO8-v3aLIcVDVNhu7RR-UtRdlmaaYJzBK9m7OnLE8,5018
|
|
8
|
-
x_transformers/free_transformer.py,sha256=
|
|
8
|
+
x_transformers/free_transformer.py,sha256=a_sF_tx2RgKNsPCum22jlYam28OWEk3B0o1D4-Vo9Fw,10714
|
|
9
9
|
x_transformers/gpt_vae.py,sha256=4QdznXZcU7pmMXUeEocAOKpcTkREYS-zDHktN5ADtNk,5981
|
|
10
10
|
x_transformers/multi_input.py,sha256=tCh-fTJDj2ib4SMGtsa-AM8MxKzJAQSwqAXOu3HU2mg,9252
|
|
11
11
|
x_transformers/neo_mlp.py,sha256=XCNnnop9WLarcxap1kGuYc1x8GHvwkZiDRnXOxSl3Po,3452
|
|
12
12
|
x_transformers/nonautoregressive_wrapper.py,sha256=hMQqNimGtchNIe13cR5LZule1V7I1qM5LmY8VQfVdnA,11698
|
|
13
13
|
x_transformers/up_wrapper.py,sha256=YC2LN14_7Xx9Wtiek2rtEJ_qHqdfSmKlh3d7Cgxwd80,7073
|
|
14
|
-
x_transformers/x_transformers.py,sha256=
|
|
14
|
+
x_transformers/x_transformers.py,sha256=5ctPu8tvlbUMrtW360e_LPnoGv6xcgQFsyWdbvLo6Tk,127002
|
|
15
15
|
x_transformers/xl_autoregressive_wrapper.py,sha256=CvZMJ6A6PA-Y_bQAhnORwjJBSl6Vjq2IdW5KTdk8NI8,4195
|
|
16
16
|
x_transformers/xval.py,sha256=AwwYUm8yDAtKQyKJDIhYMsiLTJ_skh3scUFMjp5sda8,8597
|
|
17
|
-
x_transformers-2.11.
|
|
18
|
-
x_transformers-2.11.
|
|
19
|
-
x_transformers-2.11.
|
|
20
|
-
x_transformers-2.11.
|
|
17
|
+
x_transformers-2.11.14.dist-info/METADATA,sha256=mDuxLmOZqro7a0trdl9d9wS0x8oD5A193wkIR2v44tQ,96012
|
|
18
|
+
x_transformers-2.11.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
19
|
+
x_transformers-2.11.14.dist-info/licenses/LICENSE,sha256=As9u198X-U-vph5noInuUfqsAG2zX_oXPHDmdjwlPPY,1066
|
|
20
|
+
x_transformers-2.11.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|