tf-keras-nightly 2.20.0.dev2025032009__py3-none-any.whl → 2.20.0.dev2025032109__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.
- tf_keras/__init__.py +1 -1
- tf_keras/src/saving/saving_api.py +18 -5
- {tf_keras_nightly-2.20.0.dev2025032009.dist-info → tf_keras_nightly-2.20.0.dev2025032109.dist-info}/METADATA +1 -1
- {tf_keras_nightly-2.20.0.dev2025032009.dist-info → tf_keras_nightly-2.20.0.dev2025032109.dist-info}/RECORD +6 -6
- {tf_keras_nightly-2.20.0.dev2025032009.dist-info → tf_keras_nightly-2.20.0.dev2025032109.dist-info}/WHEEL +1 -1
- {tf_keras_nightly-2.20.0.dev2025032009.dist-info → tf_keras_nightly-2.20.0.dev2025032109.dist-info}/top_level.txt +0 -0
tf_keras/__init__.py
CHANGED
@@ -24,6 +24,7 @@ from tensorflow.python.util.tf_export import keras_export
|
|
24
24
|
|
25
25
|
from tf_keras.src.saving import saving_lib
|
26
26
|
from tf_keras.src.saving.legacy import save as legacy_sm_saving_lib
|
27
|
+
from tf_keras.src.saving.legacy import saving_utils
|
27
28
|
from tf_keras.src.utils import io_utils
|
28
29
|
|
29
30
|
try:
|
@@ -75,8 +76,7 @@ class SupportWriteToRemote:
|
|
75
76
|
supports remoted saved model out of the box.
|
76
77
|
"""
|
77
78
|
|
78
|
-
def __init__(self, filepath, overwrite
|
79
|
-
save_format = get_save_format(filepath, save_format=save_format)
|
79
|
+
def __init__(self, filepath, overwrite, save_format):
|
80
80
|
self.overwrite = overwrite
|
81
81
|
if saving_lib.is_remote_path(filepath) and save_format != "tf":
|
82
82
|
self.temp_directory = tempfile.TemporaryDirectory()
|
@@ -191,14 +191,14 @@ def save_model(model, filepath, overwrite=True, save_format=None, **kwargs):
|
|
191
191
|
when loading the model. See the `custom_objects` argument in
|
192
192
|
`tf.keras.saving.load_model`.
|
193
193
|
"""
|
194
|
+
save_format = get_save_format(filepath, save_format)
|
195
|
+
|
194
196
|
# Supports remote paths via a temporary file
|
195
197
|
with SupportWriteToRemote(
|
196
198
|
filepath,
|
197
199
|
overwrite=overwrite,
|
198
200
|
save_format=save_format,
|
199
201
|
) as local_filepath:
|
200
|
-
save_format = get_save_format(filepath, save_format)
|
201
|
-
|
202
202
|
# Deprecation warnings
|
203
203
|
if save_format == "h5":
|
204
204
|
warnings.warn(
|
@@ -307,8 +307,12 @@ def load_model(
|
|
307
307
|
|
308
308
|
|
309
309
|
def save_weights(model, filepath, overwrite=True, **kwargs):
|
310
|
+
save_format = get_save_weights_format(filepath)
|
311
|
+
|
310
312
|
# Supports remote paths via a temporary file
|
311
|
-
with SupportWriteToRemote(
|
313
|
+
with SupportWriteToRemote(
|
314
|
+
filepath, overwrite=overwrite, save_format=save_format
|
315
|
+
) as local_filepath:
|
312
316
|
if str(local_filepath).endswith(".weights.h5"):
|
313
317
|
# If file exists and should not be overwritten.
|
314
318
|
try:
|
@@ -386,3 +390,12 @@ def get_save_format(filepath, save_format):
|
|
386
390
|
else:
|
387
391
|
return "h5"
|
388
392
|
|
393
|
+
|
394
|
+
def get_save_weights_format(filepath):
|
395
|
+
filepath = io_utils.path_to_string(filepath)
|
396
|
+
filepath_is_h5 = saving_utils.is_hdf5_filepath(filepath)
|
397
|
+
if filepath_is_h5:
|
398
|
+
return "h5"
|
399
|
+
else:
|
400
|
+
return "tf"
|
401
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tf_keras/__init__.py,sha256=
|
1
|
+
tf_keras/__init__.py,sha256=xXFhiHhs0Iue2KnVgnIGN4N7gFb7t9KxLAG_uPhzzT4,911
|
2
2
|
tf_keras/__internal__/__init__.py,sha256=OHQbeIC0QtRBI7dgXaJaVbH8F00x8dCI-DvEcIfyMsE,671
|
3
3
|
tf_keras/__internal__/backend/__init__.py,sha256=LnMs2A6685gDG79fxqmdulIYlVE_3WmXlBTBo9ZWYcw,162
|
4
4
|
tf_keras/__internal__/layers/__init__.py,sha256=F5SGMhOTPzm-PR44VrfinURHcVeQPIEdwnZlAkSTB3A,176
|
@@ -537,7 +537,7 @@ tf_keras/src/preprocessing/text.py,sha256=aomzwE3G2ErwzgL_Dj3ERA_2k7TZclaPMTBTrW
|
|
537
537
|
tf_keras/src/saving/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
538
538
|
tf_keras/src/saving/object_registration.py,sha256=N8aV6eqREYjW2ueQpL3guYHyh5KXuun3DZAlmjfYrTA,7830
|
539
539
|
tf_keras/src/saving/pickle_utils.py,sha256=5GtHzwNWVaYfZ-0zn69-zn2yv3R6JUwzHOOamnjP7r0,2605
|
540
|
-
tf_keras/src/saving/saving_api.py,sha256=
|
540
|
+
tf_keras/src/saving/saving_api.py,sha256=7uIWY4uwQMtETP5yRjZYPii-E-sWzSuK0ljVMfnZe_k,15119
|
541
541
|
tf_keras/src/saving/saving_lib.py,sha256=Rk5rOvxEmCvwUlG3bS0QpOgtURayYmIAZbh2GeTuUOc,24272
|
542
542
|
tf_keras/src/saving/serialization_lib.py,sha256=kX4qf_fRp4LySkH9FU37DMd0AXxiUrXKT-VLR3JPl7w,30152
|
543
543
|
tf_keras/src/saving/legacy/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
@@ -606,7 +606,7 @@ tf_keras/src/utils/legacy/__init__.py,sha256=EfMmeHYDzwvxNaktPhQbkTdcPSIGCqMhBND
|
|
606
606
|
tf_keras/utils/__init__.py,sha256=b7_d-USe_EmLo02_P99Q1rUCzKBYayPCfiYFStP-0nw,2735
|
607
607
|
tf_keras/utils/experimental/__init__.py,sha256=DzGogE2AosjxOVILQBT8PDDcqbWTc0wWnZRobCdpcec,97
|
608
608
|
tf_keras/utils/legacy/__init__.py,sha256=7ujlDa5HeSRcth2NdqA0S1P2-VZF1kB3n68jye6Dj-8,189
|
609
|
-
tf_keras_nightly-2.20.0.
|
610
|
-
tf_keras_nightly-2.20.0.
|
611
|
-
tf_keras_nightly-2.20.0.
|
612
|
-
tf_keras_nightly-2.20.0.
|
609
|
+
tf_keras_nightly-2.20.0.dev2025032109.dist-info/METADATA,sha256=7_IStzcQqT3ZEgiYsF3ZEZIhNwAOdkpJGdsZBQ3l6WM,1857
|
610
|
+
tf_keras_nightly-2.20.0.dev2025032109.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
611
|
+
tf_keras_nightly-2.20.0.dev2025032109.dist-info/top_level.txt,sha256=LC8FK7zHDNKxB17C6lGKvrZ_fZZGJsRiBK23SfiDegY,9
|
612
|
+
tf_keras_nightly-2.20.0.dev2025032109.dist-info/RECORD,,
|
File without changes
|