WO2021139250A1 - 一种数据增强模型的训练方法及装置 - Google Patents

一种数据增强模型的训练方法及装置 Download PDF

Info

Publication number
WO2021139250A1
WO2021139250A1 PCT/CN2020/118525 CN2020118525W WO2021139250A1 WO 2021139250 A1 WO2021139250 A1 WO 2021139250A1 CN 2020118525 W CN2020118525 W CN 2020118525W WO 2021139250 A1 WO2021139250 A1 WO 2021139250A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
data
corpus
corpus data
seq2seq
Prior art date
Application number
PCT/CN2020/118525
Other languages
English (en)
French (fr)
Inventor
郑立颖
徐亮
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021139250A1 publication Critical patent/WO2021139250A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application relates to the field of artificial intelligence, and in particular to a method and device for training a data enhancement model.
  • Data Augmentation is a technology that expands the training data set by allowing limited data to generate more equivalent data. It is an effective means to overcome the lack of training data and is currently widely used in various fields of deep learning.
  • natural language processing since natural language itself is a discrete abstract symbol, small changes may cause huge deviations in meaning, so natural language data enhancement algorithms are worthy of our in-depth study.
  • the purpose of this application is to propose a training method and device for an enhanced data model, which aims to solve the problem of how to make the data enhanced model generate better corpus.
  • the data enhancement model includes a first seq2seq model and a second seq2seq model, and the method includes:
  • the classification result is used to represent that the third corpus data is the first corpus data or the corpus data generated by the generation network;
  • This application proposes a method for training a natural language processing task model, and the method includes:
  • Each Chinese corpus in the Chinese corpus is sequentially input to a trained data enhancement model, and a new Chinese corpus is reconstructed and output; wherein, the data enhancement model includes a first seq2seq model and a second seq2seq model, and the data is enhanced
  • the training method of the model includes: inputting the first corpus data into the first seq2seq model to obtain the second corpus data, inputting the second corpus data into the second seq2seq model to obtain the third corpus data; inputting the first corpus data and the third corpus data separately
  • the text classification model is recognized through the text classification model to obtain a classification result, and the classification result is used to characterize that the third corpus data is the first corpus data or the corpus data generated by the data enhancement model; according to the classification As a result, the loss value is calculated, and the parameters of the first seq2seq model, the second seq2seq model, and the text classification model are optimized by using the loss value through a preset optimization
  • the output new Chinese corpus and the Chinese corpus are used as a training set to train the natural language processing task model.
  • the data enhancement model includes a first seq2seq model and a second seq2seq model, and the device includes:
  • a generating module configured to input the first corpus data into the first seq2seq model to obtain the second corpus data, and input the second corpus data into the second seq2seq model to obtain the third corpus data;
  • the discrimination module is used to input the first corpus data and the third corpus data into the text classification model respectively; through the text classification model for recognition, the classification result is obtained, and the classification result is used to indicate that the third corpus data is the first corpus data Or corpus data generated by the generating network;
  • the parameter optimization module is configured to calculate a loss value according to the classification result, and optimize the parameters of the first seq2seq model, the second seq2seq model, and the text classification model by using the loss value through a preset optimization algorithm;
  • the termination judgment module is used to iterate the process of the above-mentioned generation module, judgment module, and parameter optimization module until the preset termination condition is met and a trained data enhancement model is obtained.
  • This application proposes a training device for a natural language processing task model, and the device includes:
  • Acquisition module used to acquire Chinese corpus
  • the data enhancement module is used to sequentially input each Chinese corpus in the Chinese corpus into the data enhancement model trained by the training device of the data enhancement model, reconstruct and output a new Chinese corpus; wherein, the data enhancement model includes the first The seq2seq model and the second seq2seq model.
  • the training device for the data enhancement model includes a generation module, a discrimination module, a parameter optimization module, and a termination judgment module; the generation module is used to input the first corpus data into the first seq2seq model to obtain the first seq2seq model.
  • Second corpus data input the second corpus data into the second seq2seq model to obtain the third corpus data;
  • the discrimination module is used to input the first corpus data and the third corpus data into the text classification model, and pass the text classification model Perform recognition to obtain a classification result, the classification result is used to represent that the third corpus data is the first corpus data or corpus data generated by the generation network;
  • the parameter optimization module is used to calculate the loss value according to the classification result , And use the loss value to optimize the parameters of the first seq2seq model, the second seq2seq model, and the text classification model through a preset optimization algorithm;
  • the termination judgment module is used to iterate the above generation module, the judgment module, and The process of parameter optimization module until a trained data enhancement model is obtained when the preset termination conditions are met;
  • the training module is used to train the natural language processing task model using the output new Chinese corpus and the Chinese corpus as a training set.
  • the present application proposes a computer device, including a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, a method for training a data enhancement model is realized;
  • the data enhancement model includes a first seq2seq model and a second seq2seq model
  • the steps of the training method of the data enhancement model include:
  • the first corpus data and the third corpus data are respectively input into the text classification model, and the text classification model is used for recognition to obtain the classification result.
  • the classification result is used to indicate that the third corpus data is the first corpus data or is determined by the The corpus data generated by the data enhancement model;
  • This application also proposes a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements a natural language processing task model training method when the processor executes the computer program;
  • the steps of the training method of the natural language processing task model include:
  • Each Chinese corpus in the Chinese corpus is sequentially input to a trained data enhancement model, and a new Chinese corpus is reconstructed and output; wherein, the data enhancement model includes a first seq2seq model and a second seq2seq model, and the data is enhanced
  • the training method of the model includes: inputting the first corpus data into the first seq2seq model to obtain the second corpus data, inputting the second corpus data into the second seq2seq model to obtain the third corpus data; inputting the first corpus data and the third corpus data separately
  • the text classification model is recognized through the text classification model to obtain a classification result, and the classification result is used to characterize that the third corpus data is the first corpus data or the corpus data generated by the data enhancement model; according to the classification As a result, the loss value is calculated, and the parameters of the first seq2seq model, the second seq2seq model, and the text classification model are optimized by using the loss value through a preset optimization
  • the output new Chinese corpus and the Chinese corpus are used as a training set to train the natural language processing task model.
  • This application proposes a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, a method for training a data enhancement model is realized;
  • the data enhancement model includes a first seq2seq model and a second seq2seq model
  • the steps of the training method of the data enhancement model include:
  • the first corpus data and the third corpus data are respectively input into the text classification model, and the text classification model is used for recognition to obtain the classification result.
  • the classification result is used to indicate that the third corpus data is the first corpus data or is determined by the The corpus data generated by the data enhancement model;
  • This application also proposes a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, a method for training a natural language processing task model is realized;
  • the steps of the training method of the natural language processing task model include:
  • Each Chinese corpus in the Chinese corpus is sequentially input to a trained data enhancement model, and a new Chinese corpus is reconstructed and output; wherein, the data enhancement model includes a first seq2seq model and a second seq2seq model, and the data is enhanced
  • the training method of the model includes: inputting the first corpus data into the first seq2seq model to obtain the second corpus data, inputting the second corpus data into the second seq2seq model to obtain the third corpus data; inputting the first corpus data and the third corpus data separately
  • the text classification model is recognized through the text classification model to obtain a classification result, and the classification result is used to characterize that the third corpus data is the first corpus data or the corpus data generated by the data enhancement model; according to the classification As a result, the loss value is calculated, and the parameters of the first seq2seq model, the second seq2seq model, and the text classification model are optimized by using the loss value through a preset optimization
  • the output new Chinese corpus and the Chinese corpus are used as a training set to train the natural language processing task model.
  • Training method based on the above data enhancement model, natural language processing task model training method, data enhancement model training device, natural language processing task model training device, computer equipment and computer readable storage medium, based on text classification model and data enhancement
  • the training process of the model is a game process, and the training purpose of the text classification model is to make the generated new corpus data not easily distinguished by the text classification model, and the training purpose of the data enhancement model is to accurately distinguish whether it is the original corpus data or the generated data. New corpus data. Therefore, the use of this confrontation method can continuously update the effect of the corpus data generated by the data enhancement model according to the judgment result of the text classification model, so that the trained data enhancement model can generate new corpus data with better effects , Which can really enhance and expand the original corpus data.
  • Fig. 1 is a flowchart of an embodiment of a method for training a data enhancement model according to an exemplary embodiment of this application;
  • FIG. 2 is a schematic diagram of the training structure of a data enhancement model according to the embodiment shown in FIG. 1 according to this application;
  • FIG. 3 is a schematic diagram of the structure of the gated recurrent network shown in this application.
  • FIG. 4 is a schematic structural diagram of a Seq2seq model shown in this application.
  • Fig. 5 is a flowchart of an embodiment of a method for training a natural language processing task model according to an exemplary embodiment of this application;
  • Fig. 6 is a flowchart of an embodiment of a device for training a data enhancement model according to an exemplary embodiment of this application;
  • Fig. 7 is a flowchart of an embodiment of an apparatus for training a natural language processing task model according to an exemplary embodiment of this application.
  • first, second, third, etc. may be used in this application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
  • word “if” as used herein can be interpreted as "when” or “when” or "in response to determination”.
  • the method of using translation tools for back translation is the most effective data enhancement method, that is, using translation tools to translate the original text into texts in other languages, and then using translation tools to translate texts in other languages. Back to the new text in the same language as the original text.
  • this application proposes a training method for a data enhancement model.
  • the new corpus data output by the data enhancement model and the original corpus data of the input data are enhanced by the data enhancement model, and then input the text classification model to determine whether the new corpus data is the original corpus.
  • the data is still the data generated by the data enhancement model, the classification result is obtained, and the loss calculation is performed according to the classification result, and the calculation result is substituted into the optimization algorithm to optimize the parameters of the data enhancement model and the text classification model, due to the training of the text classification model and the data enhancement model
  • the process is a game process.
  • the training purpose of the text classification model is to make the generated new corpus data not easily distinguishable by the text classification model, and the training purpose of the data enhancement model is to accurately distinguish whether it is the original corpus data or the generated new corpus data. Therefore, the use of this confrontation method can continuously update the effect of the corpus data generated by the data enhancement model according to the judgment result of the text classification model, and then make the trained data enhancement model generate new corpus data with better effects.
  • the data serves the purpose of real enhancement and expansion.
  • Fig. 1 is a flowchart of an embodiment of a method for training a data enhancement model according to an exemplary embodiment of this application.
  • the method for training the data enhancement model can be applied to a computer device.
  • the data enhancement The model includes the first seq2seq model and the second seq2seq model to ensure the accuracy of data enhancement.
  • the training method includes the following steps:
  • Step 101 Input the first corpus data into the first seq2seq model to obtain the second corpus data, and input the second corpus data into the second seq2seq model to obtain the third corpus data.
  • the first seq2seq model and the second seq2seq model may be pre-trained models obtained through conventional training methods, that is, these two models may perform some basic translation operations.
  • first corpus data and the third corpus data belong to the same language, and the second corpus data belongs to a different language.
  • the first corpus data belongs to the Chinese language
  • the second corpus data obtained belongs to the English language
  • the second seq2seq model is translated
  • the third corpus data obtained belongs to the Chinese language. It is just that after the first corpus data is translated twice, although the third corpus data obtained belongs to the Chinese language, the specific text content and text sequence included are different from the first corpus data.
  • the first seq2seq model and the second seq2seq model may both include models of encoder and decoder mechanisms, and the working principle is: the encoder encodes the input sample sequence to obtain a set of hidden layer feature vectors, and The hidden layer feature vector is input to the decoder for decoding and output.
  • the first corpus data can be encoded into the first feature vector by the encoder in the first seq2seq model, and Output to the decoder in the first seq2seq model, and then decode the first feature vector into the second corpus data through the decoder in the first seq2seq model.
  • the second corpus data can be encoded into the second feature vector by the encoder in the second seq2seq model, and output to the first Second, the decoder in the seq2seq model, and then decode the second feature vector into the third corpus data through the decoder in the second seq2seq model.
  • the encoder and the decoder may both use Gated Recurrent Unit (GRU). See the GRU network structure shown in Figure 3.
  • the GRU includes an update gate rt and a reset gate zt.
  • the reset gate is used to control the ignoring of the previous one. The level of information at the moment, the smaller the reset gate value, the more ignored.
  • W z and W r respectively represent the weight parameters of the reset gate and the update gate
  • x t represents the input at the current time t.
  • the tanh activation function formula included in GRU is as follows:
  • W is the weight parameter of the activation function.
  • the output calculation formula of GRU is as follows:
  • the gating recurrent network in the encoder generates the character sequence of length n contained in the first corpus data
  • a hidden layer state sequence of length n, and the last hidden layer state in the hidden layer state sequence is selected as the first feature vector for output.
  • the first feature vector is converted by the gated recurrent network in the decoder to obtain a hidden layer state sequence of length m, And output the second corpus data sequence of length m based on the hidden layer state sequence.
  • the x1 ⁇ xn sequence as the first corpus data is sequentially input to GRU1 in the encoder.
  • GRU1 can get the hidden layer state h1 based on the initial state h0 and x1, and when x2 is input, GRU1 can be obtained based on the hidden layer state h1 and x2 Hidden layer state h2, and so on, until the input xn, GRU1 can get the hidden layer state hn, and output the hidden layer state hn, which is the first feature vector, that is, the vector c, which encodes all input sequences x1 ⁇ xn information;
  • GRU2 After GRU2 receives the vector c, GRU2 can obtain the hidden layer state h1' based on the initial state h0' and the vector c, and output y1 based on the hidden layer state h1', and GRU2 is based on the hidden layer state h1', The vector c and the previous output y1 can obtain the hidden layer state h2', and output y2 based on the hidden layer state h2', and so on, until the end of outputting m sequences, and obtain the second corpus data y1 ⁇ ym.
  • Step 102 Input the first corpus data and the third corpus data into a text classification model respectively, and perform recognition through the text classification model to obtain a classification result.
  • the classification results of the text classification model include two types. One is that the classification result is true, which means that the third corpus data is the first corpus data; the other is that the classification result is false, which means that the third corpus data is enhanced by data. Corpus data generated by the model.
  • the text classification model may be the TextCNN network
  • the first corpus data and the third corpus data may be convolved through at least one convolutional layer in the TextCNN network to obtain the first convolutional feature and the second convolutional layer.
  • Convolution features and then pool the first convolution feature and the second convolution feature through the pooling layer in the TextCNN network, and finally pool the first convolution feature through the fully connected layer in the TextCNN network Perform two classifications with the second convolution feature to obtain the classification result.
  • TextCNN may include 4 convolutional layers.
  • the first convolutional layer includes three one-dimensional convolution kernels.
  • the length of each one-dimensional convolution kernel is 1, 3, and 5, and each one-dimensional convolution kernel is equal to
  • Each one-dimensional convolution kernel has 384 channels, and finally the convolution output is pooled and fully Connect the layer mapping to get the final classification result, that is, the output form of 0 or 1.
  • Step 103 Calculate the loss value according to the classification result, and use the loss value to optimize the parameters of the first seq2seq model, the second seq2seq model, and the text classification model through a preset optimization algorithm.
  • step 102 if the classification result is true, it means that the text classification model judges the input third corpus data as the first corpus data. If the classification result is false, it means that the text classification model judges the input third corpus data. Is the text corpus generated by the data augmentation model.
  • the loss function that calculates the loss value according to the classification result can use cross entropy, the formula is as follows:
  • p(x) represents the probability that the current sample x belongs to the true category
  • q(x) represents the probability that the discriminant network judges the current sample x as the true category
  • the classification accuracy of the text classification model is high (such as much greater than 0.5), it means that the corpus generation effect of the data enhancement model is relatively poor.
  • the text classification model can easily determine whether the corpus data generated by the data enhancement model or the original corpus data If the classification accuracy of the text classification model is relatively low (such as about 0.5), it means that the data enhancement model has a good effect.
  • the text classification model has difficulty distinguishing between the corpus data generated by the data enhancement model and the original corpus data .
  • the preset optimization algorithm uses the loss value to optimize the parameters of the first seq2seq model, the second seq2seq model, and the text classification model.
  • the goal is to make the third corpus data generated by the two seq2seq models not easily distinguishable by the text classification model, so that the text
  • the classification model can accurately distinguish whether the third corpus data is the original corpus data or the generated corpus data.
  • the preset optimization algorithm may be the Adam algorithm or other model optimization algorithms, which is not specifically limited in this application.
  • Step 104 Iterate the above steps 101 to 103 in a loop until the trained data enhancement model is obtained when the preset termination condition is met.
  • the preset termination condition may be that the number of training iterations reaches the preset number.
  • the preset number of times may be 50 times.
  • the preset termination condition may also be that the difference between the classification accuracy of the text classification model and the preset threshold is within a preset range.
  • the preset threshold may be 0.5.
  • each training is to input the existing first corpus data into the data enhancement model, and go through the first seq2seq model in the data enhancement model
  • the second seq2seq model outputs the third corpus data
  • the first corpus data and the third corpus data are input into the text classification model
  • the text classification model outputs the classification result, calculates the loss value according to the classification result, and then updates the first seq2seq according to the loss value
  • the parameters of the model and the second seq2seq model, as well as the parameters of the text classification model continuously iteratively loop the above process and update the parameters of the first seq2seq model, the second seq2seq model and the text classification model, and stop training until the preset termination conditions are met .
  • the corpus "This dish is done well” can be obtained by simple methods such as changing the order or deleting some words at random to get "This dish is done”. Although more samples can be obtained, there is more noise in such samples, which will affect the accuracy of training the natural language processing task model.
  • the generator in the adversarial learning is changed to a data enhancement model composed of two seq2seq models, and the output is the translation result of the corpus rather than the randomly generated object.
  • the input of "this dish is well done” uses the above Steps 101 to 104 have a better effect on the new samples generated by the data enhancement model obtained from the confrontation training, "This dish is done very well”.
  • the new corpus data output by the data enhancement model and the original corpus data of the input data enhancement model are then input into the text classification model to determine whether the new corpus data is the original corpus data or From the data generated by the data enhancement model, the classification result is obtained, and the loss calculation is performed according to the classification result, and the calculation result is substituted into the optimization algorithm to optimize the parameters of the data enhancement model and the text classification model.
  • the training process of the text classification model and the data enhancement model is A game process
  • the training purpose of the text classification model is to make the generated new corpus data not easily distinguished by the text classification model
  • the training purpose of the data enhancement model is to accurately distinguish between the original corpus data and the generated new corpus data, so it is adopted
  • the data enhancement model trained in this confrontation method can enable the data enhancement model to generate new corpus data with better effects, and play a real purpose of enhancing and expanding the original corpus data.
  • Fig. 5 is a flowchart of an embodiment of a method for training a natural language processing task model according to an exemplary embodiment of this application.
  • the method for training a natural language processing task model includes the following steps:
  • Step 501 Obtain a Chinese corpus.
  • Step 502 Each Chinese corpus in the Chinese corpus is sequentially input into the data enhancement model trained by the training method shown in FIG. 1, and the new Chinese corpus is reconstructed and output.
  • Step 503 Use the output new Chinese corpus and Chinese corpus as a training set to train a natural language processing task model.
  • a model needs to be established to classify the text as commendatory, derogatory, and neutral.
  • the label is labeled "Preferential” "If you model directly based on these similar samples in the corpus, the amount of data will affect the accuracy of the text classification task model.
  • the data enhancement model trained by the above method is used to translate "this dish is well done”, and the Chinese translation English, English translation, get a new sample "this dish is done very well”, through this process to get more new samples with the same label, text differences, combine the original samples and enhanced samples to train the text classification task model, so as to be able to Get a more robust model.
  • this application also provides an embodiment of the training device of the data enhancement model.
  • Fig. 6 is a flowchart of an embodiment of a training device for a data enhancement model according to an exemplary embodiment of the application.
  • the data enhancement model includes a first seq2seq model and a second seq2seq model.
  • the training device for the data enhancement model includes:
  • a generating module 610 configured to input first corpus data into a first seq2seq model to obtain second corpus data, and input second corpus data into a second seq2seq model to obtain third corpus data;
  • the discrimination module 620 is used to input the first corpus data and the third corpus data into the text classification model respectively; through the text classification model for recognition, the classification result is obtained, and the classification result is used to indicate that the third corpus data is the first corpus data or is generated by Corpus data generated by the network;
  • the parameter optimization module 630 is configured to calculate the loss value according to the classification result, and use the loss value to optimize the parameters of the first seq2seq model, the second seq2seq model, and the text classification model through a preset optimization algorithm;
  • the termination judgment module 640 is used to iterate the process of the above-mentioned generation module, the judgment module, and the parameter optimization module cyclically, until the trained data enhancement model is obtained when the preset termination condition is satisfied.
  • both the first seq2seq model and the second seq2seq model include an encoder and a decoder
  • the generating module 610 is specifically configured to encode the first corpus data into a first feature vector by the encoder in the first seq2seq model in the process of inputting the first corpus data into the first seq2seq model to obtain the second corpus data, and output it to The decoder in the first seq2seq model; the first feature vector is decoded into the second corpus data by the decoder in the first seq2seq model;
  • the generating module 610 is specifically configured to encode the second corpus data into a second feature vector through the encoder in the second seq2seq model in the process of inputting the second corpus data into the second seq2seq model to obtain the third corpus data, and output it to The decoder in the second seq2seq model; the second feature vector is decoded into the third corpus data by the decoder in the second seq2seq model.
  • both the decoder and the encoder include a gated recurrent network
  • the generating module 610 is specifically configured to encode the first corpus data into the first feature vector by the encoder in the first seq2seq model, and use the gated recurrent network in the encoder to include the length n of the first corpus data
  • the character sequence generates a hidden layer state sequence of length n, and selects the last hidden layer state in the hidden layer state sequence as the first feature vector for output;
  • the generating module 610 is specifically configured to convert the first feature vector into the second corpus data through the gated recurrent network in the decoder in the process of decoding the first feature vector into the second corpus data by the decoder in the first seq2seq model to obtain a length of m
  • the hidden layer state sequence of, and the second corpus data sequence of length m is output based on the hidden layer state sequence.
  • the text classification model is the TextCNN network
  • the discrimination module 620 is specifically configured to perform convolution operations on the first corpus data and the third corpus data through at least one convolution layer in the TextCNN network to obtain the first corpus data.
  • a convolution feature and a second convolution feature; the first convolution feature and the second convolution feature are pooled through the pooling layer in the TextCNN network; the pooled features are pooled through the fully connected layer in the TextCNN network
  • the first convolution feature and the second convolution feature are classified into two categories, and the classification result is obtained.
  • this application also provides an embodiment of the natural language processing task model training device.
  • Fig. 7 is a flowchart of an embodiment of an apparatus for training a natural language processing task model according to an exemplary embodiment of this application, and the apparatus includes:
  • the obtaining module 710 is used to obtain a Chinese corpus
  • the data enhancement module 720 is configured to sequentially input each Chinese corpus in the Chinese corpus into the data enhancement model trained by the training device in FIG. 6 above, and reconstruct and output the new Chinese corpus;
  • the training module 730 is configured to use the output new Chinese corpus and Chinese corpus as a training set to train a natural language processing task model.
  • the relevant part can refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, where the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place. , Or it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement without creative work.
  • This application also provides another implementation manner, that is, a computer device that includes a memory and a processor, the memory stores a computer program, and the processor implements the training of any of the above-mentioned data enhancement models when the computer program is executed.
  • a computer device that includes a memory and a processor
  • the memory stores a computer program
  • the processor implements the training of any of the above-mentioned data enhancement models when the computer program is executed.
  • the computer-readable storage medium may be non-volatile or volatile, and the computer-readable storage medium stores There is a computer program, and the computer program can be executed by at least one processor, so that the at least one processor executes the steps of any one of the above-mentioned data enhancement model training method or the natural language processing task model training method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Machine Translation (AREA)

Abstract

本申请涉及人工智能和自然语言处理,提供了一种数据增强模型的训练方法及装置,方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型进行识别得到分类结果;根据分类结果计算损失值,利用损失值优化三个模型的参数;循环迭代直至满足预设终止条件停止。由于文本分类模型和数据增强模型的训练是一个博弈过程,文本分类模型的训练目的是让生成的新语料不容易被文本分类模型区分,而数据增强模型的训练目的是能够精准的区分是原始语料还是生成的新语料,因此能够使数据增强模型生成效果更好的语料,对原始语料起到真正的增强和扩充目的。

Description

一种数据增强模型的训练方法及装置
本申请要求于2020年07月31日提交中国专利局、申请号为202010760950.X,发明名称为“一种数据增强模型的训练方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能领域,具体涉及一种数据增强模型的训练方法及装置。
背景技术
数据增强(Data Augmentation)是一种通过让有限的数据产生更多的等价数据来扩展训练数据集的技术。它是克服训练数据不足的有效手段,目前在深度学习的各个领域中应用广泛。在自然语言处理领域中,由于自然语言本身是离散的抽象符号,微小的变化就可能会导致含义的巨大偏差,所以自然语言的数据增强算法值得我们深入研究。
目前,常用的自然语言的数据增强方式包括利用翻译工具回译、同义词替换或插入、随机删除词语、添加噪音词语、词语位置变换。但是发明人发现这些数据增强方式的生成效果均一般,生成的文本与原始文本几乎都一样,相当于没有对原始文本做太多的增强和扩充工作,从而利用这些文本也无法训练得到精度高的自然语言处理任务模型。
技术问题
本申请的目的是提出一种增强数据模型的训练方法及装置,旨在解决如何使数据增强模型可以生成效果更好的语料的问题。
技术解决方案
本申请提出了一种增强数据模型的训练方法,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述方法包括:
将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
将第一语料数据和第三语料数据分别输入文本分类模型;
通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述生成网络生成的语料数据;
根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
本申请提出了一种自然语言处理任务模型的训练方法,所述方法包括:
获取中文语料集;
将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
本申请提出了一种增强数据模型的训练装置,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述装置包括:
生成模块,用于将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
判别模块,用于将第一语料数据和第三语料数据分别输入文本分类模型;通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述生成网络生成的语料数据;
参数优化模块,用于根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
终止判断模块,用于循环迭代上述生成模块、判别模块、参数优化模块的过程,直至满足预设终止条件时得到训练好的数据增强模型。
本申请提出了一种自然语言处理任务模型的训练装置,所述装置包括:
获取模块,用于获取中文语料集;
数据增强模块,用于将所述中文语料集中的每一中文语料依次输入数据增强模型的训练装置训练得到的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练装置包括生成模块、判别模块、参数优化模块和终止判断模块;所述生成模块,用于将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;所述判别模块,用于将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述生成网络生成的语料数据;所述参数优化模块,用于根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;所述终止判断模块,用于循环迭代上述生成模块、判别模块、参数优化模块的过程,直至满足预设终止条件时得到训练好的数据增强模型;
训练模块,用于将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
本申请提出了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现一种数据增强模型的训练方法;
其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法的步骤包括:
将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;
根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
本申请还提出了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现一种自然语言处理任务模型的训练方法;
其中,所述自然语言处理任务模型的训练方法的步骤包括:
获取中文语料集;
将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
本申请提出了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现一种数据增强模型的训练方法;
其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法的步骤包括:
将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;
根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
本申请还提出了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现一种自然语言处理任务模型的训练方法;
其中,所述自然语言处理任务模型的训练方法的步骤包括:
获取中文语料集;
将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
有益效果
基于上述数据增强模型的训练方法、自然语言处理任务模型的训练方法、数据增强模型的训练装置、自然语言处理任务模型的训练装置、计算机设备和计算机可读存储介质,基于文本分类模型和数据增强模型的训练过程是一个博弈过程,而文本分类模型的训练目的是让生成的新语料数据不容易被文本分类模型区分,以及数据增强模型的训练目的是能够精准的区分是原始语料数据还是生成的新语料数据,因此采用这种对抗方式能够根据文本分类模型的判别结果的好坏不断地更新数据增强模型生成的语料数据的效果,进而使得 训练得到的数据增强模型生成效果更好的新语料数据,对原始语料数据起到真正的增强和扩充目的。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1为本申请根据一示例性实施例示出的一种数据增强模型的训练方法的实施例流程图;
图2为本申请根据图1所示实施例示出的一种数据增强模型的训练结构示意图;
图3为本申请示出的门控循环网络的结构示意图;
图4为本申请示出的一种Seq2seq模型的结构示意图;
图5为本申请根据一示例性实施例示出的一种自然语言处理任务模型的训练方法的实施例流程图;
图6为本申请根据一示例性实施例示出的一种数据增强模型的训练装置的实施例流程图;
图7为本申请根据一示例性实施例示出的一种自然语言处理任务模型的训练装置的实施例流程图。
本发明的最佳实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本申请可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
目前,常用的数据增强方式中,利用翻译工具回译的方式是最为有效的数据增强手段,即利用翻译工具将原始文本翻译为其他语种的文本,然后再利用翻译工具将其他语种的文本再翻译回与原始文本语种一样的新文本。
随着深度学习的发展,人们开始利用机器翻译网络模型来代替翻译工具进行翻译,如基于编码器-解码器机制的seq2seq模型。然而,用于进行数据增强的机器翻译模型均是采用常规的训练方式得到,由机器翻译模型翻译得到的新文本的信息都来自于原始文本,与原始文本几乎都一样,相当于没有对原始文本做太多的增强和扩充工作,无法判断新文本对原始文本是否有帮助作用,因此将这些原始文本和生成的新文本作为训练样本集应用到后续任务(如分类任务、关系抽取任务等)中,在准确率和召回率的提升效果上不佳。经实验测试,在精确率和召回率的提升上只有大约0.02左右。
为解决上述技术问题,本申请提出一种数据增强模型的训练方法,通过将数据增强模型输出的新语料数据和输入数据增强模型的原始语料数据,再输入文本分类模型判断新语料数据是原始语料数据还是由数据增强模型生成的数据,得到分类结果,并根据分类结果进行损失计算,并将计算结果代入优化算法优化数据增强模型和文本分类模型的参数,由 于文本分类模型和数据增强模型的训练过程是一个博弈过程,文本分类模型的训练目的是让生成的新语料数据不容易被文本分类模型区分,而数据增强模型的训练目的是能够精准的区分是原始语料数据还是生成的新语料数据,因此采用这种对抗方式能够根据文本分类模型的判别结果的好坏不断地更新数据增强模型生成的语料数据的效果,进而使得训练得到的数据增强模型生成效果更好的新语料数据,对原始语料数据起到真正的增强和扩充目的。
下面以具体实施例对本申请提出的数据增强模型的训练方法进行详细阐述。
图1为本申请根据一示例性实施例示出的一种数据增强模型的训练方法的实施例流程图,该数据增强模型的训练方法可以应用在计算机设备上,在本实施例中,该数据增强模型包括第一seq2seq模型和第二seq2seq模型,以保证数据增强的精度。结合图2所示的训练结构示意图,该训练方法包括如下步骤:
步骤101:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据。
其中,第一seq2seq模型和第二seq2seq模型可以为经过常规训练方式预训练得到的模型,即这两个模型可以进行一些基本的翻译操作。
值得注意的是,第一语料数据和第三语料数据均属于同一语种,第二语料数据属于另一种不同的语种。
例如,第一语料数据属于的中文语种,通过第一seq2seq模型进行转译后,得到的第二语料数据属于英文语种,再通过第二seq2seq模型进行转译之后,得到的第三语料数据属于中文语种,只是说第一语料数据经过两次转译之后,得到的第三语料数据虽然也属于中文语种,但是其包括的具体文字内容及文字排序,与第一语料数据都不同了。
在一些实施例中,第一seq2seq模型和第二seq2seq模型可以均包括编码器和解码器机制的模型,其工作原理为:编码器对输入的样本序列进行编码获得一组隐层特征向量,并将该隐层特征向量输入至解码器进行解码输出。
基于此,在步骤101中,针对将第一语料数据输入第一seq2seq模型得到第二语料数据的过程,可通过第一seq2seq模型中的编码器将第一语料数据编码为第一特征向量,并输出给第一seq2seq模型中的解码器,然后再通过第一seq2seq模型中的解码器将第一特征向量解码为第二语料数据。
基于同样的原理,针对将第二语料数据输入第二seq2seq模型得到第三语料数据的过程,可通过第二seq2seq模型中的编码器将第二语料数据编码为第二特征向量,并输出给第二seq2seq模型中的解码器,然后再通过第二seq2seq模型中的解码器将第二特征向量解码为第三语料数据。
在一些实施例中,编码器和解码器可以均采用门控循环网络(GRU,Gated Recurrent Unit),参见图3所示的GRU网络结构,GRU包括更新门rt和重置门zt,更新门用于控制前一时刻的隐层状态ht-1的信息被带入到当前状态中的程度,更新门的值越大说明前一时刻的信息带入越大,重置门用于控制忽略前一时刻的信息的程度,重置门的值越小说明忽略的越多。
GRU中包括的更新门rt和重置门zt的计算公式如下:
z t=σ(W z·[h t-1,x t])
r t=σ(W r·[h t-1,x t])
其中,W z和W r分别表示重置门和更新门的权重参数,x t表示当前时刻t的输入。
GRU中包括的tanh激活函数公式如下:
Figure PCTCN2020118525-appb-000001
其中,W为激活函数的权重参数。
GRU的输出计算公式如下:
Figure PCTCN2020118525-appb-000002
基于此,针对通过第一seq2seq模型中的编码器将第一语料数据编码为第一特征向量的过程,具体通过编码器中门控循环网络对第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取隐层状态序列中的最后一个隐层状态作为第一特征向量输出。
针对通过第一seq2seq模型中的解码器将第一特征向量解码为第二语料数据的过程,具体通过解码器中门控循环网络对第一特征向量进行转换得到长度为m的隐层状态序列,并基于隐层状态序列输出长度为m的第二语料数据序列。
需要说明的是,对于第二seq2seq模型对输入的语料数据进行的转译原理与第一seq2seq模型的转译原理相同。
参见图4所示的seq2seq模型结构,以第一seq2seq模型的转译过程为例,针对编码器的编码原理:
作为第一语料数据的x1~xn序列依次输入编码器中的GRU1,输入x1时,GRU1基于初始状态h0和x1可得到隐层状态h1,输入x2时,GRU1基于隐层状态h1和x2可得到隐层状态h2,以此类推,直至输入xn时,GRU1可得到隐层状态hn,并输出该隐层状态hn,即第一特征向量,也即向量c,该向量c编码了所有输入序列x1~xn的信息;
针对解码器的解码原理:GRU2接收到向量c后,GRU2基于初始状态h0’和向量c可得到隐层状态h1’,并基于隐层状态h1’输出y1,GRU2再基于隐层状态h1’、向量c和前一个输出y1可得到隐层状态h2’,并基于隐层状态h2’输出y2,以此类推,直至输出m个序列时结束,获得作为第二语料数据的y1~ym。
本领域技术人员可以理解的是,上述图4所示的seq2seq模型结构仅为示例性说明,本申请还可采用其他结构的seq2seq模型进行转译处理。
步骤102:将第一语料数据和第三语料数据分别输入文本分类模型,并通过文本分类模型进行识别,得到分类结果。
其中,文本分类模型的分类结果包括两种,一种是分类结果为真,即表示第三语料数据是第一语料数据;另一种分类结果为假,即表示第三语料数据是由数据增强模型生成的语料数据。
在一些实施例中,文本分类模型可以为TextCNN网络,可通过TextCNN网络中的至少一个卷积层分别对第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征,再通过TextCNN网络中的池化层分别对第一卷积特征和第二卷积特征进行池化处理,最后通过TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
具体地,TextCNN可以包括4层卷积层,第一层卷积层包括三个一维卷积核,各一维卷积核的长度分别为1、3、5,各一维卷积核均有128通道,共384通道,后续的三层卷积层,分别包括长度为3的一维卷积核,各一维卷积核分别有384个通道,最终将卷积输出进行池化与全连接层映射,得到最终的分类结果,即0或1的输出形式。
步骤103:根据分类结果计算损失值,并通过预设优化算法利用损失值优化第一seq2seq模型、第二seq2seq模型和文本分类模型的参数。
针对步骤102的过程,分类结果如果为真,则表示文本分类模型将输入的第三语料数据判别为第一语料数据,分类结果如果为假,则表示文本分类模型将输入的第三语料数据判别为是由数据增强模型生成的文本语料。
在优化两个seq模型和文本分类模型中的参数时,根据分类结果计算损失值的损失函数可以采用交叉熵,公式如下:
Figure PCTCN2020118525-appb-000003
其中,p(x)表示当前样本x所属真实类别的概率,q(x)表示判别网络将当前样本x判断为真实类别的概率。
如果文本分类模型的分类准确度高(如远大于0.5),则说明数据增强模型的语料生成效果比较差,文本分类模型很容易就判断出是通过数据增强模型生成的语料数据还是原始语料数据了,如果文本分类模型的分类准确度比较低(如0.5左右),则说明数据增强模型的生成效果很好,文本分类模型已经很难区分出是通过数据增强模型生成的语料数据还是原始语料数据了。
因此,预设优化算法利用损失值优化第一seq2seq模型、第二seq2seq模型和文本分类模型的参数的目标是,让两个seq2seq模型生成的第三语料数据不容易被文本分类模型区分,让文本分类模型能够精准的区分第三语料数据是原始语料数据还是生成的语料数据。
示例性的,预设优化算法可以是Adam算法,也可以其他模型优化算法,本申请对此不进行具体限定。
步骤104:循环迭代上述步骤101至步骤103,直至满足预设终止条件时得到训练好的数据增强模型。
在一些实施例中,预设终止条件可以是训练迭代次数达到预设次数。例如,预设次数可以为50次。
在另一些实施例中,预设终止条件还可以是文本分类模型的分类准确度与预设阈值的差值位于预设范围内。例如,预设阈值可以为0.5。
本领域技术人员可以理解的是,还可以是上述两个终止条件中任一项满足,即停止训练。
基于上述步骤101至步骤104的整个训练过程,参见图2所示的整体训练结构,每次训练均是将已有的第一语料数据输入数据增强模型,经过数据增强模型中的第一seq2seq模型和第二seq2seq模型输出第三语料数据,再将第一语料数据和第三语料数据输入文本分类模型,由文本分类模型输出分类结果,根据分类结果计算损失值,进而根据损失值更新第一seq2seq模型和第二seq2seq模型的参数,以及文本分类模型的参数,不断的迭代循环上述过程并更新第一seq2seq模型、第二seq2seq模型和文本分类模型的的参数,直至满足预设终止条件时停止训练。
与一些常规数据增强方法相比,例如将“这道菜做得很好”这一语料通过一些简单方法,例如调换顺序,或者随机删去部分词语,得到“这菜做得”,这样的方式虽然也能得到更多样本,但是这样的样本存在更多噪音,会影响训练自然语言处理任务模型的精度。
而本申请将对抗学习中的生成器改为由两个seq2seq模型组成的数据增强模型,输出的是语料的转译结果而非随机生成对象,例如将“这道菜做得很好”输入采用上述步骤101至步骤104对抗训练得到的数据增强模型生成的新样本“这道菜做得很不错”效果比较好。
至此,完成上述图1所示的数据增强模型的训练流程,通过将数据增强模型输出的新语料数据和输入数据增强模型的原始语料数据,再输入文本分类模型判断新语料数据是原始语料数据还是由数据增强模型生成的数据,得到分类结果,并根据分类结果进行损失计算,并将计算结果代入优化算法优化数据增强模型和文本分类模型的参数,由于文本分类模型和数据增强模型的训练过程是一个博弈过程,文本分类模型的训练目的是让生成的新语料数据不容易被文本分类模型区分,而数据增强模型的训练目的是能够精准的区分是原始语料数据还是生成的新语料数据,因此采用这种对抗方式训练得到的数据增强模型,能够使数据增强模型生成效果更好的新语料数据,对原始语料数据起到真正的增强和扩充目的。
下面以使用上述图1所示的训练方法训练得到的数据增强模型重构中文语料为例:
图5为本申请根据一示例性实施例示出的一种自然语言处理任务模型的训练方法的实施例流程图,该自然语言处理任务模型的训练方法包括如下步骤:
步骤501:获取中文语料集。
步骤502:将中文语料集中的每一中文语料依次输入采用上述图1所示的训练方法训练得到的数据增强模型,重构新中文语料并输出。
步骤503:将输出的新中文语料和中文语料集作为训练集训练自然语言处理任务模型。
以自然语言处理任务模型为文本分类任务为例,需建立模型将文本分类为褒义、贬义、中性,假设语料集中有一样本为“这道菜做得很好”,标注的标签为“褒义”,如果直接基于语料集中这些类似样本建模,数据量会影响文本分类任务模型精度,现采用上述方法训练得到的数据增强模型,将“这道菜做得很好”进行转译,经过中译英,英译中,得到新样本“这道菜做得很不错”,通过这一过程获得更多同标注,文本存在差异的新样本,结合原始样本与增强样本训练文本分类任务模型,从而能够获得更好鲁棒性的模型。
至此,完成上述图5所示流程,由于采用上述图1所描述的数据增强模型对用于训练自然语言处理任务模型的语料数据进行更好的扩充增强,能够生成更多更好的样本,由此利用扩充后的训练集进行自然语言处理任务训练,可以给自然语言处理任务模型的精度带来很好的提升。
与前述数据增强模型的训练方法的实施例相对应,本申请还提供了数据增强模型的训练装置的实施例。
图6为本申请根据一示例性实施例示出的一种数据增强模型的训练装置的实施例流程图,数据增强模型包括第一seq2seq模型和第二seq2seq模型,该数据增强模型的训练装置包括:
生成模块610,用于将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
判别模块620,用于将第一语料数据和第三语料数据分别输入文本分类模型;通过文本分类模型进行识别,得到分类结果,分类结果用于表征第三语料数据是第一语料数据或由生成网络生成的语料数据;
参数优化模块630,用于根据分类结果计算损失值,并通过预设优化算法利用损失值优化第一seq2seq模型、第二seq2seq模型和文本分类模型的参数;
终止判断模块640,用于循环迭代上述生成模块、判别模块、参数优化模块的过程,直至满足预设终止条件时得到训练好的数据增强模型。
在一可选实现方式中,第一seq2seq模型和第二seq2seq模型均包括编码器和解码器;
生成模块610,具体用于在将第一语料数据输入第一seq2seq模型得到第二语料数据过程中,通过第一seq2seq模型中的编码器将第一语料数据编码为第一特征向量,并输出给第一seq2seq模型中的解码器;通过第一seq2seq模型中的解码器将第一特征向量解码为第二语料数据;
生成模块610,具体用于在将第二语料数据输入第二seq2seq模型得到第三语料数据过程中,通过第二seq2seq模型中的编码器将第二语料数据编码为第二特征向量,并输出给第二seq2seq模型中的解码器;通过第二seq2seq模型中的解码器将第二特征向量解码为第三语料数据。
在一可选实现方式中,解码器和编码器均包括门控循环网络;
生成模块610,具体用于在通过第一seq2seq模型中的编码器将第一语料数据编码为第一特征向量过程中,通过编码器中门控循环网络对第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取隐层状态序列中的最后一个隐层状态作为第一特征向量输出;
生成模块610,具体用于在通过第一seq2seq模型中的解码器将第一特征向量解码为第 二语料数据过程中,通过解码器中门控循环网络对第一特征向量进行转换得到长度为m的隐层状态序列,并基于隐层状态序列输出长度为m的第二语料数据序列。
在一可选实现方式中,文本分类模型为TextCNN网络,判别模块620,具体用于通过TextCNN网络中的至少一个卷积层分别对第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征;通过TextCNN网络中的池化层分别对第一卷积特征和第二卷积特征进行池化处理;通过TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
与前述自然语言处理任务模型的训练方法的实施例相对应,本申请还提供了自然语言处理任务模型的训练装置的实施例。
图7为本申请根据一示例性实施例示出的一种自然语言处理任务模型的训练装置的实施例流程图,该装置包括:
获取模块710,用于获取中文语料集;
数据增强模块720,用于将中文语料集中的每一中文语料依次输入采用上述图6的训练装置训练得到的数据增强模型,重构新中文语料并输出;
训练模块730,用于将输出的新中文语料和中文语料集作为训练集训练自然语言处理任务模型。
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本申请方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
本申请还提供了另一种实施方式,即提供一种计算机设备,计算机设备包括存储器和处理器,该存储器存储有计算机程序,该处理器执行计算机程序时实现上述任意一种数据增强模型的训练方法的步骤或自然语言处理任务模型的训练方法的步骤。
本申请还提供了另一种实施方式,即提供一种计算机可读存储介质,所述计算机可读存储介质可以是非易失性,也可以是易失性,所述计算机可读存储介质上存储有计算机程序,所述计算机程序可被至少一个处理器执行,以使所述至少一个处理器执行上述任意一种数据增强模型的训练方法的步骤或自然语言处理任务模型的训练方法的步骤。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、商品或者设备中还存在另外的相同要素。
以上仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (20)

  1. 一种数据增强模型的训练方法,其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述方法包括:
    将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
    将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;
    根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
    循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
  2. 根据权利要求1所述的方法,其中,所述第一seq2seq模型和第二seq2seq模型均包括编码器和解码器;
    将第一语料数据输入第一seq2seq模型得到第二语料数据,包括:
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,并输出给所述第一seq2seq模型中的解码器;
    通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据;
    将所述第二语料数据输入第二seq2seq模型得到第三语料数据,包括:
    通过所述第二seq2seq模型中的编码器将所述第二语料数据编码为第二特征向量,并输出给所述第二seq2seq模型中的解码器;
    通过所述第二seq2seq模型中的解码器将所述第二特征向量解码为第三语料数据。
  3. 根据权利要求2所述的方法,其中,所述解码器和所述编码器均包括门控循环网络;
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,包括:
    通过所述编码器中门控循环网络对所述第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取所述隐层状态序列中的最后一个隐层状态作为第一特征向量输出;
    所述通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据,包括:
    通过所述解码器中门控循环网络对所述第一特征向量进行转换得到长度为m的隐层状态序列,并基于所述隐层状态序列输出长度为m的第二语料数据序列。
  4. 根据权利要求1所述的方法,其中,所述文本分类模型为TextCNN网络,所述通过所述文本分类模型进行识别,得到分类结果,包括:
    通过所述TextCNN网络中的至少一个卷积层分别对所述第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征;
    通过所述TextCNN网络中的池化层分别对所述第一卷积特征和第二卷积特征进行池化处理;
    通过所述TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
  5. 一种自然语言处理任务模型的训练方法,其中,所述方法包括:
    获取中文语料集;
    将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述 数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
    将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
  6. 根据权利要求5所述的自然语言处理任务模型的训练方法,其中,所述第一seq2seq模型和第二seq2seq模型均包括编码器和解码器;
    将第一语料数据输入第一seq2seq模型得到第二语料数据,包括:
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,并输出给所述第一seq2seq模型中的解码器;
    通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据;
    将所述第二语料数据输入第二seq2seq模型得到第三语料数据,包括:
    通过所述第二seq2seq模型中的编码器将所述第二语料数据编码为第二特征向量,并输出给所述第二seq2seq模型中的解码器;
    通过所述第二seq2seq模型中的解码器将所述第二特征向量解码为第三语料数据。
  7. 根据权利要求6所述的自然语言处理任务模型的训练方法,其中,所述解码器和所述编码器均包括门控循环网络;
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,包括:
    通过所述编码器中门控循环网络对所述第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取所述隐层状态序列中的最后一个隐层状态作为第一特征向量输出;
    所述通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据,包括:
    通过所述解码器中门控循环网络对所述第一特征向量进行转换得到长度为m的隐层状态序列,并基于所述隐层状态序列输出长度为m的第二语料数据序列。
  8. 根据权利要求5所述的自然语言处理任务模型的训练方法,其中,所述文本分类模型为TextCNN网络,所述通过所述文本分类模型进行识别,得到分类结果,包括:
    通过所述TextCNN网络中的至少一个卷积层分别对所述第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征;
    通过所述TextCNN网络中的池化层分别对所述第一卷积特征和第二卷积特征进行池化处理;
    通过所述TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
  9. 一种数据增强模型的训练装置,其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述装置包括:
    生成模块,用于将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
    判别模块,用于将第一语料数据和第三语料数据分别输入文本分类模型;通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述生成网络生成的语料数据;
    参数优化模块,用于根据所述分类结果计算损失值,并通过预设优化算法利用所述 损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
    终止判断模块,用于循环迭代上述生成模块、判别模块、参数优化模块的过程,直至满足预设终止条件时得到训练好的数据增强模型。
  10. 一种自然语言处理任务模型的训练装置,其中,所述装置包括:
    获取模块,用于获取中文语料集;
    数据增强模块,用于将所述中文语料集中的每一中文语料依次输入数据增强模型的训练装置训练得到的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练装置包括生成模块、判别模块、参数优化模块和终止判断模块;所述生成模块,用于将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;所述判别模块,用于将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述生成网络生成的语料数据;所述参数优化模块,用于根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;所述终止判断模块,用于循环迭代上述生成模块、判别模块、参数优化模块的过程,直至满足预设终止条件时得到训练好的数据增强模型;
    训练模块,用于将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
  11. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现一种数据增强模型的训练方法;
    其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法的步骤包括:
    将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
    将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;
    根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
    循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
  12. 根据权利要求11所述的计算机设备,其中,所述第一seq2seq模型和第二seq2seq模型均包括编码器和解码器;
    将第一语料数据输入第一seq2seq模型得到第二语料数据,包括:
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,并输出给所述第一seq2seq模型中的解码器;
    通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据;
    将所述第二语料数据输入第二seq2seq模型得到第三语料数据,包括:
    通过所述第二seq2seq模型中的编码器将所述第二语料数据编码为第二特征向量,并输出给所述第二seq2seq模型中的解码器;
    通过所述第二seq2seq模型中的解码器将所述第二特征向量解码为第三语料数据。
  13. 根据权利要求12所述的计算机设备,其中,所述解码器和所述编码器均包括门控循环网络;
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,包括:
    通过所述编码器中门控循环网络对所述第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取所述隐层状态序列中的最后一个隐层状态作为第一特征向量输出;
    所述通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据,包括:
    通过所述解码器中门控循环网络对所述第一特征向量进行转换得到长度为m的隐层状态序列,并基于所述隐层状态序列输出长度为m的第二语料数据序列。
  14. 根据权利要求11所述的计算机设备,其中,所述文本分类模型为TextCNN网络,所述通过所述文本分类模型进行识别,得到分类结果,包括:
    通过所述TextCNN网络中的至少一个卷积层分别对所述第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征;
    通过所述TextCNN网络中的池化层分别对所述第一卷积特征和第二卷积特征进行池化处理;
    通过所述TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
  15. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现一种自然语言处理任务模型的训练方法;
    其中,所述自然语言处理任务模型的训练方法的步骤包括:
    获取中文语料集;
    将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
    将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现一种数据增强模型的训练方法;
    其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法的步骤包括:
    将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;
    将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;
    根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;
    循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述第一seq2seq模型和第二seq2seq模型均包括编码器和解码器;
    将第一语料数据输入第一seq2seq模型得到第二语料数据,包括:
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,并 输出给所述第一seq2seq模型中的解码器;
    通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据;
    将所述第二语料数据输入第二seq2seq模型得到第三语料数据,包括:
    通过所述第二seq2seq模型中的编码器将所述第二语料数据编码为第二特征向量,并输出给所述第二seq2seq模型中的解码器;
    通过所述第二seq2seq模型中的解码器将所述第二特征向量解码为第三语料数据。
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述解码器和所述编码器均包括门控循环网络;
    通过所述第一seq2seq模型中的编码器将所述第一语料数据编码为第一特征向量,包括:
    通过所述编码器中门控循环网络对所述第一语料数据包含的长度为n的字符序列生成长度为n的隐层状态序列,并选取所述隐层状态序列中的最后一个隐层状态作为第一特征向量输出;
    所述通过所述第一seq2seq模型中的解码器将所述第一特征向量解码为第二语料数据,包括:
    通过所述解码器中门控循环网络对所述第一特征向量进行转换得到长度为m的隐层状态序列,并基于所述隐层状态序列输出长度为m的第二语料数据序列。
  19. 根据权利要求16所述的计算机可读存储介质,其中,所述文本分类模型为TextCNN网络,所述通过所述文本分类模型进行识别,得到分类结果,包括:
    通过所述TextCNN网络中的至少一个卷积层分别对所述第一语料数据和第三语料数据进行卷积运算,得到第一卷积特征和第二卷积特征;
    通过所述TextCNN网络中的池化层分别对所述第一卷积特征和第二卷积特征进行池化处理;
    通过所述TextCNN网络中的全连接层对池化后的第一卷积特征和第二卷积特征进行二分类,得到分类结果。
  20. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现一种自然语言处理任务模型的训练方法;
    其中,所述自然语言处理任务模型的训练方法的步骤包括:
    获取中文语料集;
    将所述中文语料集中的每一中文语料依次输入训练好的数据增强模型,重构新中文语料并输出;其中,所述数据增强模型包括第一seq2seq模型和第二seq2seq模型,所述数据增强模型的训练方法包括:将第一语料数据输入第一seq2seq模型得到第二语料数据,将第二语料数据输入第二seq2seq模型得到第三语料数据;将第一语料数据和第三语料数据分别输入文本分类模型,并通过所述文本分类模型进行识别,得到分类结果,所述分类结果用于表征第三语料数据是第一语料数据或由所述数据增强模型生成的语料数据;根据所述分类结果计算损失值,并通过预设优化算法利用所述损失值优化所述第一seq2seq模型、第二seq2seq模型和所述文本分类模型的参数;循环迭代上述步骤,直至满足预设终止条件时得到训练好的数据增强模型;
    将输出的新中文语料和所述中文语料集作为训练集训练所述自然语言处理任务模型。
PCT/CN2020/118525 2020-07-31 2020-09-28 一种数据增强模型的训练方法及装置 WO2021139250A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010760950.XA CN111914552A (zh) 2020-07-31 2020-07-31 一种数据增强模型的训练方法及装置
CN202010760950.X 2020-07-31

Publications (1)

Publication Number Publication Date
WO2021139250A1 true WO2021139250A1 (zh) 2021-07-15

Family

ID=73287995

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/118525 WO2021139250A1 (zh) 2020-07-31 2020-09-28 一种数据增强模型的训练方法及装置

Country Status (2)

Country Link
CN (1) CN111914552A (zh)
WO (1) WO2021139250A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114118068A (zh) * 2022-01-26 2022-03-01 北京淇瑀信息科技有限公司 训练文本数据的扩增方法、装置及电子设备
CN115688868A (zh) * 2022-12-30 2023-02-03 荣耀终端有限公司 一种模型训练方法及计算设备
CN117708601A (zh) * 2024-02-06 2024-03-15 智慧眼科技股份有限公司 一种相似度计算模型训练方法、装置、设备及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328750A (zh) * 2020-11-26 2021-02-05 上海天旦网络科技发展有限公司 训练文本判别模型的方法及系统
CN112685539B (zh) * 2020-12-31 2022-12-23 成都网安科技发展有限公司 基于多任务融合的文本分类模型训练方法和装置
CN113111639A (zh) * 2021-04-16 2021-07-13 南京奥拓电子科技有限公司 一种通顺模型训练方法及辅助语音识别方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110069790A (zh) * 2019-05-10 2019-07-30 东北大学 一种通过译文回译对照原文的机器翻译系统及方法
CN110085215A (zh) * 2018-01-23 2019-08-02 中国科学院声学研究所 一种基于生成对抗网络的语言模型数据增强方法
CN110147535A (zh) * 2019-04-18 2019-08-20 平安科技(深圳)有限公司 相似文本生成方法、装置、设备及存储介质
US20190385609A1 (en) * 2018-02-08 2019-12-19 Capital One Services,Llc Adversarial learning and generation of dialogue responses
CN111310480A (zh) * 2020-01-20 2020-06-19 昆明理工大学 一种基于英语枢轴的弱监督汉越双语词典构建方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107368475B (zh) * 2017-07-18 2021-06-04 中译语通科技股份有限公司 一种基于生成对抗神经网络的机器翻译方法和系统
CN110263349A (zh) * 2019-03-08 2019-09-20 腾讯科技(深圳)有限公司 语料评估模型训练方法、装置、存储介质和计算机设备
CN110334361B (zh) * 2019-07-12 2022-11-22 电子科技大学 一种面向小语种语言的神经机器翻译方法
CN111144140B (zh) * 2019-12-23 2023-07-04 语联网(武汉)信息技术有限公司 基于零次学习的中泰双语语料生成方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110085215A (zh) * 2018-01-23 2019-08-02 中国科学院声学研究所 一种基于生成对抗网络的语言模型数据增强方法
US20190385609A1 (en) * 2018-02-08 2019-12-19 Capital One Services,Llc Adversarial learning and generation of dialogue responses
CN110147535A (zh) * 2019-04-18 2019-08-20 平安科技(深圳)有限公司 相似文本生成方法、装置、设备及存储介质
CN110069790A (zh) * 2019-05-10 2019-07-30 东北大学 一种通过译文回译对照原文的机器翻译系统及方法
CN111310480A (zh) * 2020-01-20 2020-06-19 昆明理工大学 一种基于英语枢轴的弱监督汉越双语词典构建方法

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114118068A (zh) * 2022-01-26 2022-03-01 北京淇瑀信息科技有限公司 训练文本数据的扩增方法、装置及电子设备
CN114118068B (zh) * 2022-01-26 2022-04-29 北京淇瑀信息科技有限公司 训练文本数据的扩增方法、装置及电子设备
CN115688868A (zh) * 2022-12-30 2023-02-03 荣耀终端有限公司 一种模型训练方法及计算设备
CN115688868B (zh) * 2022-12-30 2023-10-20 荣耀终端有限公司 一种模型训练方法及计算设备
CN117708601A (zh) * 2024-02-06 2024-03-15 智慧眼科技股份有限公司 一种相似度计算模型训练方法、装置、设备及存储介质
CN117708601B (zh) * 2024-02-06 2024-04-26 智慧眼科技股份有限公司 一种相似度计算模型训练方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN111914552A (zh) 2020-11-10

Similar Documents

Publication Publication Date Title
WO2021139250A1 (zh) 一种数据增强模型的训练方法及装置
CN107918782B (zh) 一种生成描述图像内容的自然语言的方法与系统
CN110232183B (zh) 关键词提取模型训练方法、关键词提取方法、装置及存储介质
WO2020107878A1 (zh) 文本摘要生成方法、装置、计算机设备及存储介质
WO2021179570A1 (zh) 序列标注方法、装置、计算机设备和存储介质
WO2021051516A1 (zh) 基于人工智能的古诗词生成方法、装置、设备及存储介质
CN109101235A (zh) 一种软件程序的智能解析方法
CN109285111B (zh) 一种字体转换的方法、装置、设备及计算机可读存储介质
CN112487807A (zh) 一种基于膨胀门卷积神经网络的文本关系抽取方法
CN111078866B (zh) 一种基于序列到序列模型的中文文本摘要生成方法
CN106126507A (zh) 一种基于字符编码的深度神经翻译方法及系统
CN111291534A (zh) 面向中文长文本自动摘要的全局编码方法
CN109840322A (zh) 一种基于强化学习的完形填空型阅读理解分析模型及方法
CN109670036A (zh) 一种新闻评论自动生成方法及其装置
CN110033008A (zh) 一种基于模态变换与文本归纳的图像描述生成方法
CN111444367A (zh) 一种基于全局与局部注意力机制的图像标题生成方法
CN113628059B (zh) 一种基于多层图注意力网络的关联用户识别方法及装置
Fakoor et al. Memory-augmented attention modelling for videos
CN111125367A (zh) 一种基于多层次注意力机制的多种人物关系抽取方法
CN109145946B (zh) 一种智能图像识别和描述方法
CN111651993A (zh) 融合局部-全局字符级关联特征的中文命名实体识别方法
CN113987129A (zh) 基于变分自动编码器的数字媒体保护文本隐写方法
CN113989943B (zh) 一种基于蒸馏损失的人体动作增量识别方法及装置
CN111191038B (zh) 神经网络训练方法和装置及命名实体识别方法和装置
CN111145914A (zh) 一种确定肺癌临床病种库文本实体的方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20911400

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20911400

Country of ref document: EP

Kind code of ref document: A1