Method and apparatus for generating data

By retraining the pre-trained model and adjusting the model parameters using a small amount of data in the target field, the problem of insufficient training data is solved, and high authenticity and targeted data are generated, meeting the data needs of the target field.

CN115146624BActive Publication Date: 2025-04-15JINGDONG TECH HLDG CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110340188.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2025-04-15
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

When the prior art deals with the problem of insufficient training data, it is difficult to generate high authenticity and targeted data, especially when the amount of data in the target field is small.

Method used

By obtaining a small amount of data from the target field, the pre-trained model is retrained, and the model parameters are adjusted to learn the data generation rules of the target field, thereby generating target data closer to the real data.

Benefits of technology

It improves the authenticity and pertinence of the generated data, enhances the amount of data, and meets the data needs of the target field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115146624B_ABST
    Figure CN115146624B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure disclose a method and device for generating data. A specific implementation of the method includes: obtaining target training data and target data generation conditions, wherein the target training data includes corpus in the target field, and the corpus is marked with feature labels; based on the target training data, constructing a target sample set; based on the target sample set, training a pre-training model, adjusting the parameters of the pre-training model, and obtaining a target data generation model after retraining, wherein the pre-training model is obtained through the following steps: constructing an initial model and training the initial model based on a general sample set to obtain a pre-training model; using the target data generation model, based on the target data generation conditions, generating target data. Retraining the pre-training model with a small amount of data in the target field so that the obtained data generation model learns the data generation rules of the target field can enhance the data and improve the authenticity and pertinence of the generated data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, specifically to the field of artificial intelligence, and more particularly to a method and device for generating data. Background Art

[0002] Data augmentation is a technique that allows limited data to generate more equivalent data to expand the training data set. It is an effective means to overcome insufficient training data. For example, deep learning methods usually require a large amount of training data to avoid overfitting. However, in practice, sometimes it is impossible to obtain enough data, which requires data augmentation to solve such problems.

[0003] In the related art, there are two methods for text data enhancement. One is to make partial modifications to sentences while maintaining the original structure of the sentences to generate new sentences. For example, new sentences are generated by simple synonym replacement, random word exchange, random word deletion and other methods. Another example is the recently proposed Masked language model, which performs masked prediction on words and makes conditional adjustments on class labels to achieve data expansion. The other is to pre-train the text generation model with a large amount of data, and then use the data generation method to generate complete sentences through the text generation model instead of making some local changes. For example, back translation, that is, first translate the corpus into another language, and then translate it back to the source language to generate more varied sentences. For another example, the paraphrasing method is used to add noise to the input of the text generation model to generate more sentences. Summary of the invention

[0004] Embodiments of the present disclosure provide methods and devices for generating data.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating data, the method comprising: obtaining target training data and target data generation conditions, the target training data comprising a corpus of a target domain marked with feature labels; determining the corpus marked with feature labels in the target training data as a target sample corpus, determining the feature labels of the target sample corpus as target sample labels, and obtaining a target sample set; based on the target sample set, training a pre-trained model, adjusting the parameters of the pre-trained model, and obtaining a target data generation model after re-training, wherein the pre-trained model is obtained via the following steps: constructing an initial model and training the initial model based on a general sample set to obtain a pre-trained model; using the target data generation model to generate target data based on the target data generation conditions.

[0006] In some embodiments, based on the target sample set, training a pre-trained model includes: inputting the target sample label into the pre-trained model, taking the target sample corpus as the expected output, training the pre-trained model, and obtaining a target data generation model.

[0007] In some embodiments, the target data generation condition includes a target feature tag; and, using a target data generation model, based on the target data generation condition, generating the target data, including: inputting the target feature tag into the target data generation model to obtain the target corpus; and determining the target corpus as the target data.

[0008] In some embodiments, the target feature label is a classification label estimated by a pre-constructed classification model based on the corpus to be identified; and, before determining the target corpus as the target data, the method also includes: inputting the target corpus into the classification model to obtain the classification label of the target corpus; in response to determining that the classification label of the target corpus is included in the preset label set of the classification model, determining the target corpus as the target data, and the target data is used to construct a training sample for the classification model.

[0009] In some embodiments, based on the target sample set, training a pre-trained model includes: inputting the target sample corpus into the pre-trained model, taking the target sample label as the expected output, training the pre-trained model, and obtaining a target data generation model.

[0010] In some embodiments, the target data generation condition includes a target corpus to be recognized; and, using a target data generation model, based on the target data generation condition, generating the target data, including: inputting the target corpus to be recognized into the target data generation model to obtain feature tags of the target corpus to be recognized; and determining the feature tags of the target corpus to be recognized as the target data.

[0011] In a second aspect, an embodiment of the present disclosure provides a device for generating data, the device comprising: a data acquisition unit, configured to acquire target training data and target data generation conditions, the target training data comprising a corpus of a target domain marked with feature labels; a sample construction unit, configured to determine the corpus marked with feature labels in the target training data as a target sample corpus, and determine the feature labels of the target sample corpus as target sample labels, to obtain a target sample set; a model adjustment unit, configured to train a pre-trained model based on the target sample set, adjust the parameters of the pre-trained model, and obtain a target data generation model after re-training, wherein the pre-trained model is obtained via the following steps: constructing an initial model and training the initial model based on a general sample set to obtain a pre-trained model; a data generation unit, configured to generate target data based on the target data generation conditions using the target data generation model.

[0012] In some embodiments, the model adjustment unit is further configured to: input the target sample label into the pre-trained model, use the target sample corpus as the expected output, train the pre-trained model, and obtain the target data generation model.

[0013] In some embodiments, the target data generation condition includes a target feature tag; and the data generation unit is further configured to: input the target feature tag into a target data generation model to obtain a target corpus; and determine the target corpus as the target data.

[0014] In some embodiments, the target feature label is a classification label estimated by a pre-constructed classification model based on the corpus to be identified; and the data generation unit also includes a data verification module, which is configured to: input the target corpus into the classification model to obtain the classification label of the target corpus; in response to determining that the classification label of the target corpus is included in the preset label set of the classification model, determine the target corpus as target data, and the target data is used to construct a training sample for the classification model.

[0015] In some embodiments, the model adjustment unit is further configured to: input the target sample corpus into the pre-trained model, use the target sample label as the expected output, train the pre-trained model, and obtain the target data generation model.

[0016] In some embodiments, the target data generation conditions include target corpus to be recognized; and the data generation unit is further configured to: input the target corpus to be recognized into a target data generation model to obtain feature tags of the target corpus to be recognized; and determine the feature tags of the target corpus to be recognized as target data.

[0017] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method in any of the above embodiments.

[0018] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method in any of the above embodiments.

[0019] The method and device for generating data provided by the embodiments of the present disclosure retrain the pre-trained model with a small amount of data in the target field so that the obtained data generation model learns the data generation rules of the target field, which can enhance the data and improve the authenticity and pertinence of the generated data. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0021] Figure 1 is an exemplary system architecture diagram in which some embodiments of the present disclosure may be applied;

[0022] Figure 2 is a flow chart of one embodiment of a method for generating data according to the present disclosure;

[0023] Figure 3 is a flow chart of yet another embodiment of a method for generating data according to the present disclosure;

[0024] Figure 4 is a flow chart of yet another embodiment of a method for generating data according to the present disclosure;

[0025] Figure 5 is a structural schematic diagram of an embodiment of a device for generating data according to the present disclosure;

[0026] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION

[0027] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0028] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0029] Figure 1 An exemplary system architecture 100 is shown to which the method for generating data or the apparatus for generating data according to the embodiments of the present disclosure can be applied.

[0030] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0031] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send data, etc. For example, users can send original data of the target field to the server, and can also receive target data generated by the target data generation model from the server.

[0032] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be electronic devices with communication functions, including but not limited to smart phones, tablet computers, e-book readers, laptop computers, desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules for providing distributed services, or they can be implemented as a single software or software module. No specific limitation is made here.

[0033] The server 105 may be a server that provides various services, such as a background data server that processes the raw data uploaded by the terminal devices 101, 102, and 103 (e.g., constructs training samples based on target training data). The background data server may adjust the pre-trained model using the received raw data, and the obtained data generation model is used to generate new data, and the processing result (e.g., generated target data) is fed back to the terminal device.

[0034] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules for providing distributed services, or it can be implemented as a single software or software module. No specific limitation is made here.

[0035] It should be noted that the method for generating data provided in the embodiment of the present disclosure can be executed by the terminal devices 101, 102, 103, or by the server 105. Accordingly, the device for generating data can be set in the terminal devices 101, 102, 103, or in the server 105. No specific limitation is made here.

[0036] Continue to refer Figure 2 , shows a process 200 of an embodiment of a method for generating data according to the present disclosure. The method for generating data comprises the following steps:

[0037] Step 201, obtaining target training data and target data generation conditions.

[0038] In this embodiment, the target training data includes a corpus in the target domain marked with feature labels. The feature labels represent the features of the corpus and may include multiple dimensions. For example, the structural feature labels may represent the structural features of the corpus, the intent labels may represent the intent features of the corpus, and the semantic labels may represent the semantic features of the corpus. The target data generation condition represents the user's expectations for the generated data, for example, it may be data including entity information in the target domain, or data containing specific syntactic structures or semantic information.

[0039] As an example, when an operator receives a data generation task in a certain technical field, he can execute the subject (e.g. Figure 1 The server 105 shown in the figure directly obtains the target training data and target data generation conditions in the field from the business party, and can also obtain real corpus in the field from the Internet, and mark the corresponding feature tags for each real corpus to obtain the target training data.

[0040] It should be noted that the target training data may also include unlabeled corpus.

[0041] Step 202: determine the corpus marked with feature labels in the target training data as the target sample corpus, determine the feature labels of the target sample corpus as the target sample labels, and obtain a target sample set.

[0042] In this embodiment, the corpus of the target domain may include features of multiple dimensions of real corpus in the target domain, such as sentence structure features, word features, semantic features, etc. Accordingly, the target sample label may characterize the features of the target sample corpus from multiple dimensions, for example, the target sample corpus may be labeled from the dimension of sentence structure, the target sample corpus may also be labeled from the dimension of keywords, and for another example, the target sample corpus may also be labeled from the dimension of entity naming in the target domain.

[0043] Step 203: Based on the target sample set, train the pre-trained model, adjust the parameters of the pre-trained model, and obtain a re-trained target data generation model.

[0044] In this embodiment, the pre-trained model is obtained through the following steps: construct an initial model and train the initial model based on a general sample set to obtain a pre-trained model. Among them, the training data in the general sample set is easily accessible training data in various fields. As an example, models such as ELMo (Embeddings from Language Models), BERT (Bidirectional Encoder Representation from Transformers) or GPT (Generative Pre-Training) can be selected as the initial model. After that, the execution entity can obtain public data through the network and build a general sample set based on the public data, so as to ensure that the initial model has enough training samples in the pre-training stage.

[0045] The pre-trained model obtained after the initial model is trained with the sample set can learn basic data generation rules (for example, it can generate coherent and real corpus), but for some fields where data acquisition is difficult, the similarity between the data generated by the pre-trained model and the real data in the field is low. At this time, the pre-trained model is re-trained based on the target sample set, and the parameters in the pre-trained model are adjusted so that the pre-trained model learns the data generation rules in the target field, so that the data generated by the target data model obtained after re-training is closer to the real data.

[0046] Step 204, using the target data generation model to generate target data based on the target data generation conditions.

[0047] In this embodiment, the target data generation model represents the corresponding relationship between the target data generation conditions and the target data.

[0048] In a specific example, the amount of data in a specific field is small. In order to enhance the data in this field, this field can be used as the target field. The execution subject can build a general sample set based on public data on the Internet (for example, data such as Chinese novels or dialogue corpora), and then train the initial GPT model based on the general sample set. The obtained pre-trained GPT model can generate coherent real sentences. After that, the execution subject can obtain the corpus of the target field as the target training data, and build a target sample set, and then train the GPT model again based on the target sample set, adjust the parameters of the GPT model, so that it learns the generation rules of the real corpus in the target field, and the GPT model obtained after the training is completed is the target data generation model. After that, the execution subject can obtain the target data generation conditions (for example, keyword tags, sentence structure tags, semantic tags, etc.), and input the target data tags into the GPT model, so that the new corpus can be generated by GPT, thereby expanding the amount of data in the target field. Table 1 shows the target training data (including input tags and training corpora) and the target corpus generated by GPT in this example.

[0049] Table 1

[0050]

[0051] The method and device for generating data provided by the embodiments of the present disclosure retrain the pre-trained model with a small amount of data in the target field so that the obtained data generation model learns the data generation rules of the target field, which can enhance the data and improve the authenticity and pertinence of the generated data.

[0052] Continue to see Figure 3 , Figure 3 According to a flowchart of another embodiment of a method for generating data disclosed in the present invention, Figure 3 The process 300 shown includes the following steps:

[0053] Step 301, obtaining target training data and target data generation conditions.

[0054] Step 302, determine the corpus marked with feature labels in the target training data as the target sample corpus, determine the feature labels of the target sample corpus as the target sample labels, and obtain the target sample set. Step 301 and step 302 are similar to the above-mentioned steps 201 and 202, and will not be repeated here.

[0055] Step 303: input the target sample label into the pre-training model, take the target sample corpus as the expected output, train the pre-training model, and obtain the target data generation model.

[0056] In this embodiment, the target sample label can characterize the characteristics of the target sample corpus. The pre-training model uses the target sample label as a conditional label, constrains the generation process of the corpus with the conditional label, and then determines the loss function by comparing the target sample corpus with the generated corpus, thereby obtaining the target data generation model. The target data generation model characterizes the correspondence between the conditional label and the generated corpus.

[0057] Step 304: input the target feature label into the target data generation model to obtain the target corpus.

[0058] In this embodiment, the target data generation condition includes a target feature tag, which represents the user's expectations for the generated corpus in one or more dimensions.

[0059] The execution subject inputs the target feature label into the target data generation model as the conditional label of the target data generation model, constraining its corpus generation process to generate target corpus that meets user expectations.

[0060] Step 305: determine the target corpus as the target data.

[0061] from Figure 3 It can be seen that process 400 of the method for generating data in this embodiment highlights the step of generating corpus data using a target data generation model. For application scenarios where the amount of feature label data of the corpus is sufficient but the amount of corpus data is insufficient, the method for generating data in this embodiment only requires a small amount of training data in the target field to ensure that the generated corpus is closer to the actual expectations of the target field, and the data can be enhanced in a more targeted manner.

[0062] In some optional implementations of the present embodiment, the target feature label is a classification label estimated by a pre-constructed classification model based on the corpus to be identified, and before the target corpus is determined as the target data (step 306), the above process 300 may further include: inputting the target corpus into the classification model to obtain the classification label of the target corpus; in response to determining that the classification label of the target corpus is included in the preset label set of the classification model, determining the target corpus as the target data, and the target data is used to construct a training sample for the classification model.

[0063] In this implementation, the target data generation model is used to expand the training data of the classification model. If the corpus generated by the target data generation model can be correctly recognized by the classification model, it proves that the authenticity of the corpus generated by the target generation model meets the training requirements of the classification model.

[0064] As an example, it is necessary to build a classification model for identifying corpus in a specific field. It is understandable that the amount of training sample data is positively correlated with the accuracy of the model. Therefore, in order to ensure the accuracy of the classification model, sufficient classification sample corpus is required. For some specific fields, it is difficult to obtain the amount of corpus data. At this time, the field can be used as the target field, and the execution subject can construct a target sample set based on the small amount of classification samples obtained, and obtain the target data generation model through retraining. After that, the sample classification label of the classification model is input into the target data generation model to obtain the target corpus. Then the target corpus is input into the classification model again. If the classification label output by the classification model is consistent with the sample classification label, it means that the authenticity of the target corpus meets the training requirements of the classification model. In this way, the target data obtained can effectively expand the sample data of the classification model.

[0065] It should be noted that a corpus may correspond to multiple feature labels, which respectively characterize the features of the corpus from multiple dimensions. In some optional implementations of the above embodiments, when the pre-training model is re-trained based on the target sample set, multiple target sample labels may be simultaneously input into the pre-training model so that the target data generation model can learn data generation rules in multiple dimensions.

[0066] Accordingly, the target data generation condition may include target feature labels of multiple dimensions, each of which represents a data generation condition of one dimension. In this way, the execution subject can constrain its corpus generation process from multiple dimensions, thereby achieving data enhancement that integrates multiple dimensions.

[0067] As an example, the target data generation conditions may include intent labels, structure labels, entity labels, and technical field labels, respectively representing the user's expectations for the generated corpus from the dimensions of intent, structure, entity, and technical field. The execution subject may simultaneously input the above multiple feature labels into the target data generation model, constrain the corpus generation process from the above multiple dimensions, and obtain the target corpus that meets the user's needs.

[0068] In a specific example, the user uses the target generation model to expand the corpus data in the field of air conditioners. The user can set the target data generation conditions as "air conditioner", "green", and "purchase" according to their own needs, where "air conditioner" is the domain label, "green" is the entity label, and "purchase" is the intention label. After that, the execution subject simultaneously inputs the above three feature labels into the target data generation model to generate the target corpus. For example, the target corpus can be "I want to buy a green air conditioner", "How to buy a green air conditioner", etc. Table 2 shows the correspondence between multi-dimensional labels, training corpus, and target corpus in this example.

[0069] Table 2

[0070]

[0071] Next reference Figure 4 , which shows a process 400 of another embodiment of a method for generating data. The process 400 of the method for generating data includes the following steps:

[0072] Step 401, obtaining target training data and target data generation conditions.

[0073] Step 402, determine the corpus marked with feature labels in the target training data as the target sample corpus, determine the feature labels of the target sample corpus as the target sample labels, and obtain the target sample set. Step 401 and step 402 are similar to the above-mentioned steps 201 and 202, and will not be repeated here.

[0074] Step 403: Input the target sample corpus into the pre-training model, take the target sample label as the expected output, train the pre-training model, and obtain the target data generation model.

[0075] Step 404: input the target corpus to be recognized into the target data generation model to obtain feature labels of the target corpus to be recognized.

[0076] In this embodiment, the target data generation condition includes the target corpus to be identified. The target data generation model represents the correspondence between the corpus and the label. The execution subject inputs the target corpus to be identified into the target data generation model, identifies the features of the target corpus to be identified, and outputs the target feature label representing the features of the target corpus to be identified.

[0077] Step 405: determine the feature tags of the target corpus to be recognized as target data.

[0078] from Figure 4 It can be seen that process 400 of the method for generating data in this embodiment embodies the steps of identifying the feature tags of the corpus through the target data generation model. For some occasions where the corpus data volume is large and only a small part is marked with feature tags, the method for generating data in this embodiment only needs a small amount of training data in the target field to ensure the accuracy of recognition, which can enhance the data more effectively.

[0079] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for generating data, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0080] like Figure 5As shown, the device 500 for generating data in this embodiment includes: a data acquisition unit 501, configured to acquire target training data and target data generation conditions, the target training data including corpus of a target domain marked with feature labels; a sample construction unit 502, configured to determine the corpus marked with feature labels in the target training data as the target sample corpus, and determine the feature labels of the target sample corpus as the target sample labels, to obtain a target sample set; a model adjustment unit 503, configured to train a pre-trained model based on the target sample set, adjust the parameters of the pre-trained model, and obtain a target data generation model after re-training, wherein the pre-trained model is obtained through the following steps: constructing an initial model and training the initial model based on a general sample set to obtain a pre-trained model; a data generation unit 504, configured to adopt the target data generation model, and generate target data based on the target data generation conditions.

[0081] In this embodiment, the model adjustment unit 503 is further configured to: input the target sample label into the pre-trained model, take the target sample corpus as the expected output, train the pre-trained model, and obtain the target data generation model.

[0082] In this embodiment, the target data generation condition includes a target feature tag; and the data generation unit 504 is further configured to: input the target feature tag into a target data generation model to obtain a target corpus; and determine the target corpus as the target data.

[0083] In this embodiment, the target feature label is a classification label estimated by a pre-constructed classification model based on the corpus to be identified; and the data generation unit 504 also includes a data verification module, which is configured to: input the target corpus into the classification model to obtain the classification label of the target corpus; in response to determining that the classification label of the target corpus is included in the preset label set of the classification model, determine the target corpus as the target data, and the target data is used to construct a training sample for the classification model.

[0084] In this embodiment, the model adjustment unit 503 is further configured to: input the target sample corpus into the pre-training model, take the target sample label as the expected output, train the pre-training model, and obtain the target data generation model.

[0085] In this embodiment, the target data generation conditions include the target corpus to be recognized; and the data generation unit 504 is further configured to: input the target corpus to be recognized into the target data generation model to obtain the feature tags of the target corpus to be recognized; and determine the feature tags of the target corpus to be recognized as the target data.

[0086] Reference below Figure 6 , which shows an electronic device (eg, Figure 1The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0087] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0088] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0089] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.

[0090] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains target training data and target data generation conditions, wherein the target training data includes corpus of the target domain marked with feature labels; determines the corpus marked with feature labels in the target training data as the target sample corpus, determines the feature labels of the target sample corpus as the target sample labels, and obtains the target sample set; trains the pre-trained model based on the target sample set, adjusts the parameters of the pre-trained model, and obtains the target data generation model after retraining, wherein the pre-trained model is obtained through the following steps: constructs an initial model and trains the initial model based on a general sample set to obtain a pre-trained model; adopts the target data generation model, and generates target data based on the target data generation conditions.

[0091] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0092] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0093] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The units described may also be provided in a processor, for example, may be described as: a processor including a data acquisition unit, a sample construction unit, a model adjustment unit, and a data generation unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the data acquisition unit may also be described as a "unit for acquiring target training data and target data generation conditions".

[0094] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.

Claims

1. A method for generating data, wherein: include: Obtaining target training data and target data generation conditions, wherein the target training data includes corpus of a target domain marked with feature tags; The target data generation condition includes a target feature tag or a target corpus to be identified; Determine the corpus marked with feature labels in the target training data as the target sample corpus, determine the feature labels of the target sample corpus as the target sample labels, and obtain a target sample set; Based on the target sample set, a pre-trained model is trained, and parameters of the pre-trained model are adjusted to obtain a target data generation model after retraining, wherein the pre-trained model is obtained through the following steps: constructing an initial model and training the initial model based on a general sample set to obtain the pre-trained model; The target feature tag is input into the target data generation model to obtain a target corpus used to describe the target feature tag; or the target corpus to be identified is input into the target data generation model to obtain a feature tag representing the feature of the target corpus to be identified.

2. The method according to claim 1, wherein: Based on the target sample set, training a pre-trained model includes: inputting the target sample label into the pre-trained model, taking the target sample corpus as the expected output, training the pre-trained model, and obtaining the target data generation model.

3. The method according to claim 2, wherein: The target feature label is a classification label estimated by a pre-built classification model based on the corpus to be identified; as well as, Before determining the target corpus as target data, the method further includes: inputting the target corpus into the classification model to obtain a classification label of the target corpus; In response to determining that the preset label set of the classification model includes the classification label of the target corpus, the target corpus is determined as target data, and the target data is used to construct a training sample for the classification model.

4. The method according to claim 1, wherein: Based on the target sample set, training a pre-training model includes: The target sample corpus is input into the pre-training model, the target sample label is used as the expected output, the pre-training model is trained, and the target data generation model is obtained.

5. A device for generating data, wherein: include: A data acquisition unit is configured to acquire target training data and target data generation conditions, wherein the target training data includes corpus of a target domain marked with feature tags; The target data generation condition includes a target feature tag or a target corpus to be identified; A sample construction unit is configured to determine the corpus marked with a feature label in the target training data as the target sample corpus, determine the feature label of the target sample corpus as the target sample label, and obtain a target sample set; A model adjustment unit is configured to train a pre-trained model based on the target sample set, adjust the parameters of the pre-trained model, and obtain a target data generation model after retraining, wherein the pre-trained model is obtained through the following steps: constructing an initial model and training the initial model based on a general sample set to obtain the pre-trained model; The data generation unit is configured to: input the target feature tag into the target data generation model to obtain a target corpus for describing the target feature tag; or, the data generation unit is configured to: input the target corpus to be identified into the target data generation model to obtain a feature tag that characterizes the features of the target corpus to be identified.

6. The device according to claim 5, wherein: The model adjustment unit is further configured to: input the target sample label into the pre-trained model, take the target sample corpus as the expected output, train the pre-trained model, and obtain the target data generation model.

7. The device according to claim 6, wherein: The target feature label is a classification label estimated by a pre-built classification model based on the corpus to be identified; as well as, The data generation unit further includes a data verification module configured to: input the target corpus into the classification model to obtain a classification label of the target corpus; In response to determining that the preset label set of the classification model includes the classification label of the target corpus, the target corpus is determined as target data, and the target data is used to construct a training sample for the classification model.

8. The device according to claim 5, wherein: The model adjustment unit is further configured to: input the target sample corpus into the pre-training model, take the target sample label as the expected output, train the pre-training model, and obtain the target data generation model.

9. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.

10. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Language generation model based on composition theory feature classifier and writing support method

    CN112182210A