Skip to content

which version of tensorflow/keras/python is? #2

Description

@JasonYang8119

Hello, when I tried to reproduce your article, using your mmFall.ipynb. I met these bugs:
And it seems the reason is dismatch of version of tensorflow/keras/python?

My version: python=3.9, tensorflow=2.7 with keras include

So could you show your tf/keras/python version?

Thanks!

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_17888/961939578.py in <module>
----> 1 HVRAE_result = AE.HVRAE_SL_predict(samples)

/tmp/ipykernel_17888/1483391771.py in HVRAE_SL_predict(self, inferencedata)
    294             # Load the saved model
    295 
--> 296         model = load_model(self.model_dir + 'HVRAE_SL_mdl.h5', compile=False,
    297                            custom_objects={'sampling': sampling_predict, 'tf': tf})
    298         adam = optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, amsgrad=False)

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/saving/save.py in load_model(filepath, custom_objects, compile, options)
    198         if (h5py is not None and
    199             (isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))):
--> 200           return hdf5_format.load_model_from_hdf5(filepath, custom_objects,
    201                                                   compile)
    202 

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/saving/hdf5_format.py in load_model_from_hdf5(filepath, custom_objects, compile)
    178       model_config = model_config.decode('utf-8')
    179     model_config = json_utils.decode(model_config)
--> 180     model = model_config_lib.model_from_config(model_config,
    181                                                custom_objects=custom_objects)
    182 

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/saving/model_config.py in model_from_config(config, custom_objects)
     50                     '`Sequential.from_config(config)`?')
     51   from keras.layers import deserialize  # pylint: disable=g-import-not-at-top
---> 52   return deserialize(config, custom_objects=custom_objects)
     53 
     54 

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/layers/serialization.py in deserialize(config, custom_objects)
    206   """
    207   populate_deserializable_objects()
--> 208   return generic_utils.deserialize_keras_object(
    209       config,
    210       module_objects=LOCAL.ALL_OBJECTS,

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    672 
    673       if 'custom_objects' in arg_spec.args:
--> 674         deserialized_obj = cls.from_config(
    675             cls_config,
    676             custom_objects=dict(

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/engine/training.py in from_config(cls, config, custom_objects)
   2395     with generic_utils.SharedObjectLoadingScope():
   2396       input_tensors, output_tensors, created_layers = (
-> 2397           functional.reconstruct_from_config(config, custom_objects))
   2398       # Initialize a model belonging to `cls`, which can be user-defined or
   2399       # `Functional`.

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/engine/functional.py in reconstruct_from_config(config, custom_objects, created_layers)
   1271   # First, we create all layers and enqueue nodes to be processed
   1272   for layer_data in config['layers']:
-> 1273     process_layer(layer_data)
   1274   # Then we process nodes in order of layer depth.
   1275   # Nodes that cannot yet be processed (if the inbound node

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/engine/functional.py in process_layer(layer_data)
   1253       from keras.layers import deserialize as deserialize_layer  # pylint: disable=g-import-not-at-top
   1254 
-> 1255       layer = deserialize_layer(layer_data, custom_objects=custom_objects)
   1256       created_layers[layer_name] = layer
   1257 

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/layers/serialization.py in deserialize(config, custom_objects)
    206   """
    207   populate_deserializable_objects()
--> 208   return generic_utils.deserialize_keras_object(
    209       config,
    210       module_objects=LOCAL.ALL_OBJECTS,

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
    672 
    673       if 'custom_objects' in arg_spec.args:
--> 674         deserialized_obj = cls.from_config(
    675             cls_config,
    676             custom_objects=dict(

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/layers/core.py in from_config(cls, config, custom_objects)
   1003   def from_config(cls, config, custom_objects=None):
   1004     config = config.copy()
-> 1005     function = cls._parse_function_from_config(
   1006         config, custom_objects, 'function', 'module', 'function_type')
   1007 

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/layers/core.py in _parse_function_from_config(cls, config, custom_objects, func_attr_name, module_attr_name, func_type_attr_name)
   1055     elif function_type == 'lambda':
   1056       # Unsafe deserialization from bytecode
-> 1057       function = generic_utils.func_load(
   1058           config[func_attr_name], globs=globs)
   1059     elif function_type == 'raw':

/opt/anaconda3/envs/yjtf/lib/python3.9/site-packages/keras/utils/generic_utils.py in func_load(code, defaults, closure, globs)
    787   except (UnicodeEncodeError, binascii.Error):
    788     raw_code = code.encode('raw_unicode_escape')
--> 789   code = marshal.loads(raw_code)
    790   if globs is None:
    791     globs = globals()

ValueError: bad marshal data (unknown type code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions