smousavi05 / EQTransformer

EQTransformer, a python package for earthquake signal detection and phase picking using AI.
https://rebrand.ly/EQT-documentations
MIT License
311 stars 150 forks source link

Issue running mseed_predictor #148

Closed smarty92 closed 1 year ago

smarty92 commented 1 year ago

Hi Mostafa,

First, thanks for EQtransformer.

I am trying to run the examples you give in the repositiry and I always get the same error when running mseed_predictor:

from EQTransformer.core.tester import tester tester(input_hdf5='../ModelsAndSampleData/100samples.hdf5', input_testset='test_trainer_outputs/test.npy', input_model='test_trainer_outputs/models/test_trainer_001.h5', output_name='test_tester', detection_threshold=0.20,
P_threshold=0.1, S_threshold=0.1, number_of_plots=3, estimate_uncertainty=True, number_of_sampling=2, input_dimention=(6000, 3), normalization_mode='std', mode='generator', batch_size=10, gpuid=None, gpu_limit=True)

The error is (highlighted in bold be):


AttributeError Traceback (most recent call last) /var/folders/hk/8hn1s5ss2zvf6wpft48lp8kh0000gp/T/ipykernel_92020/3605129233.py in 15 batch_size=10, 16 gpuid=None, ---> 17 gpu_limit=None)

~/miniconda3/envs/eqt/lib/python3.7/site-packages/EQTransformer/core/tester.py in tester(input_hdf5, input_testset, input_model, output_name, detection_threshold, P_threshold, S_threshold, number_of_plots, estimate_uncertainty, number_of_sampling, loss_weights, loss_types, input_dimention, normalization_mode, mode, batch_size, gpuid, gpu_limit) 177 'FeedForward': FeedForward, 178 'LayerNormalization': LayerNormalization, --> 179 'f1': f1 180 }) 181

~/miniconda3/envs/eqt/lib/python3.7/site-packages/keras/engine/saving.py in load_wrapper(*args, *kwargs) 490 os.remove(tmp_filepath) 491 return res --> 492 return load_function(args, **kwargs) 493 494 return load_wrapper

~/miniconda3/envs/eqt/lib/python3.7/site-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile) 582 if H5Dict.is_supported_type(filepath): 583 with H5Dict(filepath, mode='r') as h5dict: --> 584 model = _deserialize_model(h5dict, custom_objects, compile) 585 elif hasattr(filepath, 'write') and callable(filepath.write): 586 def load_function(h5file):

~/miniconda3/envs/eqt/lib/python3.7/site-packages/keras/engine/saving.py in _deserialize_model(h5dict, custom_objects, compile) 271 if model_config is None: 272 raise ValueError('No model found in config.') --> 273 model_config = json.loads(model_config.decode('utf-8')) 274 model = model_from_config(model_config, custom_objects=custom_objects) 275 model_weights_group = h5dict['model_weights']

AttributeError: 'str' object has no attribute 'decode'


Do you have an idea how to fix that ? I guess it says that .decode does not apply to strings but I can't figure out how to fix it.

Thanks for your help,

Samson

smousavi05 commented 1 year ago

@smarty92 Hi Samson, How did you install EQT? Do you have the correct TF and Kerass versions? Are you using Windows or Mac?