x-transformers 1.27.20__py3-none-any.whl → 1.27.21__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/xval.py +9 -0
- {x_transformers-1.27.20.dist-info → x_transformers-1.27.21.dist-info}/METADATA +1 -1
- {x_transformers-1.27.20.dist-info → x_transformers-1.27.21.dist-info}/RECORD +6 -6
- {x_transformers-1.27.20.dist-info → x_transformers-1.27.21.dist-info}/LICENSE +0 -0
- {x_transformers-1.27.20.dist-info → x_transformers-1.27.21.dist-info}/WHEEL +0 -0
- {x_transformers-1.27.20.dist-info → x_transformers-1.27.21.dist-info}/top_level.txt +0 -0
x_transformers/xval.py
CHANGED
@@ -271,8 +271,17 @@ class XValAutoregressiveWrapper(nn.Module):
|
|
271
271
|
|
272
272
|
cross_entropy_loss = F.cross_entropy(logits, target, reduction = 'none', ignore_index = self.ignore_index)
|
273
273
|
|
274
|
+
# protect against nan in `x_num` input tensor
|
275
|
+
|
276
|
+
target_is_number_mask = target == self.net.numerical_token_id
|
277
|
+
x_num_target = x_num_target.masked_fill(~target_is_number_mask, 0.)
|
278
|
+
|
279
|
+
# ignore index
|
280
|
+
|
274
281
|
target_mask = target != self.ignore_index
|
275
282
|
|
283
|
+
# numerical mse loss
|
284
|
+
|
276
285
|
numerical_mse_loss = F.mse_loss(numerical_pred, x_num_target, reduction = 'none')
|
277
286
|
|
278
287
|
numerical_mse_loss = numerical_mse_loss * target_mask
|
@@ -6,9 +6,9 @@ x_transformers/dpo.py,sha256=LjvWgCkqTl-UuehrzQ8nkX5guLr4whYwsmm7SKSwdls,3450
|
|
6
6
|
x_transformers/nonautoregressive_wrapper.py,sha256=ys_p8obc7lTeeodCqvkRKxOXQ1C9T3j5Jwr-JbVgnXk,10432
|
7
7
|
x_transformers/x_transformers.py,sha256=kQhRUMGDsinzkdYcOfE1GriJ057j7D4xSjbH79FFRSE,63574
|
8
8
|
x_transformers/xl_autoregressive_wrapper.py,sha256=DCx4n0_c1tFai4nOqaWVnqx2p9eutsZsDMiMP1ckxNU,4117
|
9
|
-
x_transformers/xval.py,sha256=
|
10
|
-
x_transformers-1.27.
|
11
|
-
x_transformers-1.27.
|
12
|
-
x_transformers-1.27.
|
13
|
-
x_transformers-1.27.
|
14
|
-
x_transformers-1.27.
|
9
|
+
x_transformers/xval.py,sha256=to8AkYfgvR5QC-ZXDnq8PPfzOyg0yutHt_QW36jsy98,8403
|
10
|
+
x_transformers-1.27.21.dist-info/LICENSE,sha256=As9u198X-U-vph5noInuUfqsAG2zX_oXPHDmdjwlPPY,1066
|
11
|
+
x_transformers-1.27.21.dist-info/METADATA,sha256=g0OEysaFW4RomYhoqjDKu7W1brHg70m_N40_nmTLRtA,662
|
12
|
+
x_transformers-1.27.21.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
13
|
+
x_transformers-1.27.21.dist-info/top_level.txt,sha256=hO6KGpFuGucRNEtRfme4A_rGcM53AKwGP7RVlRIxS5Q,15
|
14
|
+
x_transformers-1.27.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|