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

来源:2-1 TensorFlow框架

莫言于方

2020-09-06 20:25

老师,在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)


写回答 关注

1回答

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

    那就用cpu 重新训练呗


TensorFlow与Flask结合打造手写体数字识别

TensorFlow和flask结合识别自己的手写体数字

20432 学习 · 102 问题

查看课程

相似问题