tf-models-nightly 2.19.0.dev20250310__py2.py3-none-any.whl → 2.19.0.dev20250312__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.
@@ -246,8 +246,11 @@ class Config(params_dict.ParamsDict):
246
246
  # If the key not exist or the value is None, a new Config-family object
247
247
  # sould be created for the key.
248
248
  self.__dict__[k] = subconfig_type(v)
249
- else:
249
+ elif hasattr(self.__dict__[k], 'override'):
250
250
  self.__dict__[k].override(v)
251
+ else:
252
+ # The key exists but it cannot be overridden. For example, it's a str.
253
+ self.__dict__[k] = subconfig_type(v)
251
254
  elif not is_null(k) and isinstance(v, self.SEQUENCE_TYPES) and all(
252
255
  [not isinstance(e, self.IMMUTABLE_TYPES) for e in v]):
253
256
  if len(self.__dict__[k]) == len(v):
@@ -300,9 +303,11 @@ class Config(params_dict.ParamsDict):
300
303
  else:
301
304
  self._set(k, v)
302
305
  else:
303
- if isinstance(v, dict) and self.__dict__[k]:
306
+ if isinstance(v, dict) and hasattr(self.__dict__[k], '_override'):
304
307
  self.__dict__[k]._override(v, is_strict) # pylint: disable=protected-access
305
- elif isinstance(v, params_dict.ParamsDict) and self.__dict__[k]:
308
+ elif isinstance(v, params_dict.ParamsDict) and hasattr(
309
+ self.__dict__[k], '_override'
310
+ ):
306
311
  self.__dict__[k]._override(v.as_dict(), is_strict) # pylint: disable=protected-access
307
312
  else:
308
313
  self._set(k, v)
@@ -334,6 +334,17 @@ class BaseConfigTest(parameterized.TestCase, tf.test.TestCase):
334
334
  self.assertEqual(type(params.a[1].c), base_config.Config)
335
335
  self.assertEqual(pprint.pformat(params.a[1].c.d), '5')
336
336
 
337
+ def test_override_scalar_with_dict_replaces_the_whole_value(self):
338
+ params = base_config.Config({'a': 1})
339
+ params.override({'a': {'b': 2}}, is_strict=False)
340
+ self.assertEqual(type(params.a), base_config.Config)
341
+ self.assertEqual(params.a.b, 2)
342
+
343
+ def test_override_dict_with_scalar_replaces_the_whole_value(self):
344
+ params = base_config.Config({'a': {'b': 2}})
345
+ params.override({'a': 1}, is_strict=False)
346
+ self.assertEqual(params.a, 1)
347
+
337
348
  @parameterized.parameters(
338
349
  ([{}],),
339
350
  (({},),),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tf-models-nightly
3
- Version: 2.19.0.dev20250310
3
+ Version: 2.19.0.dev20250312
4
4
  Summary: TensorFlow Official Models
5
5
  Home-page: https://github.com/tensorflow/models
6
6
  Author: Google Inc.
@@ -205,8 +205,8 @@ official/modeling/activations/sigmoid_test.py,sha256=BcG8HgPHcddhBHyqIO2xVvw1sBz
205
205
  official/modeling/activations/swish.py,sha256=1T7WlQJ2plHk3JWyBiHz-BFgnkWcwudI_UU_hu6N9UQ,2301
206
206
  official/modeling/activations/swish_test.py,sha256=7cfqupqDQ1_b0F7y7tlXKcqUP4tN7LBxgn8Hjzf4a18,1421
207
207
  official/modeling/hyperparams/__init__.py,sha256=vs543Hge6bXJVYMNcsLBLSv-AvkqiC5FbRziP5gD3uA,846
208
- official/modeling/hyperparams/base_config.py,sha256=mHwYaOj4hwyhlZSh2pxrdJf4-xg00lW-nF_t-LYCKH0,12582
209
- official/modeling/hyperparams/base_config_test.py,sha256=eAg7tcnFDiMINA84LutiPGVqRRDpG4JGSc5mzn_MOxM,13350
208
+ official/modeling/hyperparams/base_config.py,sha256=dN2R7k0KrzyX-FtS9eTjpkEAnntjXHqNvc6cYi3GPII,12822
209
+ official/modeling/hyperparams/base_config_test.py,sha256=fb2E1rakC6WSEIESSqqJPsBQvNMHm0LqewrdCDxYa0U,13809
210
210
  official/modeling/hyperparams/oneof.py,sha256=_fRv3YICiAru-u5q2YT0QEGA1-t8LBsKGAwfN3jwbA0,1870
211
211
  official/modeling/hyperparams/oneof_test.py,sha256=obwub_gkT4El0U5O58damISqVHKF-i5HBeyGA5ot74s,1991
212
212
  official/modeling/hyperparams/params_dict.py,sha256=63fftQdUlycgJErxcyIj7655zL57isskkwLcUP41lfY,17810
@@ -1248,9 +1248,9 @@ tensorflow_models/tensorflow_models_test.py,sha256=nc6A9K53OGqF25xN5St8EiWvdVbda
1248
1248
  tensorflow_models/nlp/__init__.py,sha256=4tA5Pf4qaFwT-fIFOpX7x7FHJpnyJT-5UgOeFYTyMlc,807
1249
1249
  tensorflow_models/uplift/__init__.py,sha256=mqfa55gweOdpKoaQyid4A_4u7xw__FcQeSIF0k_pYmI,999
1250
1250
  tensorflow_models/vision/__init__.py,sha256=zBorY_v5xva1uI-qxhZO3Qh-Dii-Suq6wEYh6hKHDfc,833
1251
- tf_models_nightly-2.19.0.dev20250310.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
1252
- tf_models_nightly-2.19.0.dev20250310.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
1253
- tf_models_nightly-2.19.0.dev20250310.dist-info/METADATA,sha256=UDvoSImT8BD_74xsMWJQfDNAvBitOsA1AU2GlUhaWbs,1432
1254
- tf_models_nightly-2.19.0.dev20250310.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
1255
- tf_models_nightly-2.19.0.dev20250310.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
1256
- tf_models_nightly-2.19.0.dev20250310.dist-info/RECORD,,
1251
+ tf_models_nightly-2.19.0.dev20250312.dist-info/AUTHORS,sha256=1dG3fXVu9jlo7bul8xuix5F5vOnczMk7_yWn4y70uw0,337
1252
+ tf_models_nightly-2.19.0.dev20250312.dist-info/LICENSE,sha256=WxeBS_DejPZQabxtfMOM_xn8qoZNJDQjrT7z2wG1I4U,11512
1253
+ tf_models_nightly-2.19.0.dev20250312.dist-info/METADATA,sha256=GCXdVJjxUgkuOMq91nTKgD8ZHjQbwv6s1uDGW839aUM,1432
1254
+ tf_models_nightly-2.19.0.dev20250312.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
1255
+ tf_models_nightly-2.19.0.dev20250312.dist-info/top_level.txt,sha256=gum2FfO5R4cvjl2-QtP-S1aNmsvIZaFFT6VFzU0f4-g,33
1256
+ tf_models_nightly-2.19.0.dev20250312.dist-info/RECORD,,