Model training method and device, copywriting generation method and device, equipment and storage medium
By sampling historical and target feature data to generate a training data set and training the target model, the problem of the target model forgetting historical knowledge when learning new features is solved, and the knowledge of historical and new features is made compatible.
Patent Information
- Application Number
- CN202410432507.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-10
- Publication Date
- 2025-10-17
AI Technical Summary
In the existing technology, the target model is prone to catastrophic forgetting when learning new feature knowledge, forgetting the knowledge of historical features, resulting in historical sample data being unable to be used in the training data set, causing knowledge loss.
By obtaining a set of candidate data nodes and a target sampling strategy, target data associated with historical features and target features are sampled to generate a training dataset, and the target model is trained to be compatible with historical and newly added feature knowledge.
This avoids discarding historical sample data, ensures that the target model retains historical feature knowledge while learning new feature knowledge, and solves the problem of catastrophic forgetting.
Smart Images

Figure CN120804397A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer, and in particular, to a model training method, a script generation method, an apparatus, a device and a storage medium. BACKGROUND
[0002] The target model can represent a machine learning model for generating user intended content.
[0003] The target model usually needs to construct a training data set based on historically accumulated sample data, and train the model using the training data set. When the target model needs to learn the knowledge of new features, the historically accumulated sample data usually does not contain the new features, resulting in that the historically accumulated sample data cannot be used to construct the training data set and can only be discarded. If the latest data containing the new features is used to train the target model, a catastrophic forgetting problem may occur, that is, the target model learns the knowledge of the new features, but forgets the knowledge of the historical features. SUMMARY
[0004] The present disclosure provides a model training method, a script generation method, an apparatus, a device and a storage medium, which can avoid discarding the historical sample data, and make the target model compatible with the knowledge of the historical features and the knowledge of the new features.
[0005] In a first aspect, the embodiments of the present disclosure provide a model training method, comprising:
[0006] obtaining a candidate data node set and a target sampling strategy, wherein the candidate data node set represents a set of candidate data nodes, the candidate data nodes include historical features and target features, and the historical features and the target features are respectively associated with target data in sample data corresponding to the candidate data nodes;
[0007] For the candidate data nodes in the candidate data node set, sampling the target data associated with the historical features and the target data associated with the target features according to the target sampling strategy to obtain a target data set;
[0008] generating a training data set according to the candidate data nodes and the target data set, and training a target model based on the training data set, so that the target model has knowledge corresponding to the historical features and the target features.
[0009] In a second aspect, the embodiments of the present disclosure provide a script generation method applied to a target model trained by the model training method of the first aspect of the present disclosure, comprising:
[0010] obtaining a target text in response to an input event for an interactive interface;
[0011] In response to a category setting event for the target text, a target application scenario corresponding to the target text is determined, and a candidate data node corresponding to the target application scenario is acquired;
[0012] Based on historical characteristics and target characteristics included in the candidate data node, target content is extracted from the target text, and a recommended script is generated based on the target content by using the target model.
[0013] In a third aspect, the embodiments of the present disclosure further provide a model training apparatus, which comprises:
[0014] An acquisition module is configured to acquire a candidate data node set and a target sampling strategy, wherein the candidate data node set represents a collection of candidate data nodes, the candidate data nodes include historical characteristics and target characteristics, and the historical characteristics and the target characteristics are respectively associated with target data in sample data corresponding to the candidate data nodes;
[0015] A sampling module is configured to sample target data associated with the historical characteristics and target data associated with the target characteristics according to the target sampling strategy for the candidate data nodes in the candidate data node set, to obtain a target data set;
[0016] A training module is configured to generate a training data set according to the candidate data nodes and the target data set, and train a target model based on the training data set, so that the target model has knowledge corresponding to the historical characteristics and the target characteristics.
[0017] In a fourth aspect, the embodiments of the present disclosure further provide a script generation apparatus, which is applied to a target model trained by using the model training method of the first aspect of the present disclosure, and comprises:
[0018] An input module is configured to acquire a target text in response to an input event for an interactive interface;
[0019] A setting module is configured to determine a target application scenario corresponding to the target text in response to a category setting event for the target text, and acquire a candidate data node corresponding to the target application scenario;
[0020] A generation module is configured to extract target content from the target text based on historical characteristics and target characteristics included in the candidate data node, and generate a recommended script based on the target content by using the target model.
[0021] In a fifth aspect, the embodiments of the present disclosure further provide an electronic device, which comprises:
[0022] One or more processors;
[0023] A storage apparatus configured to store one or more programs,
[0024] 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 of the embodiments of the present disclosure.
[0025] In a sixth aspect, the embodiments of the present disclosure further provide a storage medium containing computer executable instructions for executing the method according to any of the embodiments of the present disclosure when executed by a computer processor.
[0026] The embodiments of the present disclosure provide a model training method, which stores sample data according to historical characteristics and target characteristics of candidate data nodes, then samples the historical characteristics and the target characteristics of each candidate data node in a candidate data node set, combines the sampled target data to form a target data set, generates a training data set according to the candidate data nodes and the target data set, and trains a target model based on the training data set. Since the training data set contains target data corresponding to the historical characteristics and target data corresponding to the target characteristics, the target model trained based on the training data set has the knowledge of the newly added target characteristics on the basis of forgetting the knowledge of the historical characteristics. The embodiments of the present disclosure avoid discarding the historical sample data, solve the catastrophic forgetting problem caused by discarding the historical sample data, and make the target model compatible with the knowledge of the historical characteristics and the knowledge of the newly added characteristics. BRIEF DESCRIPTION OF DRAWINGS
[0027] The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals are used to represent the same or similar elements. It is to be understood that the drawings are schematically showing the elements and not necessarily to scale.
[0028] Figure 1 A flowchart of a model training method provided by the embodiments of the present disclosure;
[0029] Figure 2 A schematic diagram of a data storage structure provided by the embodiments of the present disclosure;
[0030] Figure 3 A flowchart of a sample data storage method in a model training method provided by the embodiments of the present disclosure;
[0031] Figure 4 A flowchart of a copywriting generation method provided by the embodiments of the present disclosure;
[0032] Figure 5 A structure schematic diagram of a model training device provided by the embodiments of the present disclosure;
[0033] Figure 6A structure schematic diagram of a text generation device provided by an embodiment of the present disclosure;
[0034] Figure 7 A structure schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] Embodiments of the present disclosure will be described in more detail with reference to the drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided so that the present disclosure can be more thoroughly and completely understood. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the scope of protection of the present disclosure.
[0036] It should be understood that each step described in the method embodiments of the present disclosure can be performed in different orders, and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0037] The term "comprising" and variations thereof as used herein are open-ended, that is, "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions will be given in the description below.
[0038] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0039] It should be noted that the modification of "one" or "multiple" mentioned in the present disclosure is illustrative rather than limiting, and those skilled in the art should understand that, unless otherwise explicitly indicated in the context, it should be understood as "one or more".
[0040] The names of the messages or information exchanged between the devices in the embodiments of the present disclosure are only for illustrative purposes, and are not used to limit the scope of the messages or information.
[0041] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained in a proper manner according to relevant laws and regulations.
[0042] For example, in response to receiving an active request of a user, a prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed by the user will require obtaining and using personal information of the user. Thus, the user can autonomously select whether to provide personal information to the software or hardware, such as an electronic device, an application program, a server or a storage medium, performing the operation of the technical solution of the present disclosure according to the prompt information.
[0043] As an optional but non-limiting implementation, in response to receiving an active request of a user, the prompt information can be sent to the user in the form of a pop-up window, and the prompt information can be presented in the form of text in the pop-up window. In addition, the pop-up window can also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0044] It can be understood that the above notification and obtaining user authorization process is only illustrative and does not limit the implementation of the present disclosure, and other ways that meet the relevant laws and regulations can also be applied to the implementation of the present disclosure.
[0045] It can be understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the relevant laws and regulations and the relevant provisions.
[0046] Figure 1 A flowchart of a model training method provided by the embodiments of the present disclosure is shown. The embodiments of the present disclosure are applicable to the case of training a vertical model, where the vertical model refers to a machine learning model trained in a specific field. For example, a copywriting model is a machine learning model trained in the copywriting field based on copywriting data. As the promotion of copywriting business, there can be a demand for new business categories or a demand for new features under the original business category, and then the copywriting model needs to be retrained to meet the above demands. The method can be performed by a model training device, which can be implemented in the form of software and / or hardware, and can be implemented by an electronic device, which can be a mobile terminal, a PC terminal or a server, etc.
[0047] As shown in Figure 1 , the method comprises:
[0048] S110, obtaining a candidate data node set and a target sampling strategy.
[0049] The candidate data node set represents a collection of candidate data nodes, and the candidate data nodes include historical characteristics and target characteristics. The historical characteristics and the target characteristics are respectively associated with target data in sample data corresponding to the candidate data nodes. The target data represents data content in the sample data corresponding to the historical characteristics, and data content in the sample data corresponding to the target characteristics.
[0050] Figure 2 A schematic diagram of a data storage structure provided by an embodiment of the present disclosure is shown. As shown, a first candidate data node 200 includes a second candidate characteristic 210, a third candidate characteristic 220, a fifth candidate characteristic 230, and a seventh candidate characteristic 240. A second candidate data node 250 includes a first candidate characteristic 260, the second candidate characteristic 210, the third candidate characteristic 220, and a fourth candidate characteristic 270. If it is necessary to add an eighth candidate characteristic 280 to the second candidate data node 250, the eighth candidate characteristic 280 is inserted into the second candidate data node 250 (the added characteristic is represented by a red box). Figure 2
[0051] The target sampling strategy represents information according to which sampling processing is performed on the candidate nodes under the candidate data node. For example, the target sampling strategy is used to set the historical characteristic sampling weight and / or the target characteristic sampling weight. Alternatively, the target sampling strategy can also be used to specify the number of samples of the historical characteristics in the candidate characteristics and the number of samples of the target characteristics. In order to ensure that the target data corresponding to the target characteristics can be sampled in the data sampling process, the target characteristic sampling weight in the target sampling strategy can be increased, so as to ensure that each target data set includes both data corresponding to the historical characteristics and data corresponding to the target characteristics.
[0052] In an embodiment of the present disclosure, the business categories can be set according to application scenarios, the business categories are represented by the candidate data nodes, and the candidate characteristics under each business category are set. The candidate characteristics can represent the constituent elements of the results corresponding to the business categories generated by the target model. The candidate characteristics include historical characteristics and target characteristics. The historical characteristics represent the candidate characteristics supported by the target model. The target characteristics can represent the candidate characteristics not yet supported by the target model, and the model is trained to enable the model to learn the knowledge of the target characteristics. Alternatively, an application scenario can include a category selection control in an interactive interface, the category selection control includes category items, and the values of the category items are used to represent the application scenarios. For example, the category selection control can be a menu selection item, the value of the category item corresponding to the menu selection item is used to determine the application scenario, and then the business categories are set according to the application scenario. For example, the value of the category item corresponding to the menu selection item is A+B+C+…, and the business categories set according to the application scenario are A+B+C+….
[0053] In some embodiments, the candidate data nodes and the candidate features can be configured by a target configuration file. For example, the candidate features are configured according to the dimensions of the candidate data nodes by the target configuration file. For a first candidate data node, x different candidate features are set. For a second candidate data node, m different candidate features are set, and so on, to complete the setting of each business category in the current application scenario. For example, in the field of copywriting, the business category is a poster, and the candidate features can include poster title, poster decoration, discount information, contact information, and address, etc. poster elements.
[0054] It should be noted that the business categories need to basically cover the application scenarios of the target business. For example, in the field of copywriting, the business categories need to basically cover the application scenarios of copywriting. For example, the business categories include poster, style copywriting, and promotion, etc.
[0055] Exemplarily, the obtaining of the candidate data node set and the target sampling strategy includes: detecting a model training event, obtaining a candidate data node set, historical feature sampling weights of candidate data nodes, and target feature sampling weights, wherein the target feature sampling weights are greater than the historical feature sampling weights.
[0056] In the embodiments of the present disclosure, the model training event can be triggered based on an update operation of the target configuration file. For example, after the target configuration file is updated, the target features of the candidate data nodes are added based on the updated target configuration file, and the target data associated with the target features in the sample data is obtained, the target features and the obtained target data are stored in association, and then the model training event is triggered. Alternatively, the model training event is triggered at a fixed time. Alternatively, the model training event is triggered manually, etc. The embodiments of the present disclosure do not limit the specific triggering manner.
[0057] In some embodiments, the data sampling range can be selected by manual input. For example, the candidate data node set can be constituted based on all candidate data nodes. Alternatively, the candidate data node set is constituted by selecting part of the candidate data nodes. The historical feature sampling weights and the target feature sampling weights of the candidate data nodes in the candidate data node set can be manually set. Alternatively, the number of target data associated with the historical features and the number of target data associated with the target features in the target data set can be manually set. The historical feature sampling weights and the target feature sampling weights are generated according to the number of target data associated with the historical features and the number of target data associated with the target features.
[0058] S120, for the candidate data nodes in the candidate data node set, the target data associated with the historical features and the target data associated with the target features are sampled according to the target sampling strategy, to obtain a target data set.
[0059] The target data set represents a collection of sampled target data. See Figure 2 If the second candidate characteristic 210, the fourth candidate characteristic 270 and the eighth candidate characteristic 280 in the second candidate data node 250 are sampled, the target data associated with the second candidate characteristic 210, the fourth candidate characteristic 270 and the eighth candidate characteristic 280 are obtained.
[0060] For example, for a candidate data node in the candidate data node set, if the candidate data node includes one historical characteristic and one target characteristic, the target data corresponding to the historical characteristic and the target characteristic are sampled respectively to obtain a target data set.
[0061] For a candidate data node in the candidate data node set, if the candidate data node includes at least two historical characteristics and at least two target characteristics, the sampling probability of each historical characteristic and the sampling probability of each target characteristic under the candidate data node are determined according to the historical characteristic sampling weight and the target characteristic sampling weight of the candidate data node. The historical characteristic and the target characteristic that meet the preset sampling condition under the candidate data node are determined according to the sampling probability of each historical characteristic and the sampling probability of each target characteristic. The target data associated with the historical characteristic and the target characteristic that meet the preset sampling condition are sampled to obtain a target data set.
[0062] Since the sampling of the candidate characteristics on the candidate data node adopts a random sampling manner, each candidate characteristic has an initial sampling probability. The sampling probability of each historical characteristic and the sampling probability of each target characteristic can be obtained by multiplying the initial sampling probability by the historical characteristic sampling weight and the target characteristic sampling weight. Then, based on the sampling probability of each historical characteristic and the sampling probability of each target characteristic under the candidate data node, the historical characteristic and the target characteristic that exceed the preset probability threshold are determined as the historical characteristic and the target characteristic that meet the preset sampling condition. Then, the target data associated with the historical characteristic and the target characteristic that meet the preset sampling condition are sampled to obtain the target data associated with the historical characteristic and the target data associated with the target characteristic. The target data associated with different characteristics are combined to obtain a target data set.
[0063] Optionally, the target characteristic sampling weight can be set through a target sampling strategy, and the target characteristic sampling weight is greater than 1. The sampling probability of the target characteristic is increased by multiplying the initial sampling probability of the target characteristic by the target characteristic sampling weight. Then, based on the initial sampling probability of each historical characteristic and the increased sampling probability of the target characteristic under the candidate data node, the historical characteristic and the target characteristic that meet the preset sampling condition are determined.
[0064] The history characteristics and target characteristics of each candidate data node in the candidate data node set are sampled in the above manner, which will not be described again here. It should be noted that at least two history characteristics and at least two target characteristics of each candidate data node can be sampled multiple times. Since the initial sampling probability is randomly generated, the initial sampling probability is a random number in each sampling process, and different groups of target data combinations can be collected. For example, the history characteristics and target characteristics of the second candidate data node are sampled, the target data combination {first candidate characteristic, second candidate characteristic, eighth candidate characteristic} is obtained by sampling for the first time, the target data combination {second candidate characteristic, fourth candidate characteristic, eighth candidate characteristic} is obtained by sampling for the second time, and the target data combination {first candidate characteristic, fourth candidate characteristic, eighth candidate characteristic} is obtained by sampling for the third time, and so on.
[0065] In S130, a training data set is generated according to the candidate data node and the target data set, and a target model is trained based on the training data set, so that the target model has knowledge corresponding to the history characteristics and the target characteristics.
[0066] The training data set represents a collection of training data. The training data is generated based on the candidate data node and the corresponding target data set. For example, the training data can be represented as the second candidate data node: {first candidate characteristic, fourth candidate characteristic, eighth candidate characteristic}.
[0067] The target model can represent a machine learning model for generating user expected content in a specific field. For example, the target model represents a script model. Accordingly, the sample data represents text data required for training the script model. For example, the sample data can include a paragraph of natural language, etc. The candidate data node represents a business category determined based on an application scenario of the script model.
[0068] Exemplarily, for the candidate data node in the candidate data node set, the candidate data node and the target data set are spliced to obtain the training data corresponding to the candidate data node; and the training data set is constituted according to the training data corresponding to each candidate data node in the candidate data node set. The target model is trained based on the training data set, so that the target model learns the knowledge of the target characteristics on the basis of not losing the knowledge of the history characteristics.
[0069] The technical solution of the embodiments of the present disclosure stores sample data according to historical characteristics and target characteristics of candidate data nodes, then performs data sampling on the historical characteristics and the target characteristics of each candidate data node in the candidate data node set, combines the sampled target data to form a target data set, generates a training data set according to the candidate data nodes and the target data set, and trains a target model based on the training data set. Since the training data set contains target data corresponding to the historical characteristics and target data corresponding to the target characteristics, the target model trained based on the training data set has the knowledge of the newly added target characteristics on the basis of forgetting the knowledge of the historical characteristics. The embodiments of the present disclosure avoid discarding the historical sample data, solve the catastrophic forgetting problem caused by discarding the historical sample data, and make the target model compatible with the knowledge of the historical characteristics and the knowledge of the newly added characteristics.
[0070] Figure 3 The flowchart of the storage method of sample data in the model training method provided by the embodiments of the present disclosure, the embodiments of the present disclosure additionally limit that the sample data is stored according to the historical characteristics and the target characteristics under the candidate data nodes on the basis of the above embodiments.
[0071] As Figure 3 shown, the method comprises:
[0072] S310, obtain the sample data, identify the business category corresponding to the sample data, traverse a target configuration file according to the business category, and obtain the candidate data node corresponding to the sample data.
[0073] The target configuration file is used to configure the candidate data node, the historical characteristics and the target characteristics.
[0074] In some embodiments, if the target model needs to support the newly added characteristics or the newly added business category, the target configuration file needs to be updated. The updating method of the target configuration file comprises: obtaining a configuration update request, parsing the configuration update request to obtain a target data node, a target characteristic and a characteristic value corresponding to the target characteristic. If the target data node belongs to the target configuration file, the target characteristic and the characteristic value are inserted at the position corresponding to the target data node in the target configuration file. If the target data node does not belong to the target configuration file, the target data node, the target characteristic and the characteristic value are inserted at the set position of the target configuration file.
[0075] For example, for the case of adding at least one candidate characteristic under a candidate data node, the configuration request includes the target data node, the target characteristic to be added, and the characteristic value. For example, the eighth candidate characteristic is added to the second candidate data node, and the configuration request includes the second candidate data node, the eighth candidate characteristic D, and the characteristic value: the text x. The eighth candidate characteristic D: the text x is inserted at the position corresponding to the second candidate data node in the target configuration file.
[0076] For the case of adding a candidate data node, the configuration request includes the target data node, the target characteristic of the candidate data node to be added, and the characteristic value. For example, the configuration request includes the target data node, the first candidate characteristic A, and the characteristic value: the text x, the fourth candidate characteristic E, and the characteristic value: the text v. The target data node is inserted at the end of the target configuration file, and the first candidate characteristic A: the text x and the fourth candidate characteristic E: the text v are inserted below the target data node.
[0077] For example, after collecting the sample data, the business category corresponding to the sample data can be determined by manual tagging. Alternatively, the business category corresponding to the sample data can be identified by a natural language processing model. Alternatively, sample data with a category identifier can also be directly obtained. The disclosure embodiments do not limit the source of the sample data, nor the identification method of the business category. By comparing the business category corresponding to the sample data with the candidate data nodes set in the target configuration file, the candidate data node to which the sample data belongs is obtained.
[0078] S320, data extraction is performed on the sample data according to the historical characteristics and the target characteristics under the candidate data node respectively, to obtain target data corresponding to the historical characteristics and the target characteristics respectively.
[0079] For example, data extraction is performed on the sample data according to the historical characteristics under the candidate data node, to obtain target data corresponding to the historical characteristics. Data extraction is performed on the sample data according to the target characteristics under the candidate data node, to obtain target data corresponding to the target characteristics.
[0080] S330, the target data is stored in association with the historical characteristics or the target characteristics under the candidate data node.
[0081] For example, for the target data corresponding to the historical characteristics, the target data is stored in association with the corresponding historical characteristics. For the target data corresponding to the target characteristics, the target data is stored in association with the corresponding target characteristics.
[0082] It should be noted that if a candidate data node needs to add a new feature, the candidate feature corresponding to the candidate data node in the target configuration file before updating can be taken as a historical feature, and the feature to be added can be taken as a target feature. Before the target configuration file performs the feature addition operation, the sample data is stored according to the historical feature. After the target configuration file performs the feature addition operation, for the candidate data node corresponding to the added feature, the sample data corresponding to the candidate data node is stored according to the historical feature and the target feature.
[0083] The technical scheme of the embodiment of the present disclosure sets the candidate data node, the historical feature and the target feature through the target configuration file, and can add the target feature through the target configuration file, so as to expand new data on the basis of historical sample data and avoid discarding historical sample data. Since the sample data is stored according to the historical feature and the target feature under the candidate data node, it is convenient to sample the target data including the historical feature and the target feature when the training sample is constituted.
[0084] Figure 4 A flowchart of a text generation method provided by the embodiment of the present disclosure, the embodiment of the present disclosure is applicable to a case that a user inputs a natural language describing a text requirement, and a recommended text meeting the user requirement is automatically generated through a text model, wherein the text model is a machine learning model trained in the text field based on text data. Specifically, the text model can be a target model trained by using the model training method described in each of the above embodiments. The method can be executed by a text generation device, which can be implemented in the form of software and / or hardware, and can be implemented by an electronic device, which can be a mobile terminal, a PC terminal or a server, etc.
[0085] S410, in response to an input event for an interactive interface, obtaining a target text.
[0086] The input event is used to represent an input operation of the target text. The target text can represent a natural language describing a text requirement. For example, the user inputs a natural language describing a text requirement in an input box of the interactive interface.
[0087] S420, in response to a category setting event for the target text, determining a target application scenario corresponding to the target text, and obtaining a candidate data node corresponding to the target application scenario.
[0088] The category setting event represents a setting operation of the category to which the target text belongs. For example, the category setting operation for the target text can be input through a category selection control, or the category setting operation for the target text can be input through a text box, etc.
[0089] The target application scenario represents the application scenario of the script model set by the category setting event. Since the candidate data node represents the business category determined based on the application scenario of the script model, after determining the application scenario, the candidate data node to which the target text belongs can be determined.
[0090] For example, a category selection control is displayed in the interaction interface, and the category selection control includes a category item, wherein the value of the category item is used to represent the application scenario; in response to a selection event of the category item, the target application scenario corresponding to the target text is determined according to the value of the selected category item.
[0091] For example, if the category selection control is a menu selection item, the application scenario is displayed through the menu selection item in the interaction interface. Alternatively, the menu selection item includes a category item, and the application scenario is represented by the value of the category item. If the user selects A through the first category item, B through the second category item, and C through the third category item, the application scenario is represented as A+B+C.
[0092] S430, based on the historical characteristics and target characteristics included in the candidate data node, performing content extraction on the target text to obtain target content, and generating recommended scripts based on the target content through the target model.
[0093] For example, after determining the candidate data node corresponding to the target application scenario, the historical characteristics and target characteristics under the determined candidate data node are used to perform processing such as word segmentation and keyword extraction on the target text to obtain target content. The target content is input into the script model, and the script model generates recommended scripts that meet the user's needs.
[0094] The technical scheme of the embodiment of the present disclosure inputs the target text through the interaction interface, sets the target application scenario corresponding to the target text, then obtains the candidate data node corresponding to the target application scenario, performs content extraction processing on the target text based on the historical characteristics and target characteristics included in the candidate data node to obtain target content, and generates recommended scripts based on the target content through the script model. Since the script model is compatible with the knowledge of historical characteristics and the knowledge of target characteristics, the accuracy of script recommendation can be improved, and the script generation experience is improved.
[0095] Figure 5 A model training device structure schematic diagram provided by the embodiment of the present disclosure, the device can be realized by software and / or hardware, and can be realized by an electronic device, which can be a mobile terminal, a PC terminal or a server, etc.
[0096] As shown in Figure 5 The device includes an acquisition module 510, a sampling module 520, and a training module 530.
[0097] The acquisition module 510 is configured to acquire a candidate data node set and a target sampling strategy, where the candidate data node set represents a set of candidate data nodes, the candidate data nodes include historical characteristics and target characteristics, and the historical characteristics and the target characteristics are respectively associated with target data in sample data corresponding to the candidate data nodes.
[0098] The sampling module 520 is configured to sample, for a candidate data node in the candidate data node set, target data associated with the historical characteristics and target data associated with the target characteristics according to the target sampling strategy, to obtain a target data set.
[0099] The training module 530 is configured to generate a training data set according to the candidate data nodes and the target data set, and train a target model based on the training data set, so that the target model has knowledge corresponding to the historical characteristics and the target characteristics.
[0100] Optionally, the storage manner of the target data includes:
[0101] The sample data is acquired, a business category corresponding to the sample data is identified, a target configuration file is traversed according to the business category, and a candidate data node corresponding to the sample data is obtained, where the target configuration file is used to configure the candidate data node, historical characteristics and target characteristics.
[0102] The sample data is subjected to data extraction according to the historical characteristics and the target characteristics under the candidate data node respectively, to obtain target data corresponding to the historical characteristics and the target characteristics respectively.
[0103] The target data is stored in association with the historical characteristics or the target characteristics under the candidate data node.
[0104] Optionally, the update manner of the target configuration file includes:
[0105] A configuration update request is acquired, and a target data node, a target characteristic and a characteristic value corresponding to the target characteristic are obtained by parsing the configuration update request;
[0106] If the target data node belongs to the target configuration file, the target characteristic and the characteristic value are inserted at a position corresponding to the target data node in the target configuration file.
[0107] If the target data node does not belong to the target configuration file, the target data node, the target characteristic and the characteristic value are inserted at a set position of the target configuration file.
[0108] Optionally, the acquisition module 510 is specifically configured to:
[0109] The model training event is detected, and a candidate data node set, a historical characteristic sampling weight of the candidate data node, and a target characteristic sampling weight are obtained, where the target characteristic sampling weight is greater than the historical characteristic sampling weight.
[0110] Optionally, if the candidate data node includes at least two historical characteristics and at least two target characteristics, the sampling module 520 is specifically configured to:
[0111] According to the historical characteristic sampling weight and the target characteristic sampling weight of the candidate data node, the sampling probability of each historical characteristic and the sampling probability of each target characteristic under the candidate data node are determined.
[0112] According to the sampling probability of each historical characteristic and the sampling probability of each target characteristic, the historical characteristic and the target characteristic that meet the preset sampling condition under the candidate data node are determined.
[0113] The target data associated with the historical characteristic and the target characteristic that meet the preset sampling condition are sampled.
[0114] Optionally, the training module 530 is specifically configured to:
[0115] For the candidate data node in the candidate data node set, the candidate data node and the target data set are spliced to obtain the training data corresponding to the candidate data node;
[0116] According to the training data corresponding to each candidate data node in the candidate data node set, a training data set is constituted.
[0117] Optionally, the sample data represents text data required for copywriting model training, the target model represents a copywriting model, and the candidate data node represents a business category determined based on an application scenario of the copywriting model.
[0118] The model training apparatus provided in the embodiments of the present disclosure can execute the model training method provided in any of the embodiments of the present disclosure, and has the function modules and beneficial effects corresponding to the execution method.
[0119] Figure 6 A structure diagram of a copywriting generation apparatus provided in the embodiments of the present disclosure is shown in the figure. The apparatus can be implemented in the form of software and / or hardware. The apparatus generates recommended copywriting based on a target model trained by the model training method described in any of the embodiments of the present disclosure. Optionally, the apparatus is implemented by an electronic device, which can be a mobile terminal, a PC terminal, or a server, etc.
[0120] As shown in the figure, the apparatus includes an input module 610, a setting module 620, and a generation module 630. Figure 6
[0121] The input module 610 is configured to acquire target text in response to an input event for an interactive interface.
[0122] The setting module 620 is configured to determine a target application scenario corresponding to the target text in response to a category setting event for the target text, and acquire a candidate data node corresponding to the target application scenario.
[0123] The generation module 630 is configured to perform content extraction on the target text based on historical characteristics and target characteristics included in the candidate data node to obtain target content, and generate recommended scripts based on the target content through the target model.
[0124] Optionally, the setting module 620 is specifically configured to:
[0125] display a category selection control in the interactive interface, the category selection control including a category item, wherein a value of the category item is used to represent an application scenario.
[0126] In response to a selection event for the category item, determine the target application scenario corresponding to the target text according to the value of the selected category item.
[0127] The script generation apparatus provided in the embodiments of the present disclosure can perform the script generation method provided in any of the embodiments of the present disclosure, and has the corresponding function modules and beneficial effects of performing the method.
[0128] It should be noted that each unit and module included in the above apparatus is only divided according to the function logic, but is not limited to the above division, as long as the corresponding function can be implemented; in addition, the specific name of each functional unit is only for convenient distinction, and does not limit the protection scope of the embodiments of the present disclosure.
[0129] Figure 7 A structural schematic diagram of an electronic device provided in the embodiments of the present disclosure is shown in FIG. 7. Figure 7 FIG. 7 shows a structural schematic diagram of an electronic device (for example, a terminal device or a server in Figure 7 in the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), and a PAD (Tablet Personal Computer), and a fixed terminal such as a digital TV, a desktop computer, and the like. Figure 7 The electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiments of the present disclosure.
[0130] As shown in FIG. 7, the electronic device 700 can include one or more of the following components: a processing component 710, a memory 720, a power supply component 730, a display component 740, an audio component 750, a input component 760, a communication component 770, an external device interface 780, a sensor component 790, and a power component 795. Figure 7As shown, the electronic device 700 can include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701 that can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 702 or loaded into a random access memory (RAM) 703 from a storage device 708. Various programs and data required for the operation of the electronic device 700 are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0131] Generally, the following devices can be connected to the I / O interface 705: input devices 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 708 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 709. The communication devices 709 can allow the electronic device 700 to communicate wirelessly or wired with other devices to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that not all of the shown devices are required to be implemented or possessed. More or fewer devices can alternatively be implemented or possessed.
[0132] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication devices 709, or installed from the storage devices 708, or installed from the ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
[0133] The names of the messages or information exchanged between the plurality of devices in the embodiments of the present disclosure are only for illustrative purposes, and are not intended to limit the scope of the messages or information.
[0134] The electronic device provided by the embodiments of the present disclosure and the method provided by the above-described embodiments belong to the same inventive concept, and the technical details not described in detail in the present embodiments can be referred to the above-described embodiments, and the present embodiments have the same beneficial effects as the above-described embodiments.
[0135] The embodiments of the present disclosure provide a computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided by the above-described embodiments.
[0136] Note that the computer readable medium described above in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination thereof. The computer readable storage medium can be, for example and without limitation, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave in a propagated data signal, in which the computer readable program code is contained. Such a propagated data signal can take any of a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination thereof. The computer readable signal medium can also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate or transport a program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer readable medium can be transmitted by any suitable medium, including but not limited to wire, cable, RF, etc., or any suitable combination thereof.
[0137] In some embodiments, the client, server, or both can communicate using any current known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), the Internet, and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any current known or future developed networks.
[0138] The computer readable medium described above can be included in the electronic device described above; or can exist separately from the electronic device, and can be accessed via the electronic device.
[0139] The computer readable medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: obtain a candidate data node set and a target sampling strategy, wherein the candidate data node set represents a set of candidate data nodes, the candidate data nodes include historical features and target features, the historical features and the target features are respectively associated with target data in sample data corresponding to the candidate data nodes;
[0140] For a candidate data node in the candidate data node set, the target data associated with the historical features and the target data associated with the target features are sampled according to the target sampling strategy, to obtain a target data set;
[0141] A training data set is generated according to the candidate data nodes and the target data set, and a target model is trained based on the training data set, so that the target model has knowledge corresponding to the historical features and the target features.
[0142] Alternatively, the computer readable medium carries one or more programs, when the one or more programs are executed by the electronic device, the electronic device is caused to: in response to an input event for an interactive interface, obtain target text;
[0143] In response to a category setting event for the target text, a target application scenario corresponding to the target text is determined, and a candidate data node corresponding to the target application scenario is obtained;
[0144] Based on the historical features and the target features included in the candidate data node, target content is extracted from the target text, and a recommended script is generated based on the target content by the target model.
[0145] Computer program code for carrying out operations of the present disclosure can be written in one or more programming languages or combinations of languages including object oriented programming languages such as Java, Smalltalk, C++ or conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0146] The computer program product of the first aspect can include one or more non-transitory computer-readable media storing instructions that, when executed, cause one or more processors to perform the operations of the method of the first aspect. The computer program product of the first aspect can include a computer-readable medium storing instructions that, when executed, cause one or more processors to perform the operations of the method of the first aspect.
[0147] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware, or by a combination of software and hardware. In some cases, the names of the units do not constitute a limitation on the units themselves.
[0148] The functions described in this document can be implemented in part or in whole in hardware, firmware, software, or any combination thereof. For example, one or more hardware logic components can be used to perform the functions. Examples of hardware logic components can include programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-chips (SOCs), complex programmable logic devices (CPLDs), etc.
[0149] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium can include a tangible, non-transitory memory, such as a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0150] The above description merely illustrates the preferred embodiments of the disclosure and a principle for applying the technologies. It is understood by those skilled in the art that the disclosed scope of the disclosure is not limited to the technical solutions formed by the specific combinations of the technical features described above, and should also cover other technical solutions formed by the combinations of the technical features described above or their equivalent features without departing from the disclosed concept. For example, the technical solutions formed by the mutual replacement of the above-described features and the technical features with similar functions disclosed in the disclosure (but not limited to) can be formed.
[0151] Further, although operations are depicted in a particular, sequential order, this should not be understood as requiring or implying that the operations are performed in the order illustrated or sequentially. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, although specific implementation details are included for the purpose of providing a thorough disclosure, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.
[0152] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A model training method, characterized in that: include: Obtaining a candidate data node set and a target sampling strategy, wherein the candidate data node set represents a collection of candidate data nodes, the candidate data nodes include historical characteristics and target characteristics, and the historical characteristics and target characteristics are respectively associated with target data in sample data corresponding to the candidate data nodes and stored; For the candidate data nodes in the candidate data node set, sampling the target data associated with the historical characteristics and the target data associated with the target characteristics according to the target sampling strategy to obtain a target data set; A training data set is generated according to the candidate data nodes and the target data set, and a target model is trained based on the training data set so that the target model has knowledge corresponding to the historical characteristics and the target characteristics.
2. The method according to claim 1, characterized in that The storage method of the target data includes: Acquire the sample data, identify a business category corresponding to the sample data, and traverse a target configuration file according to the business category to obtain a candidate data node corresponding to the sample data, wherein the target configuration file is used to configure the candidate data node, historical characteristics, and target characteristics; Extracting data from the sample data according to the historical characteristics and target characteristics of the candidate data nodes to obtain target data corresponding to the historical characteristics and target characteristics respectively; The target data is associated with the historical characteristics or target characteristics under the candidate data node and stored.
3. The method according to claim 2, characterized in that The target configuration file is updated in the following manner: Obtaining a configuration update request, parsing the configuration update request to obtain a target data node, a target characteristic, and a characteristic value corresponding to the target characteristic; If the target data node belongs to the target configuration file, inserting the target characteristic and characteristic value at a position in the target configuration file corresponding to the target data node; If the target data node does not belong to the target configuration file, the target data node, target characteristic and characteristic value are inserted into the setting position of the target configuration file.
4. The method according to claim 1, wherein The obtaining of the candidate data node set and the target sampling strategy includes: A model training event is detected, and a set of candidate data nodes, historical feature sampling weights of the candidate data nodes, and a target feature sampling weight are obtained, wherein the target feature sampling weight is greater than the historical feature sampling weight.
5. The method according to claim 1, wherein If the candidate data node includes at least two historical characteristics and at least two target characteristics, sampling the target data associated with the historical characteristics and the target data associated with the target characteristics according to the target sampling strategy includes: Determine the sampling probability of each historical characteristic and the sampling probability of each target characteristic under the candidate data node according to the historical characteristic sampling weight and the target characteristic sampling weight of the candidate data node; Determine the historical characteristics and target characteristics that meet the preset sampling conditions under the candidate data node according to the sampling probability of each historical characteristic and the sampling probability of each target characteristic; Sample the target data associated with the historical characteristics and target characteristics that meet the preset sampling conditions.
6. The method according to claim 1, characterized in that Generating a training data set according to the candidate data nodes and the target data set includes: For the candidate data nodes in the candidate data node set, concatenate the candidate data nodes and the target data set to obtain training data corresponding to the candidate data nodes; A training data set is constructed according to the training data corresponding to each candidate data node in the candidate data node set.
7. The method according to claim 1, characterized in that The sample data represents text data required for copywriting model training, the target model represents the copywriting model, and the candidate data node represents a business category determined based on an application scenario of the copywriting model.
8. A copywriting generation method, characterized in that: A target model trained using the model training method according to any one of claims 1 to 7, comprising: Responding to an input event on the interactive interface, obtaining a target text; In response to a category setting event for the target text, determining a target application scenario corresponding to the target text, and acquiring a candidate data node corresponding to the target application scenario; Based on the historical characteristics and target characteristics included in the candidate data nodes, content extraction is performed on the target text to obtain target content, and a recommendation copy is generated based on the target content through the target model.
9. The method according to claim 8, characterized in that The step of determining a target application scenario corresponding to the target text in response to a category setting event for the target text includes: Displaying a category selection control in the interactive interface, the category selection control including category items, wherein the value of the category item is used to represent the application scenario; In response to a selection event for the category item, a target application scenario corresponding to the target text is determined according to a value of the selected category item.
10. A model training device, characterized in that: include: an acquisition module, configured to acquire a candidate data node set and a target sampling strategy, wherein the candidate data node set represents a collection of candidate data nodes, the candidate data nodes include historical characteristics and target characteristics, and the historical characteristics and target characteristics are respectively associated and stored with target data in sample data corresponding to the candidate data nodes; a sampling module, configured to sample the target data associated with the historical characteristics and the target data associated with the target characteristics for the candidate data nodes in the candidate data node set according to the target sampling strategy, to obtain a target data set; The training module is used to generate a training data set according to the candidate data nodes and the target data set, and train the target model based on the training data set so that the target model has knowledge corresponding to the historical characteristics and the target characteristics.
11. A copywriting generating device, characterized in that: A target model trained using the model training method according to any one of claims 1 to 7, comprising: An input module, configured to obtain a target text in response to an input event on the interactive interface; A setting module, configured to, in response to a category setting event for the target text, determine a target application scenario corresponding to the target text, and obtain a candidate data node corresponding to the target application scenario; A generation module is used to extract the target text based on the historical characteristics and target characteristics included in the candidate data node to obtain target content, and generate a recommendation copy based on the target content through the target model.
12. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, 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 9.
13. A storage medium containing computer-executable instructions, characterized in that: The computer executable instructions are used to perform the method according to any one of claims 1 to 9 when executed by a computer processor.