LiLabAtVT / DeepTE

Neural network classification of TE
BSD 3-Clause "New" or "Revised" License
81 stars 7 forks source link

TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto. #27

Open dzwzs opened 1 year ago

dzwzs commented 1 year ago
TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto.

I don't know how to solve the above problem!

songliVT commented 1 year ago

Can you provide more context of this error?

Song

On Thu, Jul 27, 2023 at 2:39 AM dzwzs @.***> wrote:

TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto.

I don't know how to solve the above problem!

— Reply to this email directly, view it on GitHub https://github.com/LiLabAtVT/DeepTE/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEEENSTJISVQB4GS5QPZKLXSIEI3ANCNFSM6AAAAAA2ZTFVOU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Associate Professor in Plant Genomics and Bioinformatics School of Plant and Environmental Sciences Virginia Polytechnic Institute and State University

zoom https://virginiatech.zoom.us/j/8790572835

dzwzs commented 1 year ago
2023-07-27 14:33:37.270501: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
start time is 1690439617.219262
Step1: transfer fasta data to CNN input data
Step2: classify TEs
Step2: 2) domain information is not exist
Traceback (most recent call last):
  File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 274, in <module>
    main()
  File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 249, in main
    pipeline_no_m.classify_pipeline(model_dir, input_CNN_data_file, temp_store_opt_dir, sp_type,te_fam,prop_thr)
  File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 339, in classify_pipeline
    predict_te(model_file_dic[model_name], model_name, x_all_test_list, y_all_test_nm_list,input_spe_type,y_all_test_nm_list,prop_thr)
  File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 210, in predict_te
    model = load_model(model)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/save.py", line 201, in load_model
    compile)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/hdf5_format.py", line 181, in load_model_from_hdf5
    custom_objects=custom_objects)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/model_config.py", line 52, in model_from_config
    return deserialize(config, custom_objects=custom_objects)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/layers/serialization.py", line 212, in deserialize
    printable_module_name='layer')
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 678, in deserialize_keras_object
    list(custom_objects.items())))
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/sequential.py", line 430, in from_config
    model = cls(name=name)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/sequential.py", line 108, in __init__
    name=name, autocast=False)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/training.py", line 289, in __init__
    self._init_batch_counters()
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/training.py", line 297, in _init_batch_counters
    self._train_counter = tf.Variable(0, dtype='int64', aggregation=agg)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 268, in __call__
    return cls._variable_v2_call(*args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 262, in _variable_v2_call
    shape=shape)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 243, in <lambda>
    previous_getter = lambda **kws: default_variable_creator_v2(None, **kws)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2675, in default_variable_creator_v2
    shape=shape)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 270, in __call__
    return super(VariableMetaclass, cls).__call__(*args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1613, in __init__
    distribute_strategy=distribute_strategy)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1761, in _init_from_args
    graph_mode=self._in_graph_mode)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 239, in eager_safe_variable_handle
    graph_mode, initial_value)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 179, in _variable_handle_from_shape_and_dtype
    shape=shape.as_proto(), dtype=dtype.as_datatype_enum))
TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto.

I looked online and it seems to be a problem with Python. I followed the method on the Internet to solve it, but it didn't run. Hope to get your help!

songliVT commented 1 year ago

This package was developed with tensorflow 1, not 2. Can you install a lower version of tensorflow and try it again?

Song

On Thu, Jul 27, 2023 at 9:25 AM dzwzs @.***> wrote:

2023-07-27 14:33:37.270501: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. start time is 1690439617.219262 Step1: transfer fasta data to CNN input data Step2: classify TEs Step2: 2) domain information is not exist Traceback (most recent call last): File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 274, in main() File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 249, in main pipeline_no_m.classify_pipeline(model_dir, input_CNN_data_file, temp_store_opt_dir, sp_type,te_fam,prop_thr) File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 339, in classify_pipeline predict_te(model_file_dic[model_name], model_name, x_all_test_list, y_all_test_nm_list,input_spe_type,y_all_test_nm_list,prop_thr) File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 210, in predict_te model = load_model(model) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/save.py", line 201, in load_model compile) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/hdf5_format.py", line 181, in load_model_from_hdf5 custom_objects=custom_objects) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/saving/model_config.py", line 52, in model_from_config return deserialize(config, custom_objects=custom_objects) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/layers/serialization.py", line 212, in deserialize printable_module_name='layer') File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 678, in deserialize_keras_object list(custom_objects.items()))) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/sequential.py", line 430, in from_config model = cls(name=name) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper result = method(self, *args, kwargs) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/sequential.py", line 108, in init name=name, autocast=False) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper result = method(self, *args, *kwargs) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/training.py", line 289, in init self._init_batch_counters() File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py", line 530, in _method_wrapper result = method(self, args, kwargs) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/training.py", line 297, in _init_batch_counters self._train_counter = tf.Variable(0, dtype='int64', aggregation=agg) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 268, in call return cls._variable_v2_call(*args, kwargs) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 262, in _variable_v2_call shape=shape) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 243, in previous_getter = lambda kws: default_variable_creator_v2(None, *kws) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 2675, in default_variable_creator_v2 shape=shape) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 270, in call return super(VariableMetaclass, cls).call(args, **kwargs) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1613, in init distribute_strategy=distribute_strategy) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1761, in _init_from_args graph_mode=self._in_graph_mode) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 239, in eager_safe_variable_handle graph_mode, initial_value) File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 179, in _variable_handle_from_shape_and_dtype shape=shape.as_proto(), dtype=dtype.as_datatype_enum)) TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto.

I looked online and it seems to be a problem with Python. I followed the method on the Internet to solve it, but it didn't run. Hope to get your help!

— Reply to this email directly, view it on GitHub https://github.com/LiLabAtVT/DeepTE/issues/27#issuecomment-1653626261, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEEENSDCJX3ROJ2OERTL6DXSJT37ANCNFSM6AAAAAA2ZTFVOU . You are receiving this because you commented.Message ID: @.***>

-- Associate Professor in Plant Genomics and Bioinformatics School of Plant and Environmental Sciences Virginia Polytechnic Institute and State University

zoom https://virginiatech.zoom.us/j/8790572835

dzwzs commented 1 year ago
Using TensorFlow backend.
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it 
  np_resource = np.dtype([("resource", np.ubyte, 1)])
start time is 1690469968.7184064
Step1: transfer fasta data to CNN input data
Step2: classify TEs
Step2: 2) domain information is not exist
Traceback (most recent call last):
  File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 274, in <module>
    main()
  File "/Share/user/dzw/software/DeepTE/DeepTE.py", line 249, in main
    pipeline_no_m.classify_pipeline(model_dir, input_CNN_data_file, temp_store_opt_dir, sp_type,te_fam,prop_thr)
  File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 339, in classify_pipeline
    predict_te(model_file_dic[model_name], model_name, x_all_test_list, y_all_test_nm_list,input_spe_type,y_all_test_nm_list,prop_thr)
  File "/Share/user/dzw/software/DeepTE/scripts/DeepTE_pipeline_no_modification.py", line 210, in predict_te
    model = load_model(model)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/saving.py", line 584, in load_model
    model = _deserialize_model(h5dict, custom_objects, compile)
  File "/Share/user/dzw/miniconda3/envs/deepte/lib/python3.6/site-packages/keras/engine/saving.py", line 273, in _deserialize_model
    model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

I seem to have a new problem, after reinstalling it?Or is there a problem with other packages?