This is the error message please help me to solve it out
ValueError Traceback (most recent call last)
Cell In[20], line 6
4 loaded_model_json = json_file.read()
5 json_file.close()
----> 6 model = model_from_json(loaded_model_json)
7 model.load_weights(‘keras-facenet-h5/model.h5’)
File ~\anaconda3\Lib\site-packages\keras\src\saving\legacy\model_config.py:125, in model_from_json(json_string, custom_objects)
102 “”“Parses a JSON model configuration string and returns a model instance.
103
104 Usage:
(…)
119 A Keras model instance (uncompiled).
120 “””
121 from keras.src.layers import (
122 deserialize_from_json,
123 )
→ 125 return deserialize_from_json(json_string, custom_objects=custom_objects)
File ~\anaconda3\Lib\site-packages\keras\src\layers\serialization.py:299, in deserialize_from_json(json_string, custom_objects)
293 populate_deserializable_objects()
294 config = json_utils.decode_and_deserialize(
295 json_string,
296 module_objects=LOCAL.ALL_OBJECTS,
297 custom_objects=custom_objects,
298 )
→ 299 return deserialize(config, custom_objects)
File ~\anaconda3\Lib\site-packages\keras\src\layers\serialization.py:276, in deserialize(config, custom_objects, use_legacy_format)
268 if use_legacy_format:
269 return legacy_serialization.deserialize_keras_object(
270 config,
271 module_objects=LOCAL.ALL_OBJECTS,
272 custom_objects=custom_objects,
273 printable_module_name=“layer”,
274 )
→ 276 return serialization_lib.deserialize_keras_object(
277 config,
278 module_objects=LOCAL.ALL_OBJECTS,
279 custom_objects=custom_objects,
280 printable_module_name=“layer”,
281 )
File ~\anaconda3\Lib\site-packages\keras\src\saving\serialization_lib.py:609, in deserialize_keras_object(config, custom_objects, safe_mode, **kwargs)
602 if isinstance(module_objects[config], types.FunctionType):
603 return deserialize_keras_object(
604 serialize_with_public_fn(
605 module_objects[config], config, fn_module_name
606 ),
607 custom_objects=custom_objects,
608 )
→ 609 return deserialize_keras_object(
610 serialize_with_public_class(
611 module_objects[config], inner_config=inner_config
612 ),
613 custom_objects=custom_objects,
614 )
616 if isinstance(config, PLAIN_TYPES):
617 return config
File ~\anaconda3\Lib\site-packages\keras\src\saving\serialization_lib.py:728, in deserialize_keras_object(config, custom_objects, safe_mode, **kwargs)
726 safe_mode_scope = SafeModeScope(safe_mode)
727 with custom_obj_scope, safe_mode_scope:
→ 728 instance = cls.from_config(inner_config)
729 build_config = config.get(“build_config”, None)
730 if build_config:
File ~\anaconda3\Lib\site-packages\keras\src\engine\training.py:3306, in Model.from_config(cls, config, custom_objects)
3298 revivable_as_functional = (
3299 cls in {functional.Functional, Model}
3300 or argspec.args[1:] == functional_init_args
3301 or (argspec.varargs == “args” and argspec.varkw == “kwargs”)
3302 )
3303 if is_functional_config and revivable_as_functional:
3304 # Revive Functional model
3305 # (but not Functional subclasses with a custom init)
→ 3306 inputs, outputs, layers = functional.reconstruct_from_config(
3307 config, custom_objects
3308 )
3309 model = cls(
3310 inputs=inputs, outputs=outputs, name=config.get(“name”)
3311 )
3312 functional.connect_ancillary_layers(model, layers)
File ~\anaconda3\Lib\site-packages\keras\src\engine\functional.py:1493, in reconstruct_from_config(config, custom_objects, created_layers)
1491 # First, we create all layers and enqueue nodes to be processed
1492 for layer_data in config[“layers”]:
→ 1493 process_layer(layer_data)
1494 # Then we process nodes in order of layer depth.
1495 # Nodes that cannot yet be processed (if the inbound node
1496 # does not yet exist) are re-enqueued, and the process
1497 # is repeated until all nodes are processed.
1498 while unprocessed_nodes:
File ~\anaconda3\Lib\site-packages\keras\src\engine\functional.py:1474, in reconstruct_from_config..process_layer(layer_data)
1470 else:
1471 # Instantiate layer.
1472 from keras.src.layers import deserialize as deserialize_layer
→ 1474 layer = deserialize_layer(layer_data, custom_objects=custom_objects)
1475 created_layers[layer_name] = layer
1477 node_count_by_layer[layer] = int(_should_skip_first_node(layer))
File ~\anaconda3\Lib\site-packages\keras\src\layers\serialization.py:276, in deserialize(config, custom_objects, use_legacy_format)
268 if use_legacy_format:
269 return legacy_serialization.deserialize_keras_object(
270 config,
271 module_objects=LOCAL.ALL_OBJECTS,
272 custom_objects=custom_objects,
273 printable_module_name=“layer”,
274 )
→ 276 return serialization_lib.deserialize_keras_object(
277 config,
278 module_objects=LOCAL.ALL_OBJECTS,
279 custom_objects=custom_objects,
280 printable_module_name=“layer”,
281 )
File ~\anaconda3\Lib\site-packages\keras\src\saving\serialization_lib.py:609, in deserialize_keras_object(config, custom_objects, safe_mode, **kwargs)
602 if isinstance(module_objects[config], types.FunctionType):
603 return deserialize_keras_object(
604 serialize_with_public_fn(
605 module_objects[config], config, fn_module_name
606 ),
607 custom_objects=custom_objects,
608 )
→ 609 return deserialize_keras_object(
610 serialize_with_public_class(
611 module_objects[config], inner_config=inner_config
612 ),
613 custom_objects=custom_objects,
614 )
616 if isinstance(config, PLAIN_TYPES):
617 return config
File ~\anaconda3\Lib\site-packages\keras\src\saving\serialization_lib.py:728, in deserialize_keras_object(config, custom_objects, safe_mode, **kwargs)
726 safe_mode_scope = SafeModeScope(safe_mode)
727 with custom_obj_scope, safe_mode_scope:
→ 728 instance = cls.from_config(inner_config)
729 build_config = config.get(“build_config”, None)
730 if build_config:
File ~\anaconda3\Lib\site-packages\keras\src\layers\core\lambda_layer.py:327, in Lambda.from_config(cls, config, custom_objects)
324 @classmethod
325 def from_config(cls, config, custom_objects=None):
326 config = config.copy()
→ 327 function = cls._parse_function_from_config(
328 config, custom_objects, “function”, “module”, “function_type”
329 )
331 output_shape = cls._parse_function_from_config(
332 config,
333 custom_objects,
(…)
336 “output_shape_type”,
337 )
338 if “mask” in config:
File ~\anaconda3\Lib\site-packages\keras\src\layers\core\lambda_layer.py:394, in Lambda._parse_function_from_config(cls, config, custom_objects, func_attr_name, module_attr_name, func_type_attr_name)
392 elif function_type == “lambda”:
393 if serialization_lib.in_safe_mode():
→ 394 raise ValueError(
395 "Requested the deserialization of a Lambda layer with a "
396 "Python lambda
inside it. "
397 "This carries a potential risk of arbitrary code execution "
398 "and thus it is disallowed by default. If you trust the "
399 "source of the saved model, you can pass safe_mode=False
"
400 "to the loading function in order to allow "
401 “Lambda layer loading.”
402 )
403 # /!\ Unsafe deserialization from bytecode! Danger! /!
404 function = generic_utils.func_load(
405 config[func_attr_name], globs=globs
406 )
ValueError: Requested the deserialization of a Lambda layer with a Python lambda
inside it. This carries a potential risk of arbitrary code execution and thus it is disallowed by default. If you trust the source of the saved model, you can pass safe_mode=False
to the loading function in order to allow Lambda layer loading.