Model training method and computing device
By allocating training environments and data on servers for model training, the problem of data leakage on shared platforms is solved, and the privacy of model training data is protected.
Patent Information
- Application Number
- CN202510927463.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-11-18
AI Technical Summary
When using data from shared platforms to train models, there is a risk of data leakage. How can we improve data privacy?
By allocating the target training environment and target training data on the server to train the model, the trained model parameter file is obtained instead of directly sending the training data, thus avoiding data leakage.
This technology enables the acquisition of trained model parameter files even when the model cannot be trained on the terminal device, effectively preventing the leakage of training data and improving the privacy of training data.
Smart Images

Figure CN120975262A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computing, and in particular, to a model training method and a computing device. BACKGROUND
[0002] With the development of artificial intelligence technology, artificial intelligence models are increasingly used in various fields. Currently, before using an artificial intelligence model, the model needs to be trained so that the trained model can meet the requirements. For example, data can be obtained from a data sharing platform, and the model can be trained based on the data.
[0003] However, when the model is trained using the data of the sharing platform, data leakage can occur. Therefore, how to improve the privacy of the data has become a technical problem to be solved. SUMMARY
[0004] The present application provides a model training method and a computing device, which can solve the problem of training data leakage of a sharing platform.
[0005] In a first aspect, the present application provides a model training method, which can be applied to a server. In the method, a model training request sent by a first terminal device can be received, and the model training request is used to indicate training of a target model. Then, in response to the model training request, a target training environment and target training data are allocated for the target model. Next, the target model can be trained based on the target training data in the target training environment to obtain a trained target model. Then, a model parameter file of the trained target model can be sent to the first terminal device.
[0006] Based on the above technical solution, the model training request sent by the first terminal device can be received, and the model training request is used to indicate training of the target model. Then, in response to the model training request, the target training environment and the target training data are allocated for the target model, and the target model is trained based on the target training data in the target training environment to obtain the trained target model. That is, the model can be trained by the target training environment allocated by the server without training the model on the terminal device. Then, the model parameter file of the trained target model is sent to the first terminal device. In this way, even if the terminal device does not have the conditions to train the model, a trained model can still be obtained. Moreover, only the model parameter file is sent, and the target training data is not included. In this way, data leakage can be avoided, and the privacy of the training data is improved.
[0007] In combination with the first aspect, in another possible implementation, it is detected whether the model parameter file contains the target training data. In the case where the model parameter file does not contain the target training data, the model parameter file of the trained target model is sent.
[0008] With reference to the first aspect, in a possible implementation manner, the model parameter file is sent to the first terminal device after the target training data is removed from the model parameter file.
[0009] With reference to the first aspect, in a possible implementation manner, the target training environment is set by a user who provides the target training data.
[0010] With reference to the first aspect, in a possible implementation manner, the model training request comprises an identifier of the target training environment and / or an identifier of the target training data.
[0011] With reference to the first aspect, in a possible implementation manner, the trained target model is deployed based on the model parameter file. In a case where the trained target model is successfully deployed, it is determined that the target training data is not contained in the model parameter file. In a case where the trained target model fails to be deployed, it is determined that the target training data is contained in the model parameter file, and the data type of the target training data in the model parameter file is different from the data type of the model parameter.
[0012] It can be understood that, in a case where the trained target model is successfully deployed, it indicates that the model parameter file does not contain data of a type different from the data type of the model parameter. Therefore, it can be determined that the target training data is not contained in the model parameter file. In a case where the trained target model fails to be deployed, it indicates that the model parameter file contains the target training data of a type different from the data type of the model parameter. Therefore, it can be determined that the target training data is contained in the model parameter file.
[0013] With reference to the first aspect, in a possible implementation manner, in a case where the trained target model is successfully deployed, the output accuracy of the trained target model is determined based on the target training data, and the data type of the target training data in the model parameter file is the same as the data type of the model parameter. In a case where the output accuracy is greater than or equal to a preset accuracy threshold, it is determined that the target training data is not contained in the model parameter file.
[0014] It should be understood that, in a case where the target training data is not contained in the model parameter file, it indicates that the model parameter has not changed, and the output accuracy of the trained target model is high. Therefore, in a case where the output accuracy is greater than or equal to the preset accuracy threshold, it can be determined that the target training data is not contained in the model parameter file.
[0015] In a possible implementation manner of the first aspect, the model training request further includes initial model parameters of the target model and a model training script, the model training script including an algorithm framework of the target model and training requirement information. The trained target model is obtained by running the model training script, deploying the target model based on the algorithm framework of the target model and the initial model parameters, and training the target model based on the training requirement information and the target training data.
[0016] In a possible implementation manner of the first aspect, the query request message sent by the first terminal device is received, the query request message being used to indicate querying the target training data matching the keyword. In response to the query request message, the identifier of the target training data matching the keyword is determined from the database based on the keyword, and the database stores meta information of a plurality of preset training data. The identifier of the target training data and / or the identifier of the target training environment are sent to the first terminal device, the identifier of the target training environment being determined based on the identifier of the target training data.
[0017] In a possible implementation manner of the first aspect, the target training data uploaded by the second terminal device is received. The target training data and / or the meta information of the target training data are stored.
[0018] In a possible implementation manner of the first aspect, the usage frequency of the target training data is obtained. The target reward resource is determined based on the usage frequency of the target training data. The target reward resource is sent to the second terminal device.
[0019] It can be understood that after the usage frequency of the target training data is obtained, the target reward resource can be determined based on the usage frequency of the target training data. Then, the target reward resource can be sent to the second terminal device. In this way, positive feedback can be provided to the data provider, thereby improving the enthusiasm of providing data.
[0020] In a possible implementation manner of the first aspect, the usage frequency of the target training data is obtained. The target reward resource is determined based on the usage frequency of the target training data. The target reward resource is sent to the second terminal device.
[0021] It can be understood that after the usage frequency of the target training data is obtained, the target reward resource can be determined based on the usage frequency of the target training data. Then, the target reward resource can be sent to the second terminal device. In this way, positive feedback can be provided to the data provider, thereby improving the enthusiasm of providing data.
[0022] With reference to the second aspect, in a possible implementation manner, a usage frequency of the target training data is acquired. Then, the target reward resource is determined based on the usage frequency of the target training data. The target reward resource is sent to the second terminal device.
[0023] In a third aspect, the present application provides a computing device, comprising: a memory and one or more processors, the memory being coupled to the processors; the memory is configured to store computer program codes, the computer program codes comprising computer instructions; when the computer instructions are executed by the one or more processors, the computing device performs the method according to the first aspect, the second aspect and any possible implementation manner thereof.
[0024] In a fourth aspect, the present application provides a chip system applied to a computing device. The chip system comprises one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected through a circuit. The interface circuit is configured to receive a signal from a memory of the computing device and send the signal to the processor, the signal comprising computer instructions stored in the memory. When the processor executes the computer instructions, the computing device performs the method according to the first aspect, the second aspect and any possible implementation manner thereof.
[0025] In a fifth aspect, the present application provides a computer readable storage medium, comprising computer instructions, when the computer instructions are run on a computing device, the computing device performs the method according to the first aspect, the second aspect and any possible implementation manner thereof.
[0026] In a sixth aspect, the present application provides a computer program product, when the computer program product is run on a computer, the computer performs the method according to the first aspect, the second aspect and any possible implementation manner thereof.
[0027] It can be understood that the computing device according to the third aspect and any possible implementation manner thereof, the chip system according to the fourth aspect, the computer readable storage medium according to the fifth aspect and the computer program product according to the sixth aspect can achieve the beneficial effects as described in the first aspect and any possible implementation manner thereof, which will not be described here. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 A schematic diagram of a model training system architecture provided by an embodiment of the present application;
[0029] Figure 2 A hardware structure schematic diagram of a computing device provided by an embodiment of the present application;
[0030] Figure 3 A flow chart of a model training method provided by an embodiment of the present application is shown in FIG. 1.
[0031] Figure 4 A flow chart of another model training method provided by an embodiment of the present application is shown in FIG. 2.
[0032] Figure 5 A flow chart of another model training method provided by an embodiment of the present application is shown in FIG. 3.
[0033] Figure 6 A schematic diagram of a model training device provided by an embodiment of the present application is shown in FIG. 4.
[0034] Figure 7 A schematic diagram of a structure of a chip system provided by an embodiment of the present application is shown in FIG. 5. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0036] In the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship. For example, A / B can be understood as A or B.
[0037] The terms "first", "second", etc. are only used for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second", etc. can explicitly or implicitly include one or more of the features. In the description of the embodiments, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0038] In addition, the terms "include" and "have" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but can optionally include other steps or modules that are not listed, or can optionally include other steps or modules inherent to the process, method, product or device.
[0039] In addition, in the embodiments of the present application, the word "exemplary" or "for example" is used to mean serving as an example, instance, or illustration. Any embodiment or design presented as "exemplary" or "for example" in the present application should not be construed as preferred or advantageous over other embodiments or designs. In fact, the word "exemplary" or "for example" is used to present concepts in a concrete manner.
[0040] In order to facilitate understanding of the technical solutions of the present application, before the training method of the model of the embodiments of the present application is introduced in detail, the professional terms mentioned in the embodiments of the present application are introduced.
[0041] 1. Algorithm framework: the algorithm framework is a software library for building, training and deploying artificial intelligence models. For example, the artificial intelligence algorithm (artificial intelligence, AI) framework can be TensorFlow, PyTorch, Caffe, etc.
[0042] 2. Data type: data type refers to the encoding method of data in the storage, processing and transmission process. Different AI frameworks may require different data types. For example, the data type corresponding to TensorFlow can be TFRecord type, NumPy array, Python list. The data type corresponding to PyTorch can be Tensor type, NumPy array. The data type corresponding to Caffe can be LevelDB type, LMDB type.
[0043] 3. Meta information: meta information is used to describe some basic characteristics of data, such as data size, data type, data quality index, etc.
[0044] The embodiments of the present application provide a model training method, in which a model training request sent by a first terminal device can be received, and the model training request is used to indicate training of a target model. Then, in response to the model training request, a target training environment and target training data are allocated for the target model, and the target model is trained based on the target training data in the target training environment to obtain a trained target model. That is, the terminal device does not need to train the model, and the server can train the model in the target training environment allocated by the server. Then, a model parameter file of the trained target model is sent to the first terminal device. In this way, even if the terminal device does not have the condition to train the model, a trained model can also be obtained. Moreover, only the model parameter file is sent, and the target training data is not included. In this way, the training data leakage can be avoided, and the privacy of the training data is improved.
[0045] The implementation environment of the embodiments of the present application is introduced as follows.
[0046] AsFigure 1 As shown, the training system of the model provided in the embodiment of the present application includes a server 101, a terminal device 102, a terminal device 103, and a terminal device 104.
[0047] The server 101 is configured to store a plurality of training data and / or meta information of the training data, and the plurality of training data includes training data of different data types. In addition, the server 101 can also be configured to provide the training data to the terminal device. For example, the server 101 can also be configured to receive a query request message from the terminal device 102, and feed back a query result to the terminal device 102, where the query result can include a data identifier of the training data.
[0048] In some embodiments, the server 101 can also be configured to provide the training data to the terminal device, and help the terminal device train the model using the training data. The server 101 can receive the model sent by the terminal device 102. In addition, the server 101 can assign a training environment and training data to the model, and complete the training of the model in the training environment. In addition, the server 101 can send a parameter file of the trained model to the terminal device 102.
[0049] It should be noted that the training environment is used to train the model, and the training environment includes resources used to train the model, such as a graphics processing unit (GPU) resource, a tensor processing unit (TPU) resource, and a central processing unit (CPU) resource. The training environment is not limited in the embodiment of the present application. The training environment can be in the server, that is, the training environment can be the resource in the server used to train the model. Alternatively, the training environment can be other devices other than the server.
[0050] In some embodiments, the server 101 can also receive the training data uploaded by the terminal device 103 and the terminal device 104, and store the training data and / or meta information of the training data, where the meta information is used to describe the data attributes of the training data.
[0051] In the embodiment of the present application, the server 101 can include at least one computing device. Different computing devices in the at least one computing device can communicate with each other.
[0052] It should be noted that the server 101 can be one physical or logical server, or two or more physical or logical servers sharing different responsibilities and cooperating with each other to realize the functions of the server.
[0053] Exemplarily, the server 101 can be a blade server, a high-density server, a rack server, a tower server, etc.
[0054] In the embodiment of the present application, the terminal device 102 can be configured to send a model to the server 101, and receive a parameter file of the trained model sent by the server 101.
[0055] Optionally, the terminal device 102 can also be configured to send a query request message to the server 101, and receive a query result sent by the server 101, wherein the query result can include a data identifier of the training data.
[0056] Optionally, the terminal device can be a mobile phone, a tablet computer, a handheld computer, a personal computer (PC), a cellular phone, a personal digital assistant (PDA), a wearable device (such as a smart watch, a smart bracelet, etc.), a smart home device (such as a television, etc.), a car machine (such as a car computer, etc.), a smart screen, a game console, a headset, an AI sound, an augmented reality (AR) / virtual reality (VR) device, an ultra-mobile personal computer (UMPC), a notebook computer, a netbook, a desktop computer, or an all-in-one computer, etc.
[0057] In terms of hardware implementation, the server 101 and the terminal device 102 can both be implemented by a computing device as shown in Figure 2 The hardware structure of the computing device provided by the embodiment of the present application is shown in Figure 2
[0058] As shown in Figure 2 The hardware part of the computing device includes a processor, a basic input output system (BIOS) chip, an out-of-band controller, and a memory. Of course, it also includes a fan for cooling the processor. The software part mainly includes the BIOS, an out-of-band management module, and an operating system (OS).
[0059] The processor can include a CPU, and the CPU includes one or more CPU cores. The more CPU cores included in the CPU, the faster the speed of processing data.
[0060] The BIOS chip is a chip disposed on the motherboard for initializing and detecting various hardware in the booting process of the computing device. The BIOS chip includes a flash memory area.
[0061] The out-of-band management module is located in the out-of-band controller, and the operating system is located in the processor.
[0062] The out-of-band management module can be a management unit of a non-service module. For example, the out-of-band management module can perform remote maintenance and management on the computing device through a dedicated data channel. The out-of-band management module is completely independent of the operating system of the computing device, and can communicate with the BIOS and the operating system through the out-of-band management interface of the computing device.
[0063] For example, the out-of-band management module can include a management unit of a computing device running state, a management system in a management chip, a baseboard management controller (BMC), a system management module (SMM), and the like. It should be noted that the specific form of the out-of-band management module is not limited in the embodiments of the present application, and the above is only an example.
[0064] The OS is a computer program for managing and controlling hardware and software resources of the computing device. Any other software must run under the support of the operating system. After the computing device is powered on, the BIOS first performs a series of operations such as self-checking and initialization, and then boots the OS for starting, so that the user can normally use the computing device.
[0065] The BIOS is a set of programs fixed to the BIOS chip on the motherboard in the computing device. The main function of the BIOS is to provide the computing device with the most basic and direct hardware settings and controls.
[0066] The memory, also known as the internal memory or main memory, is installed in the memory slot on the motherboard of the computing device.
[0067] It should be noted that Figure 2 The structure shown in the above does not constitute a limitation on the computing device, and the computing device can include more or fewer components than those shown in the figure, or combine certain components, or different component arrangements. Figure 2 The computing device can include more or fewer components than those shown in the figure, or combine certain components, or different component arrangements.
[0068] The embodiments of the present application provide a model training method, as shown in the figure, which can include: Figure 3
[0069] S301, receiving a model training request sent by a first terminal device.
[0070] The model training request is used to instruct to train the target model.
[0071] In a possible implementation, the model training request includes initial model parameters of the target model. The first terminal device can send the model training request to the server, and the server receives the model training request sent by the first terminal device.
[0072] It should be understood that the model parameters refer to variables or constants used to describe characteristics and behaviors of a model. Different types of models have different model parameters, and the initial model parameters are not limited in the embodiments of the present application. For example, if the target model is a linear regression model, the initial model parameters can be intercept and slope. For another example, if the target model is a neural network model, the initial model parameters can be parameters and biases for connecting neurons, etc. For another example, if the target model is a logistic regression model, the initial model parameters can be node split features and leaf node categories, etc.
[0073] S302, in response to the model training request, assigning a target training environment and target training data for the target model.
[0074] The target training environment is used to train the target model, and the target training data is training data required for training the target model.
[0075] It should be understood that the target training environment refers to an environment having resources required for training the target model. The target training environment can be a virtual environment, such as a container, a virtual machine, etc. Alternatively, the target training environment can be a hardware device, such as a computing device.
[0076] In the embodiments of the present application, the model training request can further include an identifier of the target training environment and / or an identifier of the target training data. The server stores identifiers of multiple training environments and / or identifiers of training data.
[0077] For example, the identifier of the target training environment can be an Internet Protocol (Internet Protocol, IP) address, a virtual machine identifier, a container identifier, etc. The identifier of the training data can be a storage address of the training data. For another example, the identifier of the training data can be a uniform resource locator (uniform resource locator, URL). For another example, the identifier of the training data can be a number, such as "1", "2", "3", etc.
[0078] In a possible implementation, the model training request can include an identifier of the target training environment. The server can assign the target training environment and the target training data for the target model based on the identifier of the target training environment. The target training data is stored in the target training environment.
[0079] That is, the target training environment can be determined through the identification of the target training environment. Since the target training data is stored in the target training environment, the target model can be trained based on the target training data.
[0080] In a possible implementation, the model training request can include an identification of the target training data. The server can determine the target training data based on the identification of the target training data. Then, the server determines the target training environment storing the target training data based on the target training data. The server stores an identification of a training environment corresponding to each training data.
[0081] For example, training data 1 corresponds to training environment identification 1, and training data 2 corresponds to training environment identification 2.
[0082] It can be understood that, since the target training data is stored in the target training environment, and the target training environment can train the target model, the target training data will not be leaked when training the target model, thereby improving the privacy of the training data.
[0083] In the embodiments of the present application, the target training environment can be a training environment in the server. Alternatively, the target training environment can be another device other than the server.
[0084] That is, after the server receives the initial model parameters, the server can train the model, or the model can be trained in another device.
[0085] For example, the target training environment can be a container in the server. Alternatively, the target training environment can be another server storing the target training data, which is different from the server receiving the model training request. For example, the other server storing the target training data can be set by a user providing the target training data.
[0086] In a possible implementation, the target training environment is set by a user providing the target training data, and the second terminal device is a device uploading the target training data. The second terminal device can send, to the server, an identification of the target training environment and an identification of the target training data, the target training data being stored in the target training environment. Then, the server can store a correspondence between the identification of the target training data and the identification of the target training environment.
[0087] In this way, when the server obtains a request to train the model using the target training data, the model can be allocated to the target training environment for training. In this way, the training data can be prevented from being leaked.
[0088] In a possible implementation, when the target training environment is a device other than the server, the server can determine the target training environment based on the identifier of the target training environment and / or the identifier of the target training data, and send the initial model parameters to the target training environment.
[0089] S303. Training the target model based on the target training data in the target training environment to obtain a trained target model.
[0090] In a possible implementation, the model training request further includes a model training script, the model training script including an algorithm framework of the target model and training requirement information. The trained target model is obtained by running the model training script, deploying the target model based on the algorithm framework of the target model and the initial model parameters, and training the target model based on the training requirement information and the target training data.
[0091] That is, the model training script can be run in the target training environment to implement the training of the target model.
[0092] It should be understood that deploying the target model means loading the model parameters in the model parameter file into the algorithm framework. If the target model is successfully deployed, it means that the parameter file is correct and there is no training data. If the target model fails to be deployed, it means that the data in the parameter file is incorrect and there is training data.
[0093] In the embodiments of the present application, the training requirement information can include at least one of the following: training target (such as accuracy, recall rate), batch data size, data type of training data, training algorithm, iteration number, etc.
[0094] It should be noted that the training target is not limited in the embodiments of the present application. For example, the training target can be 80%, 85%, 88%, etc.
[0095] It should be understood that the data type of the training data corresponds to the algorithm framework. For example, when the algorithm framework is TensorFlow, the data type of the training data can be TFRecord type, NumPy array, or Python list. When the algorithm framework is PyTorch, the data type of the training data can be Tensor type or NumPy array. When the algorithm framework is Caffe, the data type of the training data can be LevelDB type or LMDB type.
[0096] It can be understood that the model training request includes the initial model parameters and the model training script. After running the model training script, the target model can be deployed based on the algorithm framework of the target model and the initial model parameters. Then, the target model can be trained based on the training requirement information and the target training data to obtain the trained target model. In this way, the target training environment does not need to be operated by the developer, and the training of the model is completed by running the model training script.
[0097] In some embodiments, in the case of the target training environment being other devices than the server, the initial model parameters and the model training script of the target model can be sent to the target training environment.
[0098] S304, sending the model parameter file of the trained target model to the first terminal device.
[0099] In some embodiments, after obtaining the trained target model, the server can send a model training completion message to the first terminal device. Then, the first terminal device can send a model acquisition request to the server, the model acquisition request being used to indicate to acquire the model parameter file. In response to the model acquisition request, the server can send the model parameter file of the trained target model to the first terminal device. The first terminal device can receive the model parameter file of the trained target model sent by the server.
[0100] Based on the above technical solutions, the model training request sent by the first terminal device can be received, the model training request being used to indicate to train the target model. Then, in response to the model training request, the target training environment and the target training data are allocated for the target model, and the target model is trained based on the target training data in the target training environment to obtain the trained target model. That is, the model can be trained by the target training environment allocated by the server without training the model on the terminal device. Then, the model parameter file of the trained target model is sent to the first terminal device. In this way, even if the terminal device does not have the condition to train the model, a trained model can be obtained. Moreover, only the model parameter file is sent, and the target training data is not included. In this way, the training data leakage can be avoided, and the privacy of the training data is improved.
[0101] In some embodiments, after obtaining the model parameter file of the trained target model, it can be detected whether the model parameter file includes the target training data.
[0102] The embodiments of the present application provide a model training method, as shown in Figure 4 Before S304, the model training method can further include:
[0103] S401, deploying the trained target model based on the model parameter file.
[0104] In the embodiment of the present application, when the target training environment is in other devices, after obtaining the model parameter file, the target training environment can send the model parameter file to the server. The server can receive the model parameter file sent by the target training environment.
[0105] In a possible implementation, the target training environment can run the model training script, and deploy the trained target model based on the algorithm framework of the target model and the model parameter file.
[0106] S402, determine whether the trained target model is successfully deployed.
[0107] It should be understood that the way of determining whether the trained target model is successfully deployed can refer to the method of determining whether the model is successfully deployed in the conventional technology, and the embodiments of the present application will not be described here.
[0108] In some embodiments, S403 can be performed in the case that the trained target model fails to be deployed. S404 can be performed in the case that the trained target model is successfully deployed.
[0109] S403, determine that the model parameter file contains target training data.
[0110] The data type of the target training data in the model parameter file is different from the data type of the model parameter.
[0111] For example, the data type of the model parameter can be a floating point type or a Boolean type, and the data type of the template training data can be an integer type.
[0112] It can be understood that in the case that the trained target model fails to be deployed, it indicates that the model parameter file contains target training data with a data type different from the data type of the model parameter. Therefore, it can be determined that the model parameter file contains target training data.
[0113] In the embodiment of the present application, in the case that it is determined that the model parameter file contains target training data, the model parameter file of the trained target model will not be sent to the first terminal device.
[0114] In this way, the target training data can be prevented from being leaked, thereby improving the privacy of the training data.
[0115] In some embodiments, in the case that the model parameter file contains target training data, the server can remove the target training data from the model parameter file, and send the model parameter file after removing the target training data to the first terminal device.
[0116] In a possible implementation, the server can identify the model parameters of the trained target training model and the target training data based on the data types of the data in the model parameter file. Then, the server can eliminate the target training data from the model parameter file to obtain the model parameter file after eliminating the target training data.
[0117] It can be understood that, in the case where the model parameter file contains the target training data, the server can obtain the model parameter file after eliminating the target training data by eliminating the target training data from the model parameter file. In this way, the server sends the model parameter file after eliminating the target training data to the first terminal device, which not only enables the terminal device to obtain the trained target model, but also avoids leakage of the target training data, thereby improving the privacy of the training data.
[0118] S404, determining that the target training data is not contained in the model parameter file.
[0119] In a possible implementation, in the case where the deployment of the trained target model is successful, the server can determine that the target training data is not contained in the model parameter file.
[0120] It can be understood that, in the case where the deployment of the trained target model is successful, it indicates that the model parameter file does not contain data of a data type different from that of the model parameters. Therefore, it can be determined that the target training data is not contained in the model parameter file.
[0121] In the embodiments of the present application, in the case where the target training data is not contained in the model parameter file, the server can send the model parameter file of the trained target model to the first terminal device.
[0122] That is, in the case where the target training data is not contained in the model parameter file, S304 can be performed.
[0123] In this way, by verifying the model parameter file and determining that the template training data is not contained in the model parameter file, the model parameter file of the trained target model can be sent to the first terminal device. In this way, the terminal device can obtain the trained model, and leakage of the training data can also be avoided.
[0124] In some embodiments, in the case where the deployment of the trained target model is successful, the server can determine whether the target training data is contained in the model parameter file based on the output accuracy of the trained target model. Specifically, the server can determine whether the target training data is contained in the model parameter file based on the output accuracy of the trained target model can include steps one to two.
[0125] Step one, the server determines the output accuracy of the trained target model based on the target training data.
[0126] The data type of the target training data in the model parameter file is the same as the data type of the model parameter.
[0127] It should be understood that the data type of the target training data is the same as the data type of the model parameter, which means that the initial data type of the target training data is the same as the data type of the model parameter. That is, the data type of the target training data is the same as the data type of the model parameter without data processing (such as data type conversion). Alternatively, the data type of the target training data is the same as the data type of the model parameter, which means that the converted data type of the target training data is the same as the data type of the model parameter. That is, the initial data type of the target training data is different from the data type of the model parameter, and the data type of the target training data is the same as the data type of the model parameter after data processing (such as data type conversion).
[0128] For example, the data type of the target training data and the data type of the model parameter are both multi-dimensional arrays. Alternatively, the initial data type of the target training data is TFRecord type, and the data type of the model parameter is multi-dimensional array. Then, the target training data of TFRecord type can be converted to target training data of multi-dimensional array type, so that the data type of the target training data is the same as the data type of the model parameter.
[0129] In one possible implementation, the server can input the target training data into the trained target model to obtain an output result. Then, the server compares the output result with the target training data to obtain the output accuracy.
[0130] Step two, the server determines whether the target training data is included in the model parameter file based on the output accuracy.
[0131] In one possible implementation, when the output accuracy is greater than or equal to a preset accuracy threshold, the server determines that the target training data is not included in the model parameter file.
[0132] It should be noted that the preset accuracy threshold is greater than or equal to the training target in the training requirement information. For example, the training target is 80%, and the preset accuracy threshold is 80%, 81%, 85%, etc.
[0133] It should be understood that when the target training data is not included in the model parameter file, it means that the model parameter has not changed, and the output accuracy of the trained target model is high. Therefore, when the output accuracy is greater than or equal to the preset accuracy threshold, it can be determined that the target training data is not included in the model parameter file.
[0134] In another possible implementation, the server determines that the target training data is not contained in the model parameter file in a case where the output accuracy is less than a preset accuracy threshold.
[0135] For example, assuming that the preset accuracy threshold is 80%. If the output accuracy is 60%, it is determined that the target training data is contained in the model parameter file. If the output accuracy is 90%, it is determined that the target training data is not contained in the model parameter file.
[0136] It can be understood that, in a case where the target training data is contained in the model parameter file, it indicates that the model parameters are changed, and thus the output accuracy of the trained target model is affected. Therefore, in a case where the output accuracy is less than the preset accuracy threshold, it can be determined that the target training data is not contained in the model parameter file.
[0137] In some embodiments, before receiving the model training request sent by the first terminal device, the first terminal device can query the identifier of the target training data and / or the identifier of the target training environment from the server.
[0138] The embodiments of the present application provide a model training method, as shown in FIG. 3, the model training method can further include the following steps before S301: Figure 5
[0139] S501, receiving a query request message sent by a first terminal device.
[0140] The query request message is used to indicate the query of the target training data matched with the keyword. The query request message includes the keyword, and the keyword is used to represent the data content and / or data type of the data to be queried.
[0141] S502, in response to the query request message, determining the identifier of the target training data matched with the keyword from a database based on the keyword.
[0142] The database stores the meta information of a plurality of preset training data.
[0143] In the embodiments of the present application, the server stores the meta information of each training data, and the meta information can include at least one of the following: data sample, quality information, data size, data format, data type, and data related description information. The data sample is used to display in the page of the terminal device, and the quality information is used to indicate the data quality of the training data.
[0144] For example, if the terminal device a uploads a set of training data a, the training data a includes: training data 1-training data 10. Among them, the data sample can be training data 1 and training data 2, the quality information can be 2, the data type of the training data a is Tensor type, and the data related description information is "the training data is used for the automatic driving scene".
[0145] S503, sending the identification of the target training data and / or the identification of the target training environment to the first terminal device.
[0146] The identification of the target training environment is determined based on the identification of the target training data.
[0147] In a possible implementation, after the identification of the target training data is queried, the server can send the identification of the target training data to the first terminal device.
[0148] In another possible implementation, after the identification of the target training data is queried, the server can determine the identification of the target training environment based on the identification of the target training data. The server stores the correspondence between each training data and the training environment for storing each training data. Then, the identification of the target training data and / or the identification of the target training environment can be sent to the first terminal device.
[0149] It can be understood that after receiving the query request message sent by the first terminal device, the target training data matching the meta information and the keyword can be determined from the database, and then the identification of the target training data and / or the identification of the target training environment can be sent to the first terminal device. In this way, the user can select appropriate training data before training the model. Then, the identification of the target training data and / or the identification of the target training environment can be sent to the terminal, so that the terminal device can use the training data expected to be used by the user to train the model, thereby improving the performance of the trained model.
[0150] In some embodiments, before the server trains the model using the training data, the server can obtain the training data and / or the meta information of the training data from the terminal device.
[0151] In the embodiments of the present application, the second terminal device can send the target training data to the server. Then, the server can receive the target training data uploaded by the second terminal device. Then, the server stores the target training data and / or the meta information of the target training data.
[0152] It should be understood that the sending of the target training data to the server mentioned in the present application refers to the sending of the data itself or the sending of the meta information of the data. That is, the server can store the target training data itself, or store the meta information of the target training data, or store the target training data itself and the meta information.
[0153] Optionally, in the case where the server stores the meta information of the target training data, the second terminal device can send an identifier of a target training environment to the server, the target training environment storing the target training data.
[0154] That is, the server can provide the meta information of the training data and the training environment storing the training data, assign the model to the training environment by the server, and train using the training data.
[0155] It can be understood that by storing the target training data or the meta information, the server can facilitate the sharing of the training data. In the case where the meta information of the target training data is stored and the data itself is not stored, the privacy of the training data can be improved.
[0156] In some embodiments, after the terminal device provides the training data and / or the meta information to the server, the server can share the training data provided by the terminal device. Moreover, the server can record the sharing information of the training data and reward the user who provides the training data.
[0157] In some embodiments, the server can obtain a usage frequency of the target training data, where the usage frequency is the number of times of training the model using the training data. Then, the server can determine a target reward resource based on the usage frequency of the target training data. Then, the server can send the target reward resource to the second terminal device.
[0158] In a possible implementation, the target reward resource can be determined based on the usage frequency of the target training data and a single-time usage reward.
[0159] It should be understood that the single-time usage reward can be set by the data provider. Alternatively, the single-time usage reward can be determined by the server based on the meta information of the target training data. The embodiments of the present application do not limit this.
[0160] It can be understood that after obtaining the usage frequency of the target training data, the target reward resource can be determined based on the usage frequency of the target training data. Then, the target reward resource can be sent to the second terminal device. In this way, positive feedback can be realized for the data provider, thereby improving the enthusiasm of providing data.
[0161] The above describes the scheme provided by the embodiments of the present application from the perspective of the server. It can be understood that the computing device comprises hardware structures and / or software modules corresponding to each function to implement the above functions. Those skilled in the art should easily realize that the training method steps of each example described in combination with the embodiments disclosed in the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in hardware or software driven by hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0162] The embodiments of the present application can divide the function modules or function units of the model training apparatus according to the above method examples. For example, each function module or function unit can be divided according to each function, or two or more functions can be integrated in one processing module. The above integrated module can be implemented in the form of hardware or software function module or function unit. The division of modules or units in the embodiments of the present application is illustrative, and is only a logical function division. Actual implementation can have another division manner.
[0163] Please refer to Figure 6 which shows a schematic diagram of a model training apparatus provided by the embodiments of the present application. The model training apparatus can be a function module in the computing device for implementing the method of the embodiments of the present application. As Figure 6 shown, the model training apparatus can comprise a receiving module 601, a processing module 602 and a sending module 603.
[0164] The receiving module 601 is configured to receive a model training request sent by a first terminal device, the model training request being configured to instruct to train a target model. The processing module 602 is configured to, in response to the model training request, allocate a target training environment and target training data for the target model. The processing module 602 is configured to train the target model based on the target training data in the target training environment to obtain a trained target model. The sending module 603 is configured to send a model parameter file of the trained target model to the first terminal device.
[0165] In a possible implementation, the processing module 602 is further configured to detect whether the model parameter file contains the target training data. The sending module 603 is further configured to send the model parameter file of the trained target model in a case where the model parameter file does not contain the target training data.
[0166] In another possible implementation, the processing module 602 is further configured to, in a case where the model parameter file contains the target training data, eliminate the target training data from the model parameter file. The sending module 603 is further configured to send, to the first terminal device, the model parameter file from which the target training data is eliminated.
[0167] In another possible implementation, the model training request comprises an identifier of the target training environment and / or an identifier of the target training data. The target training data is stored in the target training environment.
[0168] In another possible implementation, the processing module 602 is further configured to, based on the model parameter file, deploy the trained target model. The processing module 602 is further configured to, in a case where the deployment of the trained target model is successful, determine that the target training data is not contained in the model parameter file. The processing module 602 is further configured to, in a case where the deployment of the trained target model fails, determine that the target training data is contained in the model parameter file, where the data type of the target training data in the model parameter file is different from the data type of the model parameter.
[0169] In another possible implementation, the processing module 602 is further configured to, in a case where the deployment of the trained target model is successful, determine an output accuracy of the trained target model based on the target training data, where the data type of the target training data in the model parameter file is the same as the data type of the model parameter. The processing module 602 is further configured to, in a case where the output accuracy is greater than or equal to a preset accuracy threshold, determine that the target training data is not contained in the model parameter file.
[0170] In another possible implementation, the model training request further comprises initial model parameters of the target model and a model training script. The model training script comprises an algorithm framework of the target model and training requirement information. The trained target model is obtained by: running the model training script, deploying the target model based on the algorithm framework of the target model and the initial model parameters, and training the target model based on the training requirement information and the target training data to obtain the trained target model.
[0171] In another possible implementation, the receiving module 601 is further configured to receive a query request message sent by the first terminal device, the query request message being used to indicate a query of the target training data matching the keyword. The processing module 602 is further configured to, in response to the query request message, determine, based on the keyword, an identifier of the target training data matching the keyword from a database in which meta information of a plurality of preset training data is stored. The sending module 603 is further configured to send, to the first terminal device, the identifier of the target training data and / or an identifier of a target training environment, the identifier of the target training environment being determined based on the identifier of the target training data.
[0172] In another possible implementation, the receiving module 601 is further configured to receive target training data uploaded by the second terminal device. The processing module 602 is further configured to store the target training data and / or the metadata of the target training data.
[0173] In another possible implementation, processing module 602 is further configured to obtain the number of times the target training data has been used. Processing module 602 is also configured to determine the target reward resource based on the number of times the target training data has been used. Sending module 603 is further configured to send the target reward resource to the second terminal device.
[0174] Other embodiments of this application provide a computing device. The computing device may include a memory and one or more processors. The memory and processors are coupled. The memory stores computer program code, including computer instructions. When the processor executes the computer instructions, the computing device can perform the various functions or steps described in the above method embodiments.
[0175] This application also provides a chip system, such as... Figure 7 As shown, the chip system includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 are interconnected via lines. For example, the interface circuit 702 can be used to receive signals from other devices (e.g., the memory of a computing device). As another example, the interface circuit 702 can be used to send signals to other devices (e.g., the processor 701). Exemplarily, the interface circuit 702 can read instructions stored in memory and send those instructions to the processor 701. When the instructions are executed by the processor 701, the computing device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete components, which are not specifically limited in this application embodiment.
[0176] This application also provides a computer-readable storage medium including computer instructions that, when executed on the aforementioned computing device, cause the computing device to perform various functions or steps described in the method embodiments.
[0177] This application also provides a computer program product that, when run on a computer, causes the computer to perform the functions or steps described in the above method embodiments.
[0178] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is exemplified, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0179] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0180] The units described as separate components can or can not be physically separated, and the components shown as units can be one physical unit or multiple physical units, that is, they can be located in one place or distributed to multiple different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0181] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0182] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application essentially or the parts that make contributions to the prior art or all or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions to make a device (which can be a single-chip microcomputer, a chip, etc.) or a processor execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium that can store program codes.
[0183] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any change or replacement within the technical scope disclosed by the present application should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for training a model, characterized in that, Applied to servers, including: Receive a model training request sent by a first terminal device, the model training request being used to instruct the target model to be trained; In response to the model training request, a target training environment and target training data are allocated to the target model; The target model is trained based on the target training data in the target training environment to obtain the trained target model; The trained target model parameter file is sent to the first terminal device.
2. The method according to claim 1, characterized in that, Sending the trained target model parameter file to the first terminal device includes: Detect whether the model parameter file contains the target training data; If the model parameter file does not contain the target training data, the trained model parameter file of the target model is sent to the first terminal device.
3. The method according to claim 2, characterized in that, The method further includes: If the model parameter file contains the target training data, the target training data is removed from the model parameter file, and the model parameter file after removing the target training data is sent to the first terminal device.
4. The method according to claim 2, characterized in that, The detection of whether the model parameter file contains target training data includes: Based on the model parameter file, deploy the trained target model; If the target model is successfully deployed after training, it is determined that the target training data is not contained in the model parameter file; If the deployment of the target model fails after training, it is determined that the model parameter file contains the target training data, wherein the data type of the target training data in the model parameter file is different from the data type of the model parameters.
5. The method according to claim 4, characterized in that, If the target model is successfully deployed after training, determining that the model parameter file does not contain the target training data includes: If the target model is successfully deployed after training, the output accuracy of the target model after training is determined based on the target training data, wherein the data type of the target training data in the model parameter file is the same as the data type of the model parameters; If the output accuracy is greater than or equal to a preset accuracy threshold, it is determined that the target training data is not contained in the model parameter file.
6. The method according to any one of claims 1-5, characterized in that, The model training request includes: the initial model parameters and model training script of the target model, wherein the model training script includes: the algorithm framework and training requirement information of the target model; the trained target model is obtained through the following training methods: Run the model training script to deploy the target model based on the algorithm framework of the target model and the initial model parameters; The target model is trained based on the training requirements information and the target training data to obtain the trained target model.
7. The method according to claim 1, characterized in that, The target training environment is set up by the user who provides the target training data.
8. The method according to claim 1, characterized in that, The model training request also includes: the identifier of the target training environment and / or the identifier of the target training data; The target training environment stores the target training data.
9. The method according to claim 1 or 8, characterized in that, Before receiving the model training request sent by the first terminal device, the method further includes: Receive a query request message sent by the first terminal device, the query request message being used to indicate the query for the target training data that matches the keywords; In response to the query request message, the identifier of the target training data that matches the keyword is determined from the database, and the database stores metadata of multiple preset training data. The identifier of the target training data and / or the identifier of the target training environment are sent to the first terminal device, wherein the identifier of the target training environment is determined based on the identifier of the target training data.
10. The method according to any one of claims 1-5, characterized in that, Before receiving the model training request sent by the first terminal device, the method further includes: Receive the target training data uploaded by the second terminal device; Store the target training data and / or the metadata of the target training data.
11. A method for training a model, characterized in that, Applied to terminal devices, including: Send a model training request to the server, the model training request being used to instruct the target model to be trained; Receive the model parameter file of the trained target model sent by the server; The target model after training is obtained by training in the target training environment using target training data.
12. A computing device, characterized in that, The computing device includes a memory and a processor; the memory and the processor are electrically connected; the memory is used to store program instructions, and the processor is used to execute the program instructions to enable the computing device to implement the method as described in any one of claims 1-11.