tf-models-nightly 2.13.1.dev20230811__py2.py3-none-any.whl → 2.13.1.dev20230813__py2.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.
- official/core/config_definitions.py +1 -0
- official/nlp/modeling/networks/funnel_transformer.py +8 -3
- official/nlp/modeling/networks/funnel_transformer_test.py +21 -10
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/METADATA +1 -1
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/RECORD +9 -9
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/AUTHORS +0 -0
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/LICENSE +0 -0
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/WHEEL +0 -0
- {tf_models_nightly-2.13.1.dev20230811.dist-info → tf_models_nightly-2.13.1.dev20230813.dist-info}/top_level.txt +0 -0
@@ -214,6 +214,7 @@ class TrainerConfig(base_config.Config):
|
|
214
214
|
train_tf_while_loop: whether or not to use tf while loop.
|
215
215
|
train_tf_function: whether or not to use tf_function for training loop.
|
216
216
|
eval_tf_function: whether or not to use tf_function for eval.
|
217
|
+
eval_tf_while_loop: whether or not to use tf while loop for eval.
|
217
218
|
allow_tpu_summary: Whether to allow summary happen inside the XLA program
|
218
219
|
runs on TPU through automatic outside compilation.
|
219
220
|
steps_per_loop: number of steps per loop to report training metrics. This
|
@@ -528,9 +528,15 @@ class FunnelTransformerEncoder(tf.keras.layers.Layer):
|
|
528
528
|
axes=[1])
|
529
529
|
|
530
530
|
for i, layer in enumerate(self._transformer_layers):
|
531
|
+
transformer_output_range = None
|
532
|
+
if i == self._num_layers - 1:
|
533
|
+
transformer_output_range = output_range
|
534
|
+
|
531
535
|
# Bypass no pooling cases.
|
532
536
|
if self._pool_strides[i] == 1:
|
533
|
-
x = layer(
|
537
|
+
x = layer(
|
538
|
+
[x, x, attention_mask], output_range=transformer_output_range
|
539
|
+
)
|
534
540
|
else:
|
535
541
|
# Pools layer for compressing the query length.
|
536
542
|
pooled_inputs = self._att_input_pool_layers[i](
|
@@ -541,8 +547,7 @@ class FunnelTransformerEncoder(tf.keras.layers.Layer):
|
|
541
547
|
dtype=pooled_inputs.dtype), pooled_inputs),
|
542
548
|
axis=1)
|
543
549
|
x = layer([query_inputs, x, attention_mask],
|
544
|
-
output_range=
|
545
|
-
1 else None)
|
550
|
+
output_range=transformer_output_range)
|
546
551
|
# Pools the corresponding attention_mask.
|
547
552
|
if i < len(self._transformer_layers) - 1:
|
548
553
|
attention_mask = _pool_and_concat(
|
@@ -245,24 +245,32 @@ class FunnelTransformerEncoderTest(parameterized.TestCase, tf.test.TestCase):
|
|
245
245
|
self.assertAllEqual(tf.float32, pooled.dtype)
|
246
246
|
|
247
247
|
@parameterized.named_parameters(
|
248
|
-
("all_sequence", None, 3, 0),
|
249
|
-
("output_range", 1, 1, 0),
|
250
|
-
("all_sequence_with_unpool", None, 4, 1),
|
251
|
-
("output_range_with_unpool", 1, 1, 1),
|
252
|
-
("output_range_with_large_unpool", 1, 1, 2),
|
248
|
+
("all_sequence", None, 3, 0, 2),
|
249
|
+
("output_range", 1, 1, 0, 2),
|
250
|
+
("all_sequence_with_unpool", None, 4, 1, 2),
|
251
|
+
("output_range_with_unpool", 1, 1, 1, 2),
|
252
|
+
("output_range_with_large_unpool", 1, 1, 2, 2),
|
253
|
+
("output_range_with_no_pooling", 1, 1, 0, 1),
|
254
|
+
("output_range_with_unpool_and_no_pooling", 1, 1, 1, 1),
|
253
255
|
)
|
254
|
-
def test_network_invocation(
|
256
|
+
def test_network_invocation(
|
257
|
+
self,
|
258
|
+
output_range,
|
259
|
+
out_seq_len,
|
260
|
+
unpool_length,
|
261
|
+
pool_stride,
|
262
|
+
):
|
255
263
|
hidden_size = 32
|
256
264
|
sequence_length = 21
|
257
265
|
vocab_size = 57
|
258
266
|
num_types = 7
|
259
|
-
|
267
|
+
num_layers = 3
|
260
268
|
# Create a small FunnelTransformerEncoder for testing.
|
261
269
|
test_network = funnel_transformer.FunnelTransformerEncoder(
|
262
270
|
vocab_size=vocab_size,
|
263
271
|
hidden_size=hidden_size,
|
264
272
|
num_attention_heads=2,
|
265
|
-
num_layers=
|
273
|
+
num_layers=num_layers,
|
266
274
|
type_vocab_size=num_types,
|
267
275
|
pool_stride=pool_stride,
|
268
276
|
unpool_length=unpool_length)
|
@@ -297,7 +305,7 @@ class FunnelTransformerEncoderTest(parameterized.TestCase, tf.test.TestCase):
|
|
297
305
|
hidden_size=hidden_size,
|
298
306
|
max_sequence_length=max_sequence_length,
|
299
307
|
num_attention_heads=2,
|
300
|
-
num_layers=
|
308
|
+
num_layers=num_layers,
|
301
309
|
type_vocab_size=num_types,
|
302
310
|
pool_stride=pool_stride)
|
303
311
|
dict_outputs = test_network([word_ids, mask, type_ids])
|
@@ -305,7 +313,10 @@ class FunnelTransformerEncoderTest(parameterized.TestCase, tf.test.TestCase):
|
|
305
313
|
pooled = dict_outputs["pooled_output"]
|
306
314
|
model = tf.keras.Model([word_ids, mask, type_ids], [data, pooled])
|
307
315
|
outputs = model.predict([word_id_data, mask_data, type_id_data])
|
308
|
-
|
316
|
+
expected_sequence_length = float(sequence_length)
|
317
|
+
for _ in range(num_layers):
|
318
|
+
expected_sequence_length = np.ceil(expected_sequence_length / pool_stride)
|
319
|
+
self.assertEqual(outputs[0].shape[1], expected_sequence_length)
|
309
320
|
|
310
321
|
# Creates a FunnelTransformerEncoder with embedding_width != hidden_size
|
311
322
|
test_network = funnel_transformer.FunnelTransformerEncoder(
|
@@ -12,7 +12,7 @@ official/core/actions_test.py,sha256=NfT4ywnRcQNFY7i4xm_uE9qPinON-20lidBkkRYVEuo
|
|
12
12
|
official/core/base_task.py,sha256=6zy7OldZtiYvH2o4TPwzkxqZd763u5P2tXN8H9aeC30,12958
|
13
13
|
official/core/base_trainer.py,sha256=n_dxBOifRBD7G24W_8N2_Jj9kHUVSadvRaB9eEGA0pk,18115
|
14
14
|
official/core/base_trainer_test.py,sha256=jijBCetnQgVl0yDSUq8NbtW8eOn2PfStkapW5Z1AZSs,13011
|
15
|
-
official/core/config_definitions.py,sha256=
|
15
|
+
official/core/config_definitions.py,sha256=yYwFEQJgu_zCx6DJZSywi0IBrs1WbPpWazU2sn2G-6s,15403
|
16
16
|
official/core/exp_factory.py,sha256=PzCIJEDseAhPUGwEOq6ca3CvNyJSWGDIb53YgI_Jw6s,1115
|
17
17
|
official/core/export_base.py,sha256=V4BKNiBzzMcHTgjYTUXQgQwoZNZbCJbXWf53-_C_2ws,7025
|
18
18
|
official/core/export_base_test.py,sha256=npqecqCdi2ovmuCWa3fBHCeST-oAvY4zgKg7BCEzWo8,4426
|
@@ -401,8 +401,8 @@ official/nlp/modeling/networks/encoder_scaffold.py,sha256=lHVTrsiXtS6KpodRinQ9MO
|
|
401
401
|
official/nlp/modeling/networks/encoder_scaffold_test.py,sha256=ENzW6quIUE5Py-x6PtCbk0H4CaUZBwNb9HINTizV6tM,29056
|
402
402
|
official/nlp/modeling/networks/fnet.py,sha256=fZ2xTvUilybR7BfiSBxj_5BRXe9qQwLo-BqWfyjRDxQ,14576
|
403
403
|
official/nlp/modeling/networks/fnet_test.py,sha256=QuwBd5QsiCzTbqMkPsLSJ9g8QRWIGHQSpmAFCzTRc8Y,4543
|
404
|
-
official/nlp/modeling/networks/funnel_transformer.py,sha256=
|
405
|
-
official/nlp/modeling/networks/funnel_transformer_test.py,sha256=
|
404
|
+
official/nlp/modeling/networks/funnel_transformer.py,sha256=uC0oqJxeqAyRWkX4h9nXIyyBYOXYzLloxIUDnkIdhr8,24117
|
405
|
+
official/nlp/modeling/networks/funnel_transformer_test.py,sha256=EchGCgslROR3qbpWGYmaATf4s9dQQ5lOWi5wz5TU1qI,17552
|
406
406
|
official/nlp/modeling/networks/mobile_bert_encoder.py,sha256=swq2x5cpQUrh7yk77c7kGIzTX_xgG2ebGFQaqTU1vAM,7533
|
407
407
|
official/nlp/modeling/networks/mobile_bert_encoder_test.py,sha256=Da8r3YPzs0G-YJF3ooQkhO7NFudL6hkAgl9cebpqHUs,7105
|
408
408
|
official/nlp/modeling/networks/packed_sequence_embedding.py,sha256=4CGzp27Bw9Ia2cTCfjjK1Wqa_cLfmWFSiZfj4uGQJZ8,12800
|
@@ -1110,9 +1110,9 @@ tensorflow_models/__init__.py,sha256=Ciz_YBke6teb6y42QyQTUBDdXJAiV7Qdu1zOoZvYiKw
|
|
1110
1110
|
tensorflow_models/tensorflow_models_test.py,sha256=Kz2y4V-rtBhZFFfKD2soCq52hviSfJVV1L2ztqS-9oM,1385
|
1111
1111
|
tensorflow_models/nlp/__init__.py,sha256=3dULDpUBpDi9vljpXadq6oJrWH4y6z42Bz2d3hopYZw,807
|
1112
1112
|
tensorflow_models/vision/__init__.py,sha256=4y77XkHaH8qLls3-6ta4tMp3Xj8CLbB0ihH91HsQ9z4,833
|
1113
|
-
tf_models_nightly-2.13.1.
|
1114
|
-
tf_models_nightly-2.13.1.
|
1115
|
-
tf_models_nightly-2.13.1.
|
1116
|
-
tf_models_nightly-2.13.1.
|
1117
|
-
tf_models_nightly-2.13.1.
|
1118
|
-
tf_models_nightly-2.13.1.
|
1113
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
|
1114
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
|
1115
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/METADATA,sha256=OF5TjgUSsS-GtDUKpZDZDupLyW2k2YTh4Cai9xeELLo,1395
|
1116
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
|
1117
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
|
1118
|
+
tf_models_nightly-2.13.1.dev20230813.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|