keras-nightly 3.14.0.dev2026012904__py3-none-any.whl → 3.14.0.dev2026013004__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.
- keras/src/export/tfsm_layer.py +34 -0
- keras/src/version.py +1 -1
- {keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/METADATA +1 -1
- {keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/RECORD +6 -6
- {keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/WHEEL +0 -0
- {keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/top_level.txt +0 -0
keras/src/export/tfsm_layer.py
CHANGED
|
@@ -2,6 +2,7 @@ from keras.src import backend
|
|
|
2
2
|
from keras.src import layers
|
|
3
3
|
from keras.src.api_export import keras_export
|
|
4
4
|
from keras.src.export.saved_model import _list_variables_used_by_fns
|
|
5
|
+
from keras.src.saving import serialization_lib
|
|
5
6
|
from keras.src.utils.module_utils import tensorflow as tf
|
|
6
7
|
|
|
7
8
|
|
|
@@ -146,3 +147,36 @@ class TFSMLayer(layers.Layer):
|
|
|
146
147
|
"call_training_endpoint": self.call_training_endpoint,
|
|
147
148
|
}
|
|
148
149
|
return {**base_config, **config}
|
|
150
|
+
|
|
151
|
+
@classmethod
|
|
152
|
+
def from_config(cls, config, custom_objects=None, safe_mode=None):
|
|
153
|
+
"""Creates a TFSMLayer from its config.
|
|
154
|
+
Args:
|
|
155
|
+
config: A Python dictionary, typically the output of `get_config`.
|
|
156
|
+
custom_objects: Optional dictionary mapping names to custom objects.
|
|
157
|
+
safe_mode: Boolean, whether to disallow loading TFSMLayer.
|
|
158
|
+
When `safe_mode=True`, loading is disallowed because TFSMLayer
|
|
159
|
+
loads external SavedModels that may contain attacker-controlled
|
|
160
|
+
executable graph code. Defaults to `True`.
|
|
161
|
+
Returns:
|
|
162
|
+
A TFSMLayer instance.
|
|
163
|
+
"""
|
|
164
|
+
# Follow the same pattern as Lambda layer for safe_mode handling
|
|
165
|
+
effective_safe_mode = (
|
|
166
|
+
safe_mode
|
|
167
|
+
if safe_mode is not None
|
|
168
|
+
else serialization_lib.in_safe_mode()
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
if effective_safe_mode is not False:
|
|
172
|
+
raise ValueError(
|
|
173
|
+
"Requested the deserialization of a `TFSMLayer`, which "
|
|
174
|
+
"loads an external SavedModel. This carries a potential risk "
|
|
175
|
+
"of arbitrary code execution and thus it is disallowed by "
|
|
176
|
+
"default. If you trust the source of the artifact, you can "
|
|
177
|
+
"override this error by passing `safe_mode=False` to the "
|
|
178
|
+
"loading function, or calling "
|
|
179
|
+
"`keras.config.enable_unsafe_deserialization()."
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
return cls(**config)
|
keras/src/version.py
CHANGED
{keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/RECORD
RENAMED
|
@@ -128,7 +128,7 @@ keras/regularizers/__init__.py,sha256=542Shphw7W8h4Dyf2rmqMKUECVZ8IVBvN9g1LWhz-b
|
|
|
128
128
|
keras/saving/__init__.py,sha256=KvL2GZxjvgFgEhvEnkvqjIR9JSNHKz-NWZacXajsjLI,1298
|
|
129
129
|
keras/src/__init__.py,sha256=Gi4S7EiCMkE03PbdGNpFdaUYySWDs_FcAJ8Taz9Y1BE,684
|
|
130
130
|
keras/src/api_export.py,sha256=gXOkBOnmscV013WAc75lc4Up01-Kkg9EylIAT_QWctg,1173
|
|
131
|
-
keras/src/version.py,sha256=
|
|
131
|
+
keras/src/version.py,sha256=sugzf2kmyUHN_9NvPsvrMcSU7NJ1B4_jh4ZT3tywAPw,204
|
|
132
132
|
keras/src/activations/__init__.py,sha256=0nL3IFDB9unlrMz8ninKOWo-uCHasTUpTo1tXZb2u44,4433
|
|
133
133
|
keras/src/activations/activations.py,sha256=mogPggtp4CGldI3VOPNmesRxp6EbiR1_i4KLGaVwzL8,17614
|
|
134
134
|
keras/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -288,7 +288,7 @@ keras/src/export/onnx.py,sha256=XsVSmNmxJDQrDuUANKFo8smOSm4BBYm35bR1AW9OWFo,8404
|
|
|
288
288
|
keras/src/export/openvino.py,sha256=C9QNCOQ8-MwoOr8ZUqQvGzWY_CHOb8yDlMIJ9NYsLyw,7626
|
|
289
289
|
keras/src/export/saved_model.py,sha256=bxcsVd87MXnw3ENKu_dbUc8JzPFqjOAPbLL0U5KqG-g,28425
|
|
290
290
|
keras/src/export/tf2onnx_lib.py,sha256=cvHXS84Ocjcp1cTh5SziXAzNUsZ51RqjXNhOk5IlNDs,7234
|
|
291
|
-
keras/src/export/tfsm_layer.py,sha256=
|
|
291
|
+
keras/src/export/tfsm_layer.py,sha256=7qOYvUwtHluDykQtob4VgtN88EzsAgzk8MDsWolvB38,7545
|
|
292
292
|
keras/src/initializers/__init__.py,sha256=tG7qxC2J0PDhO_L2W95sJXNIduL7F5lqHvUuJ7EIhXE,5662
|
|
293
293
|
keras/src/initializers/constant_initializers.py,sha256=CvTyqbkcvvhwLlKYf8jqwlS-F2-Uj2c13si8Wjc4tmQ,10072
|
|
294
294
|
keras/src/initializers/initializer.py,sha256=kNAyRA8CzBdtknT6ZUt5XIO2_Z9NzpN119CId7wT1Vg,2632
|
|
@@ -618,7 +618,7 @@ keras/utils/bounding_boxes/__init__.py,sha256=jtvQll4u8ZY0Z96HwNhP1nxWEG9FM3gI-6
|
|
|
618
618
|
keras/utils/legacy/__init__.py,sha256=oSYZz6uS8UxSElRaaJYWJEoweJ4GAasZjnn7fNaOlog,342
|
|
619
619
|
keras/visualization/__init__.py,sha256=UKWmiy6sps4SWlmQi9WX8_Z53cPpLlphz2zIeHdwJpQ,722
|
|
620
620
|
keras/wrappers/__init__.py,sha256=QkS-O5K8qGS7C3sytF8MpmO6PasATpNVGF8qtb7Ojsw,407
|
|
621
|
-
keras_nightly-3.14.0.
|
|
622
|
-
keras_nightly-3.14.0.
|
|
623
|
-
keras_nightly-3.14.0.
|
|
624
|
-
keras_nightly-3.14.0.
|
|
621
|
+
keras_nightly-3.14.0.dev2026013004.dist-info/METADATA,sha256=GWxxPph96QHPcDPSOZc31FSyWqX95K2FCM55ccwy9Ys,6339
|
|
622
|
+
keras_nightly-3.14.0.dev2026013004.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
623
|
+
keras_nightly-3.14.0.dev2026013004.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
|
|
624
|
+
keras_nightly-3.14.0.dev2026013004.dist-info/RECORD,,
|
{keras_nightly-3.14.0.dev2026012904.dist-info → keras_nightly-3.14.0.dev2026013004.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|