interseismic / generalized-phase-detection

MIT License
76 stars 34 forks source link

The GPD model can not be loaded #5

Open JUNZHU-SEIS opened 3 years ago

JUNZHU-SEIS commented 3 years ago

Script

python gpd_predict.py -V -I anza2016.in -O anza2016.out

Error message

2021-10-19 10:06:32.133010: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
Traceback (most recent call last):
  File "/home/as/Work/tmp/MultiPhasePickerTest/code/generalized-phase-detection/gpd_predict.py", line 165, in <module>
    model = model_from_json(loaded_model_json, custom_objects={'tf':tf})
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/saving/model_config.py", line 131, in model_from_json
    return deserialize(config, custom_objects=custom_objects)
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/layers/serialization.py", line 173, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 354, in deserialize_keras_object
    return cls.from_config(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/engine/training.py", line 2261, in from_config
    return functional.Functional.from_config(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/engine/functional.py", line 668, in from_config
    input_tensors, output_tensors, created_layers = reconstruct_from_config(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/engine/functional.py", line 1275, in reconstruct_from_config
    process_layer(layer_data)
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/engine/functional.py", line 1257, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/layers/serialization.py", line 173, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 354, in deserialize_keras_object
    return cls.from_config(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/layers/core.py", line 1019, in from_config
    function = cls._parse_function_from_config(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/layers/core.py", line 1071, in _parse_function_from_config
    function = generic_utils.func_load(
  File "/home/as/anaconda3/envs/tf_gpu/lib/python3.9/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 457, in func_load
    code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)

My environment

keras=2.4.3
python=3.9.6
tensorflow=2.4.1

Any reply is appreciated.

jamm1985 commented 3 years ago

@JUNZHU-SEIS please check that https://github.com/interseismic/generalized-phase-detection/pull/4

jamm1985 commented 3 years ago

In https://github.com/jamm1985/seismo-performer we redeployed original GPD model to tf 2.5.0. So it works by several lines of code.

/cc @JUNZHU-SEIS