Problems when using bert4keras (Process finished with exit code -1073741819 (0xC0000005))

1. Environment

python 3.7.12

tensorflow 1.15

hard 2.3.1

bert4keras 0.9.7

protobuf  3.19.0

numpy 1.16.5

2. A problem occurs 

  • There is an incompatibility issue with the numpy version, so you can just follow my version (numpy 1.16.5) 
  • Process finished with exit code -1073741819 (0xC0000005) The code program directly terminated the program for me.

3. Problem analysis

First of all, I checked the information and read the Sushen github blog. Indeed, someone has encountered this problem, but the problem has not been solved. Unable to train, the error reporting process has ended, the exit code is -1073741819 (0xC0000005) · Issue #345 · bojone/bert4keras (github.com)

In addition, I checked some blogs, and there are the following situations. The first one is that the model file needs to be saved again, but I don’t think it’s right and I didn’t try it.

It also says that the dll file is missing, but I see that there is nothing in my prompt, so I don’t think this is the reason.

Another blog said that it is a problem with the path of the corresponding model file. The path needs to be changed to the corresponding path. I tried it and it still didn't work. Then I checked many blogs and still didn't have any available solutions, so I thought it would start from the code. I started to find this problem myself. Through pycahrm's debugger debugging, I finally knew the location of the problem where the program was forced to exit and stop, but I still didn't know the solution. But at least knowing where the problem point is is half of the problem. that is

This problem in the build_transformer_model method caused the program to crash as soon as the permission file was loaded. By locating the problem, I checked the corresponding related information blog.

I finally found what I thought was the blogger’s suggestion. I tried it out of luck and it turned out hahaha. 

 The solution is as follows: (Add the introduction of tensorflow, and then load its checkpoint file directory using tf.train.latest_checkpoint)

# 添加引入
import tensorflow as tf


config_path = './model/chinese_L-12_H-768_A-12/bert_config.json'
checkpoint_path = tf.train.latest_checkpoint(r'./model/chinese_L-12_H-768_A-12/bert_model.ckpt')
dict_path = './model/chinese_L-12_H-768_A-12/vocab.txt'


The above are the tips I shared today, I hope they can help you~

Guess you like

Origin blog.csdn.net/m0_43432638/article/details/130392339