tf-models-nightly 2.20.0.dev20251106__py2.py3-none-any.whl → 2.20.0.dev20260109__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.
@@ -121,6 +121,7 @@ class TransformerEncoderBlock(tf_keras.layers.Layer):
121
121
  lowrank_query_seq_proj_dim=None,
122
122
  enable_talking_heads=False,
123
123
  enable_gqa_optimization=False,
124
+ softmax_robust_masking=False,
124
125
  **kwargs,
125
126
  ):
126
127
  """Initializes `TransformerEncoderBlock`.
@@ -209,6 +210,8 @@ class TransformerEncoderBlock(tf_keras.layers.Layer):
209
210
  https://arxiv.org/pdf/2003.02436.
210
211
  enable_gqa_optimization: Enable GQA optimization in multi-query attention.
211
212
  This flag is valid only when num_kv_heads is set for GQA.
213
+ softmax_robust_masking: If true, will use a more numerically robust
214
+ masking impl for softmax.
212
215
  **kwargs: keyword arguments.
213
216
  """
214
217
  util.filter_kwargs(kwargs)
@@ -253,6 +256,7 @@ class TransformerEncoderBlock(tf_keras.layers.Layer):
253
256
  self._lowrank_query_seq_proj_dim = lowrank_query_seq_proj_dim
254
257
  self._enable_talking_heads = enable_talking_heads
255
258
  self._enable_gqa_optimization = enable_gqa_optimization
259
+ self._softmax_robust_masking = softmax_robust_masking
256
260
  if (
257
261
  self._src_block_size is not None
258
262
  and self._num_kv_heads is not None
@@ -314,6 +318,7 @@ class TransformerEncoderBlock(tf_keras.layers.Layer):
314
318
  bias_initializer=tf_utils.clone_initializer(self._bias_initializer),
315
319
  attention_axes=self._attention_axes,
316
320
  output_shape=self._output_last_dim,
321
+ softmax_robust_masking=self._softmax_robust_masking,
317
322
  name="self_attention",
318
323
  )
319
324
  common_kwargs = dict(
@@ -512,6 +517,7 @@ class TransformerEncoderBlock(tf_keras.layers.Layer):
512
517
  "linformer_dim": self._linformer_dim,
513
518
  "linformer_shared_kv_projection": self._linformer_shared_kv_projection,
514
519
  "lowrank_query_seq_proj_dim": self._lowrank_query_seq_proj_dim,
520
+ "softmax_robust_masking": self._softmax_robust_masking
515
521
  }
516
522
  base_config = super().get_config()
517
523
  return dict(list(base_config.items()) + list(config.items()))
@@ -28,7 +28,8 @@ def generate_image_np(height: int,
28
28
  """Returns a fake numpy image matrix array."""
29
29
  return np.reshape(
30
30
  np.mod(np.arange(height * width * num_channels), 255).astype(np.uint8),
31
- newshape=(height, width, num_channels))
31
+ (height, width, num_channels),
32
+ )
32
33
 
33
34
 
34
35
  def generate_normalized_boxes_np(num_boxes: int) -> np.ndarray:
@@ -82,8 +83,7 @@ def generate_instance_masks_np(height: int,
82
83
  box_heights = boxes_np[:, 3].astype(int) - ymins
83
84
 
84
85
  for i, (x, y, w, h) in enumerate(zip(xmins, ymins, box_widths, box_heights)):
85
- instance_masks_np[i, y:y + h, x:x + w, :] = np.reshape(
86
- np.mod(np.arange(h * w), 2).astype(np.uint8), newshape=(h, w, 1))
86
+ instance_masks_np[i, y:y + h, x:x + w, :] = np.reshape(np.mod(np.arange(h * w), 2).astype(np.uint8), (h, w, 1))
87
87
  return instance_masks_np
88
88
 
89
89
 
@@ -241,7 +241,7 @@ def convert_groundtruths_to_coco_dataset(groundtruths, label_map=None):
241
241
  'num_groundtruths is larger than max_num_instances, %d v.s. %d',
242
242
  num_instances, max_num_instances)
243
243
  num_instances = max_num_instances
244
- for k in range(int(num_instances)):
244
+ for k in range(int(np.squeeze(num_instances))):
245
245
  ann = {}
246
246
  ann['image_id'] = int(groundtruths['source_id'][i][j])
247
247
  if 'is_crowds' in groundtruths:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tf-models-nightly
3
- Version: 2.20.0.dev20251106
3
+ Version: 2.20.0.dev20260109
4
4
  Summary: TensorFlow Official Models
5
5
  Home-page: https://github.com/tensorflow/models
6
6
  Author: Google Inc.
@@ -363,7 +363,7 @@ official/nlp/modeling/layers/tn_expand_condense_test.py,sha256=QWq1dJqQUPe5n69K3
363
363
  official/nlp/modeling/layers/tn_transformer_expand_condense.py,sha256=omzTkCBEk2TOkHEYDEBwve6WsOitX7IIJHzeKXdqDq0,11012
364
364
  official/nlp/modeling/layers/tn_transformer_test.py,sha256=pSCONEZRI4J9_6QLTJ3g_ynUYLrRXsJ1c2YMSiOV_60,8893
365
365
  official/nlp/modeling/layers/transformer.py,sha256=VjUO-gVj_PnavbT_vSrg5NDKMr0SRSiqSg5ktd42m5M,20087
366
- official/nlp/modeling/layers/transformer_encoder_block.py,sha256=BiL8ErBs-m0UZ6ONVJV0ncfWX3LhMhPetIhfH2VvuD4,29910
366
+ official/nlp/modeling/layers/transformer_encoder_block.py,sha256=78nIg3hVFKLeqJ-Hdg4j1scfskZAnm2CSHqlTeoSRcc,30236
367
367
  official/nlp/modeling/layers/transformer_encoder_block_test.py,sha256=g7oMDPvwg6Fv75SBdm6BInXPI8r5GcItBRjLFGuObyg,37821
368
368
  official/nlp/modeling/layers/transformer_scaffold.py,sha256=qmzhCJvbbFVF9zDqnfO4Zs2JDXwKhK7iEBOhsU6-KpQ,15704
369
369
  official/nlp/modeling/layers/transformer_scaffold_test.py,sha256=dRJwesTBKm-mF5mDHrHfVpVNnxa-Wx-fj_4ZHDPTpE0,19920
@@ -1013,7 +1013,7 @@ official/vision/configs/video_classification.py,sha256=GIdceuHsXTI3KdAbh4tPnctEk
1013
1013
  official/vision/configs/video_classification_test.py,sha256=pLbpLcN4HqKtFXVuAbR1iSVWWZ3V_cImNSzQb6E86Zw,1879
1014
1014
  official/vision/data/__init__.py,sha256=atDqjsx74qLrX5FY_wyWi2TL8i8ZELZRsTU9c-sx51I,609
1015
1015
  official/vision/data/create_coco_tf_record.py,sha256=pb3d4yAR7xy3nbR93MFadDKlUBgJKvtwmMyyNa4y1Bs,22742
1016
- official/vision/data/fake_feature_generator.py,sha256=4vPWaEqpW8ws8AfluWLhuORSx23j6rKDQvuBw1YChWc,5109
1016
+ official/vision/data/fake_feature_generator.py,sha256=9VvarI-2wYIS5YPR5qN-V4FGgWHzT_25T0CA8-Dw5Xs,5086
1017
1017
  official/vision/data/image_utils.py,sha256=3aSu4vYGYYHwyVwqaR_9TGH3crJVxTjC6VXuT5S8AtA,3503
1018
1018
  official/vision/data/image_utils_test.py,sha256=Fp_QksSDMgwH8QiXWvcE_XYDsWYdQpha1wOz1DBzl1s,4071
1019
1019
  official/vision/data/process_coco_few_shot_json_files.py,sha256=H3hbzbSS4nPXem5zE1rObesW73jJ_pVBDr0CMgtvubg,6061
@@ -1047,7 +1047,7 @@ official/vision/dataloaders/video_input.py,sha256=yp-3VSuHLbshwOKZWTSWHOP9NoKitA
1047
1047
  official/vision/dataloaders/video_input_test.py,sha256=ZQWkjK5tpzqU3S_pN3GECfPBJ8pIm_IV-WEQkqtifr4,7532
1048
1048
  official/vision/evaluation/__init__.py,sha256=atDqjsx74qLrX5FY_wyWi2TL8i8ZELZRsTU9c-sx51I,609
1049
1049
  official/vision/evaluation/coco_evaluator.py,sha256=23wnGNUZB4Tb01Y6fyjxcfgu7MpUsgaEjrMMTbrMMRc,15582
1050
- official/vision/evaluation/coco_utils.py,sha256=mN8Dz_WBIgvrGBhb5PJte0qTW09mXjL-PwIuE4F_nwU,17860
1050
+ official/vision/evaluation/coco_utils.py,sha256=uCbRRe78-ZNKNss2V3WejHTfOO3dj2zzrcYWzZzgmns,17872
1051
1051
  official/vision/evaluation/coco_utils_test.py,sha256=B_8jj1YkgipPOr3BzNrwXjXgVOt-_k6kesCFB5kkxDA,3199
1052
1052
  official/vision/evaluation/instance_metrics.py,sha256=m61_ApFqCwOGsbGtXa0NGMxlLYyx_cqcUQDPOPRpdWM,29114
1053
1053
  official/vision/evaluation/instance_metrics_test.py,sha256=J9Jf4_Oc2ULJF9pwD3ikO1Wiebq4GB4dbWSr3Lxm16I,10823
@@ -1248,9 +1248,9 @@ tensorflow_models/tensorflow_models_test.py,sha256=yiAneltAW3NHSj3fUSvHNBjfq0MGZ
1248
1248
  tensorflow_models/nlp/__init__.py,sha256=8uQd4wI6Zc4IJMPjtQifMeWVbPFkTxqYh66wfivCOL4,807
1249
1249
  tensorflow_models/uplift/__init__.py,sha256=NzaweFf4ZmhRb2l_fuV6bP-2N8oSO3xu6xJqVb1UmpY,999
1250
1250
  tensorflow_models/vision/__init__.py,sha256=ks420Ooqzi0hU7HnQpM5rylLaE-YcJdJkBx_umVaXlE,833
1251
- tf_models_nightly-2.20.0.dev20251106.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
1252
- tf_models_nightly-2.20.0.dev20251106.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
1253
- tf_models_nightly-2.20.0.dev20251106.dist-info/METADATA,sha256=hAiVT3AJkJAsf2opEbBOBlWtg54F_t6-gNQobBmNW7A,1432
1254
- tf_models_nightly-2.20.0.dev20251106.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
1255
- tf_models_nightly-2.20.0.dev20251106.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
1256
- tf_models_nightly-2.20.0.dev20251106.dist-info/RECORD,,
1251
+ tf_models_nightly-2.20.0.dev20260109.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
1252
+ tf_models_nightly-2.20.0.dev20260109.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
1253
+ tf_models_nightly-2.20.0.dev20260109.dist-info/METADATA,sha256=kySce29gd90FHA2kt9WkRiZsB76xRkwQ30wvkbm43BM,1432
1254
+ tf_models_nightly-2.20.0.dev20260109.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
1255
+ tf_models_nightly-2.20.0.dev20260109.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
1256
+ tf_models_nightly-2.20.0.dev20260109.dist-info/RECORD,,