Multi-model training method based on grpc framework
Through the multi-model training method based on the grpc framework, using configuration files to define training plans and built-in models, the cross-machine and cross-language calling of deep learning models is realized, solving the problems of difficult operation and complex integration for non-professionals, and reducing costs. And improve the flexibility and efficiency of training.
Patent Information
- Application Number
- CN202410712203.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-08-30
AI Technical Summary
Existing deep learning model training methods are difficult for non-professionals to operate, the software integration process is complex, and they cannot effectively support cross-machine remote training and cross-language invocation.
Using a multi-model training method based on the grpc framework, the training plan is defined through the configuration file, the server has a built-in model, and the client transmits information for model training. It supports single-channel and multi-channel modes, and realizes cross-machine calling and cross-language support.
It reduces the operational difficulty and integration costs for non-professionals, supports cross-machine remote training and cross-language calling, and improves the flexibility and efficiency of model training.
Smart Images

Figure CN118569407A
Abstract
Description
Technical Field
[0001] The present invention relates to the field related to deep learning model training, specifically to a multi-model training method based on the grpc framework, mainly involving a model training scheme based on the grpc framework, which can realize basic training needs, support cross-machine remote training through a local area network, and support cross-language calls. Background Art
[0002] With the continuous development of deep learning technology, the demand for model training is increasing. By integrating model training into the form of specific solutions, the operation difficulty for non-professionals can be reduced.
[0003] Common training methods include direct code level or integrated software. The former requires professional personnel to operate, and although the latter reduces the difficulty of operation for non-professional personnel, the process of integrating software is more cumbersome. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a multi-model training method based on the grpc framework. The grpc framework builds a configuration file, builds a related model on the server, and calls the server model to complete the training task by passing information such as pictures on the client. This technology can quickly implement the model training task and supports cross-machine calls, while reducing the difficulty of operation for non-professionals.
[0005] To achieve the above object, the present invention provides the following technical solutions: The multi-model training method based on the grpc framework includes the following steps: Step S1: preprocessing stage, defining relevant default configuration information; Step S2: executing different training schemes according to the client's request, including single-channel and multi-channel methods; Step S3: The server starts the model training service and prints relevant information. The client calls the corresponding model training solution through the grpc service to pass the image information and waits for the response from the server.
[0006] As a further solution of the present invention, in step S1, the configuration information includes global configuration and model repository, wherein the global configuration includes IP address, port number, single / multi-channel interface, and number of threads.
[0007] As a further solution of the present invention, in step S2, the single-channel mode represents that the server only receives one training scheme and only trains one model, and the multi-channel mode represents that the server receives multiple training schemes and can train multiple models synchronously.
[0008] As a further solution of the present invention, the single channel mode is set as follows: Configure the training scheme of all models on the server in advance, turn on the single-channel interface in the global configuration item in the configuration file, which means that the server turns on the single-channel mode. After the server is turned on, relevant information will be printed; the client transmits data according to the interface preset in the configuration file; if the client calls and transmits incorrect interface information, the relevant error will be displayed. After the client successfully calls the server, the server will perform the model training operation, save the model and log information locally after the training, and return relevant information to the client.
[0009] As a further solution of the present invention, the multi-channel mode is set as follows: Configure the training schemes for all models on the server in advance, and turn on the multi-channel interface in the global configuration item in the configuration file. This means that the server turns on the multi-channel mode, and relevant information will be printed after the server is turned on. The client transmits data according to the interface pre-set in the configuration file; if the client calls and transmits incorrect interface information, the relevant errors of the current model to be trained will be displayed; after the client successfully calls the server, the server will perform model training operations, save the model and log information locally after the training is completed, and return relevant information to the client.
[0010] The present invention has the following beneficial effects: The present invention adopts a multi-model deployment method based on the grpc framework, and can complete the model training task by pre-defining the training scheme and configuration file. Through different configuration files, the client is supported to call multiple models to complete different training tasks. This deployment method reduces the operation difficulty and certain integration costs for non-professionals. This deployment method supports cross-language calls and increases flexibility.
[0011] The present invention aims at the problems that the existing training scheme is difficult for non-professionals to operate and the integration is complex. The present invention proposes a multi-model training scheme based on the grpc framework to effectively solve the problem. The scheme defines multiple model training schemes by pre-setting the configuration file form, and supports both single-channel and multi-channel modes. The server loads the defined IP address and port number and other information. After the service is successfully started, the current information, such as single / multi-channel mode, supported model training schemes, etc., will be printed. The client transmits data according to the interface pre-set by the configuration file, such as the training data file (converted to Bytes array form) or the local path where the data is located, the number of rounds used for training, the batch size used for training, the saving path of the training model, etc., and sends a request to the server for calling, and waits for receiving the response sent by the server after the call is successful. The scheme completes the training task of the model by means of the configuration file interface, reducing the operation difficulty and certain integration cost of non-professionals.
[0012] In order to more clearly illustrate the structural features and effects of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a configuration file sample mentioned in the embodiment of the present invention.
[0014] Figure 2 This is an overview diagram of the grpc framework call mentioned in the embodiment of the present invention.
[0015] Figure 3 This is an overview diagram of model calls within the grpc framework server mentioned in an embodiment of the present invention.
[0016] Figure 4 This is a single channel mode calling flow chart mentioned in an embodiment of the present invention.
[0017] Figure 5 This is a multi-channel mode calling flow chart mentioned in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention will be further explained below in conjunction with the accompanying drawings and related knowledge, and described clearly and completely. Obviously, the described application is only a part of the embodiments of the present invention, rather than all the embodiments.
[0019] Reference Figure 1-Figure 5 As shown, the present invention provides a multi-model training method based on the grpc framework, comprising the following steps: Step S1: In the preprocessing stage, define relevant default configuration information; specifically, in the preprocessing stage, define relevant default configuration information including IP address, port number, preloaded model weight file, batch size, etc.
[0020] Step S2: Execute different training schemes according to the client's request, including single-channel and multi-channel modes; that is, the training scheme of the present invention supports both single-channel and multi-channel modes. The single-channel mode means that the server only receives one training scheme and trains only one model. The multi-channel mode means that the server receives multiple training schemes and can train multiple models simultaneously.
[0021] Reference Figure 3 As shown, different training plans are executed according to the client's request. If the transmitted information does not match the configuration file, an error message is returned and a prompt is displayed on the client.
[0022] Step S3: The server starts the model training service and prints relevant information. The client calls the corresponding model training solution by passing information such as images through the grpc service and waits for the response from the server.
[0023] The present invention takes multiple models as an example, configures all supported model training schemes in the form of configuration files, and builds in the model training source code required for all types of models on the server. For example, if the current project needs to train a detection model, the server will call the detection model training code; if the current project needs to train a segmentation model, the server will call the segmentation model training code. The client transmits relevant data or data path information according to specific needs. The client will receive the relevant information transmitted by the server. This method can simplify model training, while meeting most needs, reducing the difficulty and cost of training.
[0024] Reference Figure 1 As shown, define the current model training default configuration file, including global configurations such as IP address, port number, single / multi-channel interface, and model warehouse (model type, model weight path, training data, number of training rounds, etc.). According to the actual training needs, the model training scheme can be divided into two modes: single-channel and multi-channel. Start the server and wait for the client to send a request and call: Reference Figure 4 As shown, the settings for single channel mode are as follows: Pre-configure the training schemes for all models on the server, and turn on the single-channel interface in the global configuration item in the configuration file. This means that the server turns on the single-channel mode. After the server is turned on, relevant information will be printed, such as the single-channel mode, supported model training schemes, etc. The client transfers data according to the interface pre-set in the configuration file, such as the training data file (converted to Bytes array form) or the local path where the data is located, the number of rounds used for training, the batch size used for training, the path where the training model is saved, and other values. If the client calls and passes the wrong interface information, the relevant error will be displayed. After the client successfully calls the server, the server will perform the model training operation, save the model and log information locally after the training is completed, and return relevant information to the client, such as the training time, precision, recall, model parameter size, and model save path.
[0025] The advantage of the single-channel mode is that when there are fewer training tasks, such as only a single training task needs to be processed, hardware resources can be fully utilized to quickly achieve the purpose of model training. Its disadvantage is that if there are more training tasks, only a single training task can be performed each time, which has certain shortcomings and room for improvement in terms of efficiency.
[0026] Reference Figure 5 As shown, the settings for multi-channel mode are as follows: The configuration of multi-channel mode is similar to that of single-channel mode. Pre-configure the training schemes for all models on the server. Enable the multi-channel interface in the global configuration item in the configuration file. This means that the server has enabled the multi-channel mode. After enabling the server, relevant information will be printed, such as the multi-channel mode and supported model training schemes.
[0027] The client also transmits data according to the interface pre-set in the configuration file, such as the training data file (converted to Bytes array form) or the local path where the data is located, the number of rounds used for training, the batch size used for training, the path where the training model is saved, etc. Unlike the single-channel mode, the client needs to pass the data information of each model to be trained in sequence in the multi-channel mode. If the client calls and passes the wrong interface information, the relevant errors of the current model to be trained will be displayed. After the client successfully calls the server, the server will perform the model training operation, and save the model and log information locally after the training is completed, and return relevant information to the client, such as the training time, precision, recall, model parameter size, and model save path.
[0028] The advantage of the multi-channel mode is that it can perform multiple training tasks at the same time, improving efficiency to a certain extent. The disadvantage is that it requires training multiple models at the same time, which increases the equipment burden and cost to a certain extent.
[0029] In summary, in view of the problems that existing training schemes are difficult for non-professionals to operate and complex to integrate, the present invention proposes a multi-model training scheme based on the grpc framework to effectively solve the problem. The scheme defines multiple model training schemes by pre-setting the configuration file form, and supports both single-channel and multi-channel modes. The server loads the defined ip address and port number and other information. After the service is successfully started, the current information, such as single / multi-channel mode, supported model training schemes, etc., will be printed. The client transmits data according to the interface pre-set by the configuration file, such as the training data file (converted to Bytes array form) or the local path where the data is located, the number of rounds used for training, the batch size used for training, the saving path of the training model, etc., and sends a request to the server for calling, and waits for the response sent by the server after the call is successful. The scheme completes the training task of the model by means of the configuration file interface, reducing the difficulty of operation for non-professionals and a certain integration cost.
[0030] The technical principle of the present invention is described above in combination with the specific embodiments, which are only preferred implementations of the present invention. The protection scope of the present invention is not limited to the above embodiments, and all technical solutions under the idea of the present invention belong to the protection scope of the present invention. Those skilled in the art can think of other specific implementations of the present invention without creative work, and these methods will fall within the protection scope of the present invention.
Claims
1. A multi-model training method based on the grpc framework, characterized in that: The following steps are involved: Step S1: preprocessing stage, defining relevant default configuration information; Step S2: executing different training schemes according to the client's request, including single-channel and multi-channel methods; Step S3: The server starts the model training service and prints relevant information. The client calls the corresponding model training solution through the grpc service to pass the image information and waits for the response from the server.
2. The multi-model training method based on the grpc framework as claimed in claim 1, characterized in that In step S1, the configuration information includes global configuration and model repository, wherein the global configuration includes IP address, port number, single / multi-channel interface, and number of threads.
3. The multi-model training method based on the grpc framework as claimed in claim 2, characterized in that In step S2, the single-channel mode means that the server only receives one training scheme and trains only one model, and the multi-channel mode means that the server receives multiple training schemes and can train multiple models simultaneously.
4. The multi-model training method based on the grpc framework as claimed in claim 3, characterized in that The settings for single channel mode are as follows: Pre-configure the training schemes for all models on the server, and turn on the single-channel interface in the global configuration item in the configuration file. This means that the server turns on the single-channel mode, and relevant information will be printed after the server is turned on. The client transmits data according to the interface pre-set in the configuration file. If the client calls and passes incorrect interface information, the relevant error will be displayed. After the client successfully calls the server, the server will perform model training operations, save the model and log information locally after the training is completed, and return relevant information to the client.
5. The multi-model training method based on the grpc framework as claimed in claim 4, characterized in that The settings for multi-channel mode are as follows: Configure the training schemes for all models on the server in advance, and turn on the multi-channel interface in the global configuration item in the configuration file. This means that the server turns on the multi-channel mode, and relevant information will be printed after the server is turned on. The client transmits data according to the interface preset in the configuration file; If the client calls and passes incorrect interface information, the relevant errors of the current model to be trained will be displayed; After the client successfully calls the server, the server will perform model training operations, save the model and log information locally after training, and return relevant information to the client.
Citation Information
Patent Citations
Service processing method and device, computer equipment and storage medium
CN113448730A
Cluster-based model training method, system and device, medium and product
CN115525413A
Efficient multi-model selection and deployment method based on grpc
CN116185668A
Big model training and task processing method and device based on federated learning
CN117350411A
Method for Detecting Epileptic Spike, Method for Training Network Model, and Computer Device
US20210358611A1
