问答详情
源自:2-1 TensorFlow框架

老师,在GPU里训练的模型,在CPU里运行的程序调用,出错,怎么解决呢?

老师,在GPU里训练的模型,在CPU里运行的程序调用,出错,怎么解决呢?

Traceback (most recent call last):

  File "demo.py", line 41, in <module>

    model = pr.LPR(args.cascade_model_path, args.mapping_vertical_model_path, args.ocr_plate_model_path)

  File "/home/yuy/Demo/HyperLPR/HyperLPRLite.py", line 19, in __init__

    self.modelSeqRec = self.model_seq_rec(model_seq_rec)

  File "/home/yuy/Demo/HyperLPR/HyperLPRLite.py", line 102, in model_seq_rec

    base_model.load_weights(model_path)

  File "/home/yuy/.virtualenvs/CarEnv/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 2211, in load_weights

    hdf5_format.load_weights_from_hdf5_group(f, self.layers)

  File "/home/yuy/.virtualenvs/CarEnv/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 698, in load_weights_from_hdf5_group

    layer, weight_values, original_keras_version, original_backend)

  File "/home/yuy/.virtualenvs/CarEnv/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 408, in preprocess_weights_for_loading

    return _convert_rnn_weights(layer, weights)

  File "/home/yuy/.virtualenvs/CarEnv/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 569, in _convert_rnn_weights

    raise ValueError('%s is not compatible with %s' % types)

ValueError: GRU(reset_after=False) is not compatible with GRU(reset_after=True)


提问者:莫言于方 2020-09-06 20:25

个回答

  • weixin_慕雪7126088
    2021-08-08 16:32:54

    那就用cpu 重新训练呗