Use BERT to answer sentence questions, extract fixed feature vectors, and analyze sentence semantics.


SQuAD inference json.png



[Operation steps and instructions]


BERT APP is divided into three parts. SQuAD2.0 conducts sentence question training and answer, ELMo extracts fixed feature vectors and MRPC conducts sentence semantic analysis.


1. SQuAD2.0


Press "1.Fine_Tuning" to train data/SQuAD2.0/train-v2.0.json.

After pressing training, you will wait for a while in the "impossible example" line, which is normal.


SQuAD train.png


After training, you can choose the training model to answer the sentence question. The question file is from data/SQuAD2.0/dev-v2.0.json, and the output answer is in data/output/SQuAD2.0/nbest_predictions.json.


If there is no answer to the question, the threshold of the question will be recorded in data/output/SQuAD2.0/null_odds.json.


When you select model file, three files, model.ckpt-XXX.data-00000-of-00001, model.ckpt-XXX.index, and model.ckpt-XXX.meta, will be read. Do not delete the extension data and. index file.


SQuAD train.png


The position of the orange line in nbest_predictions.json corresponds to the id of the question in the source file data/SQuAD2.0/dev-v2.0.json, and the answer to the question is in [ ].


SQuAD inference json.png


If you need to adjust the threshold of the inference answer, you can execute "3. Evaluate" and adjust the threshold of null_score_diff_threshold according to the value of best_f1_thresh in the execution result.


SQuAD evaluate.png


2. ELMo


Press "Extract Fixed Feature" to extract the fixed feature vector from input file data/glue-data/ELMo/input.txt, and store the extraction result in data/output/ELMo/output.json.






After pressing "1. Fine_Tuning", train the files in the data/glue-data/MRPC folder.


MRPC train.png


After training, confirm the model file and press "2.Inference" to perform sentence semantic analysis on the "data/glue-data/MRPC/test.tsv" file to determine the probability that the two sentences belong to the same meaning.


MRPC inference.png


Supplement result_test.tsv:

The green line of test.tsv is sentence 1, and the blue line is sentence 2. After analysis, at the orange line of result_test.tsv, the former number (0.29910564) indicates the probability that the two sentences have different meanings, and the latter number (0.70089436) indicates The probability that two sentences have the same meaning.


MRPC inference tsv.png

Contact Us and How to Buy

Welcome to contact us. Please refer to the following link:


Recommended Article

App4AI - AI Software - Windows Edition

App4AI - AI Software - Linux Edition


Thanks for our customers

Taiwan University, Tsing Hua University, Yang Ming Chiao Tung University, Cheng Kung University, Taipei Medical University, Taipei University of Nursing and Health Sciences, National Chung Hsing University, Chi Nan University, Ilan University, United University, Defence University, Military Academy, Naval Academy, Feng Chia University, Chang Gung University, I-Shou University, Shih Chien University, Taiwan University of Science and Technology, Taichung University of Science and Technology, Yunlin University of Science and Technology, Chin-Yi University of Science, Formosa University, Pintung University of Science and Technology, Kaohsiung University of Science and Technology, Chaoyang University of Technology, Ming Chi University of Technology, Southern Taiwan University of Science and Technology, China University of Technology, Gushan Senior High School, Taipei Veterans General Hospital, Chang Gung Medical Foundation, Tzu Chi Medical Foundation, E-Da Hospital, Industry Technology Research Institute, Institute for Information Industry, Chung-Shan Institute of Science and Technology, Armaments Bureau, Ministry of Justice Investigation Bureau, Institute of Nuclear Energy Research, Endemic Species Research Institute, Institute of Labor, Occupational Safety And Health, Metal Industries Research & Development Centre, Taiwan Instrument Research Institute, Automotive Research & Testing Center, Taiwan Water Corporation, Taiwan Semiconductor Manufacturing Co., Ltd., United Microelectronics Corp., Nanya Technology, Winbond Electronics Corp., Xintec Inc., Arima Lasers Corporation, AU Optronics Corporation, Innolux Corporation, HannStar Display Corporation, Formosa Plastics Group., Formosa Technologies Corporation, Nan Ya Plastics Corp., Formosa Chemicals & Fibre Corporation, Chinese Petroleum Corporation, Logitech, ELAN Microelectronics Corp., Lextar Electronics Corporation, Darfon Electronics Corp., WPG Holdings, Mirle Automation Corporation, Symtek Automation Asia Co., Ltd, ChipMOS Technologies Inc., Dynapack International Technology Corporation, Primax Electronics Ltd., Feng Hsin Steel, China Ecotek, Grade Upon Technology Corp., AAEON Technology Inc., Stark Technology, Inc., Horng Terng Automation Co., Ltd., Zhen Ding Technology Holding Ltd, Boardtek Electronics Corporation, MiTAC International Corporation, Allion Labs, Inc., Sound Land Corp., Hong Hu Tech, etc.