Model training method and device, computer equipment and storage medium

By selecting backup computing nodes according to the number of iterations during model training for model state storage and recovery, the problem of low training efficiency in checkpoint technology is solved, and rapid recovery of model state and efficient training are achieved.

CN118796547APending Publication Date: 2024-10-18CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311780670.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing checkpoint technology has problems of time consumption and training waste in model training. Setting the checkpoint period too short or too long will affect the training efficiency, and the computing nodes need to perform calculations and store model state parameters at the same time, which increases equipment costs. and affect training efficiency.

Method used

During the model training process, after each iteration is completed, backup computing nodes are selected according to the number of iterations to store and restore model status information. Multiple backup computing nodes are used to alternately store model status information to ensure that the latest data can be quickly restored when training is interrupted. Iteration parameters.

Benefits of technology

Through the alternate storage and recovery mechanism of multiple backup computing nodes, continuous backup and rapid recovery of model status are achieved, which avoids waste of training time, improves model training efficiency, and reduces equipment costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796547A_ABST
    Figure CN118796547A_ABST
Patent Text Reader

Abstract

The invention provides a model training method and device, computer equipment and a storage medium, and the training method comprises the steps: selecting a backup calculation node according to the number of current iterations in a model training process after each iteration completes the updating of a model state, and storing the current model state information to the backup calculation node; when model training is interrupted, obtaining the number of times of last iteration before interruption; obtaining model state information from the corresponding backup computing node according to the number of times of the last iteration; and carrying out continuous training according to the obtained model state information. According to the method, the backup computing node is set to store the intermediate state of each time of model training, so that continuous backup of the model state on the premise of not influencing the training task is realized, and when the training process is abnormally interrupted, the latest iterated parameter recovery can be realized, so that the model training time is saved, and the model training efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of machine learning technology, and in particular to a model training method, apparatus, computer equipment, and storage medium. Background Art

[0002] With the continuous development of computing power and data, the scale of artificial intelligence models continues to increase, and the time required for model training is also increasing. During the long model training process, the training may be interrupted due to the long-term high-speed operation of hardware equipment or other unexpected reasons. In order to avoid wasting time on the completed model training, checkpoint technology came into being. Checkpoint technology is to store the intermediate results of the model regularly so that you can restore to the checkpoint and continue training when needed.

[0003] However, the existing continuous training methods have the following problems: (1) Conventional checkpoint technology is time-consuming and wastes training time. If the checkpoint period is set too short, frequent saving of model status will prolong the model training time and reduce the training speed; if the checkpoint period is set too long, a lot of completed training time will be wasted when resuming training. (2) The backup storage of checkpoint files is often completed by the computing nodes involved in the model training task. The computing nodes not only need to perform computing work, but also need to store huge model status parameters, which not only increases the equipment configuration cost of the computing nodes, but also affects the execution efficiency of the training task. Summary of the invention

[0004] Based on the technical problems raised in the background technology, the present invention provides a model training method, apparatus, computer equipment and storage medium.

[0005] In a first aspect, the present invention provides a model training method, comprising the following steps:

[0006] During the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node;

[0007] When model training is interrupted, get the number of the most recent iteration before the interruption;

[0008] According to the number of the most recent iteration, obtaining model state information from the corresponding backup computing node;

[0009] Continue training based on the obtained model status information.

[0010] Furthermore, in the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current iteration number, and the current model state information is stored in the backup computing node, including:

[0011] During the model training process, after each iteration completes the model state update, if the current iteration number is an odd number, the current model state information is stored in the first backup computing node;

[0012] If the current number of iterations is an even number, the current model state information is stored in the second backup computing node.

[0013] Furthermore, the acquiring model status information from the corresponding backup computing node according to the number of the most recent iteration includes:

[0014] If the number of the most recent iteration is an odd number, obtaining model state information from the first backup computing node;

[0015] If the number of the most recent iteration is an even number, the model state information is obtained from the second backup computing node.

[0016] Furthermore, in the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current iteration number, and the current model state information is stored in the backup computing node, including:

[0017] During the model training process, after each iteration completes the model status update, the current iteration number i is divided by the total number of backup computing nodes n to obtain the remainder x;

[0018] If x=0, the model state information after the current i-th iteration is completed is stored in the n-th backup computing node;

[0019] If x≠0, the model state information after the current i-th iteration is completed is stored in the x-th backup computing node;

[0020] Wherein, n is greater than 2.

[0021] Furthermore, the acquiring model status information from the corresponding backup computing node according to the number of the most recent iteration includes:

[0022] Divide the number of the most recent iteration j by the total number of backup computing nodes n to obtain a remainder y;

[0023] If y=0, obtain the model status information from the nth backup computing node;

[0024] If y≠0, the model status information is obtained from the yth backup computing node.

[0025] Further, the model state information is stored in the video memory of the computing unit in the backup computing node;

[0026] After the backup computing node executes the storage of the model state information after the kth iteration, in the first idle state, the backup computing node first unloads the model state information after the kth iteration from the video memory to the internal memory, and in subsequent idle state cycles, gradually unloads the model state information from the internal memory to the permanent storage space;

[0027] Wherein, k is a specified iteration number threshold; the idle state is the period from when the backup computing node completes one execution of model state information storage to when it executes the next execution of model state information storage.

[0028] Furthermore, the model training method also includes:

[0029] When it is necessary to return to the kth iteration, the model state information after the kth iteration is obtained from the permanent storage space, and the training is continued by returning to the kth iteration.

[0030] Furthermore, the continuous training according to the acquired model state information includes:

[0031] By using a broadcasting method, multiple computing nodes that execute model training can synchronously load the acquired model status information for continuous training.

[0032] In a second aspect, the present invention further provides a model training device, comprising:

[0033] A model state backup module is used to select a backup computing node according to the current number of iterations after each iteration of the model state update is completed during the model training process, and store the current model state information in the backup computing node;

[0034] The target iteration acquisition module is used to obtain the number of the most recent iteration before the interruption when the model training is interrupted;

[0035] A target model state acquisition module, used to acquire model state information from a corresponding backup computing node according to the number of the most recent iteration;

[0036] The model training recovery module is used to perform continuous training based on the acquired model status information.

[0037] In a third aspect, the present invention also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the model training method as described in the first aspect when executing the computer program.

[0038] In a fourth aspect, the present invention further provides a computer-readable storage medium, which stores a computer program, and when the computer program is running, controls the device where the computer-readable storage medium is located to execute the model training method as described in the first aspect.

[0039] In the process of model training, after each iteration completes the model state update, the present invention selects a backup computing node according to the current number of iterations, and stores the current model state information in the backup computing node; when the model training is interrupted, the number of the most recent iteration before the interruption is obtained; then the model state information is obtained from the corresponding backup computing node according to the number of the most recent iteration; and training is continued according to the obtained model state information. The present invention saves the intermediate state of each model training by setting a backup computing node, thereby realizing continuous backup of the model state without affecting the training task, so that when the training process is abnormally interrupted, it can be restored with the parameters of the latest iteration, thereby saving model training time and improving model training efficiency.

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A flowchart of the steps of a model training method provided in an exemplary embodiment;

[0042] Figure 2 A schematic diagram of a module of a model training device provided in an exemplary embodiment;

[0043] Figure 3 An internal structural diagram of a computer device configured as a server provided in an exemplary embodiment;

[0044] Figure 4 The figure is a diagram of the internal structure of a computer device configured as a terminal provided in an exemplary embodiment. DETAILED DESCRIPTION

[0045] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0046] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present application.

[0047] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0048] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.

[0049] In addition, in the description of this application, unless otherwise specified, "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0050] Based on the background technology content, the embodiment of the present application provides a model training method, such as Figure 1 As shown, the method comprises the following steps:

[0051] S201: During the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node.

[0052] Specifically, a computing node refers to a physical or virtual computing device that performs computing tasks in a model training task. Each computing node usually has its own computing resources, including but not limited to video memory, internal memory, etc., and can independently perform computing tasks. In an embodiment of the present application, a backup computing node is configured as a computing node that partially participates in model training. The backup computing node also includes computing resources, but the backup computing node only participates in the model state update process, and does not participate in the forward and backward computing process. That is, each backup computing node is equivalent to adding a data parallel in the model training process, but is relatively independent of the training task and is only used to back up model state information.

[0053] During the model training process, the current model state will be updated when each model iteration training is completed, wherein the model state includes but is not limited to model parameters and optimizer parameters. That is, in an embodiment of the present application, the backup period of the checkpoint file is set to the completion of each model iteration training, so as to continuously back up the model state information of the intermediate model generated during the entire model training process. After each model state update, the backup computing node obtains the current model state information and generates the latest file for backup storage. Among them, the latest file represents the latest model parameter file saved during the model training process. In response to the update of the model state parameters during the iterative training process, the latest file content in the backup computing node will also be updated accordingly. That is, when the backup computing node stores the current model state parameters by generating the latest file, it will overwrite the model state parameters previously stored in the latest file.

[0054] Furthermore, the backup computing node also obtains the current number of iterative training times and writes the number of iterative training times into the latest file for storage. That is, the latest file includes the latest model state information stored by the backup computing node and the number of iterative training times corresponding to the model state information.

[0055] S202: When model training is interrupted, obtain the number of the most recent iteration before the interruption.

[0056] Specifically, the number of the most recent iteration before the interruption is the number of iterations after the most recent completion of the model state parameter update.

[0057] In a specific example, if the current training process is abnormally interrupted during the 500th iteration training, but the model parameter update of the 500th iteration training has not been completed at this time, the number of the most recent iteration before the interruption is 499; if the current training process is abnormally interrupted during the 500th iteration training, and the model parameter update of the 500th iteration training has been completed at this time, the number of the most recent iteration before the interruption is 500.

[0058] S203: Acquire model status information from the corresponding backup computing node according to the number of the most recent iteration.

[0059] Specifically, the number of the most recent iteration is taken as the target number of iterations, and the latest file containing the record of the target number of iterations is obtained, that is, the model state information is obtained from the backup computing node corresponding to the latest file.

[0060] S204: Perform continuous training according to the acquired model status information.

[0061] Specifically, the backup computing node and the general computing node that executes the training task are in the same parallel task cluster. The general training node receives and synchronously loads the latest model state information saved by the backup computing node, and restores the current model parameters and optimizer parameters according to the model state information, so that the model training can continue.

[0062] In a preferred embodiment, the backup computing node is configured as two, including a first backup computing node and a second backup computing node, which realizes the backup of the model state information by alternating storage. During the model training process, after each iteration completes the model state update, if the current iteration number is an odd number, the current model state information is stored in the first backup computing node; if the current iteration number is an even number, the current model state information is stored in the second backup computing node.

[0063] When model training is interrupted and it is necessary to obtain model status information from the corresponding backup computing node based on the number of the most recent iteration, if the number of the most recent iteration is an odd number, the model status information is obtained from the first backup computing node; if the number of the most recent iteration is an even number, the model status information is obtained from the second backup computing node.

[0064] Specifically, the current number of iterations is obtained, and the parity of the iteration number is judged. According to the judgment result, the backup computing node that should store the current model state information is confirmed, and the current model state information is stored in the backup computing node. When the model training is interrupted and the model state needs to be restored, the number of the most recent iteration is confirmed and its parity is judged, so as to confirm the backup computing node that stores the model state information corresponding to the most recent iteration number, and obtain the model state information in the latest file of the backup computing node.

[0065] In a specific example, if the current iteration number is the 300th, and the parity judgment shows that the current iteration number is an even number, the 300th model status information is stored in the second backup computing node; if the model training is interrupted, and the number of the most recent iteration before the interruption is the 499th, and the parity judgment shows that the current iteration number is an odd number, the model status information is obtained from the first backup computing node.

[0066] It should be noted that the first backup computing node does not necessarily correspond to odd-numbered iterations, and the second backup computing node does not necessarily correspond to even-numbered iterations. In some other examples, the first backup computing node can be set to correspond to even-numbered iterations, and the second backup computing node can be set to correspond to odd-numbered iterations.

[0067] The beneficial effect of this preferred embodiment is that the number of backup computing nodes is set to two, thereby controlling the equipment cost; at the same time, by alternately backing up the model status information through the two backup computing nodes, even when the model parameter update process is abnormally interrupted, resulting in the model status being damaged and unable to be backed up, it can be ensured that at least one backup computing node can save a complete and intact model status, thereby increasing fault tolerance.

[0068] In a preferred embodiment, the number of backup computing nodes is configured to be more than two. During the model training process, after each iteration completes the model state update, the current iteration number i is divided by the total number of backup computing nodes n to obtain the remainder x; if x = 0, the model state information after the current i-th iteration is completed is stored in the n-th backup computing node; if x ≠ 0, the model state information after the current i-th iteration is completed is stored in the x-th backup computing node; where n is greater than 2.

[0069] When model training is interrupted, the number of the most recent iteration j is divided by the total number of backup computing nodes n to obtain the remainder y; if y=0, the model status information is obtained from the nth backup computing node; if y≠0, the model status information is obtained from the yth backup computing node.

[0070] In a specific example, the backup computing nodes are configured as 3, that is, n = 3. If the current iteration number is the 499th, that is, i = 499. The current iteration number 499 is divided by the total number of backup computing nodes 3 to obtain a remainder of 1, that is, x = 1, and it can be confirmed that the model state information corresponding to the iteration training should be stored in the first backup computing node.

[0071] When model training is interrupted, if the number of the most recent iteration is 1000, that is, j=1000, the number of the most recent iteration 1000 is divided by the total number of backup computing nodes 3 to obtain the remainder 1, that is, y=1, and the model status information is obtained from the first backup computing node; if the number of the most recent iteration is 1002, that is, j=1002, the number of the most recent iteration 1002 is divided by the total number of backup computing nodes 3 to obtain the remainder 0, that is, y=0, and the model status information is obtained from the third backup computing node.

[0072] In another embodiment, the backup computing node may also be set to 1, and all model state information during the model training process is backed up in the backup computing node. When the model training is interrupted, the model state information in the latest file of the backup computing node is directly obtained.

[0073] In a preferred embodiment, the backup computing node can also realize the recovery of model state information under a specified number of iterations.

[0074] Specifically, the model state information is stored in the video memory of the computing unit in the backup computing node; after the backup computing node executes the model state information storage after the kth iteration, in the first idle state, the model state information after the kth iteration is first unloaded from the video memory to the internal memory, and in the subsequent idle state cycle, the model state information is gradually unloaded from the internal memory to the permanent storage space; wherein k is a specified threshold of the number of iterations; the idle state is the period from the backup computing node executing the model state information storage once to the next execution of the model state information storage. When it is necessary to return to the kth iteration, the model state information after the kth iteration is obtained from the permanent storage space, and the training is continued to the kth iteration.

[0075] In a specific example, taking the setting of two backup computing nodes as an example, after the kth iteration, the backup computing node completes the storage of the model state information of the kth iteration training, and before the storage of the model state information of the k+1th iteration training, that is, the first idle state of the backup computing node, the idle state time is approximately equal to the time of 2 iteration training. In the idle state, the backup computing node unloads the stored model state information from the video memory to the internal memory. It should be noted that according to the current level of internal computer interconnection, the bandwidth from the video memory to the internal memory is relatively sufficient, and within the interval of 2 iterations, the backup computing node is sufficient to complete the unloading of the full model state.

[0076] In order to avoid affecting the subsequent synchronization of backup model parameters, only the operation of unloading the model state information from the video memory to the internal memory is performed during the first idle state time. In the subsequent idle state cycle, the model state information can be gradually unloaded from the internal memory to the permanent storage according to the actual training situation and the performance of the corresponding hardware equipment. The permanent storage includes but is not limited to file storage, object storage, etc., so as to achieve the persistent preservation of the checkpoint. When it is necessary to return to the kth iteration, the model state information after the kth iteration can be obtained through the permanent storage space, and the training can be returned to the kth iteration for continuous training.

[0077] In a preferred embodiment, the continuous training is performed according to the acquired model state information, including: using a broadcasting method to enable multiple computing nodes that execute model training to synchronously load the acquired model state information for continuous training.

[0078] Specifically, the backup computing node storing the target model state information is used as the source node, and the model state information in its latest file is broadcast to other general computing nodes in the same parallel task cluster. After receiving the broadcasted model state information, the general computing nodes participating in the training task update the model state information to the local model.

[0079] In a preferred embodiment, the configuration of the backup computing node includes the following:

[0080] The backup computing node includes several computing units; when the exclusive bandwidth of each computing unit is not less than k times the bandwidth requirement of a single model shard, each computing unit is configured to store at least one model shard, otherwise, each computing unit is configured to store one model shard, where k is the number of model shards that each computing unit can accommodate.

[0081] Specifically, the backup computing node is composed of several computing units, and the number of computing units is determined by the model scale, wherein the computing unit can be a graphics processing unit (GPU). Set the video memory of each computing unit to M, the exclusive external bandwidth to B, and the number of model parameters to be trained to P. Due to different precision and optimizer usage, it is assumed that the total video memory actually required is n times the number of parameters, Pi is the parameter amount of the i-th shard of the model, and the data parallel transmission bandwidth requirement of the shard is Bi. There are S model shards in total, and S is equal to the model parallel number, that is, the product of the pipeline parallel number and the tensor parallel number. The number of computing units contained in a backup computing node can be calculated by the following formula:

[0082]

[0083]

[0084] Where k is the number of model shards that each computing unit can accommodate. When the exclusive bandwidth of each computing unit is large (not less than k times the bandwidth requirement of a single model shard), the status of multiple model shards can be stored in one computing unit, and the backup computing node can use relatively fewer computing units; otherwise, each computing unit only stores the status of one model shard, and the number of computing units required for the backup computing node is equal to the number of model shards. When N is greater than the number of computing units of a single physical server, a backup computing node may be composed of multiple servers.

[0085] In some other examples, for training tasks that only use data parallelism but not model parallelism, the above formula is a special case, that is, the number of model shards S = 1, and the backup computing node only needs one computing unit. The above bandwidth requirements can ensure that the addition of the backup computing node will not reduce the performance of the original training task.

[0086] In the actual application of a model training method described in an embodiment of the present application, the backup computing unit will participate in the parameter synchronization process as a data parallel unit in the corresponding parallel computing framework and receive the complete model state, wherein the parallel computing framework includes but is not limited to the PS architecture, AllReduce architecture, etc. The specific parameter synchronization method can be achieved by broadcasting or joining the AllReduce ring.

[0087] In the embodiment of the present application, the checkpoint process in the model training is the process of recording the current iteration number and storing the current model status information every time the model completes an iteration and executes the model parameter update. Since the current model parameters will be updated at the end of each iteration process during the model training process, that is, the checkpoint process in the embodiment of the present application corresponds to the full model status information during the model training process, the checkpoint is an uninterrupted checkpoint, and each checkpoint corresponds to an iteration process.

[0088] In practical applications, since data parallelism generally has low bandwidth requirements, here we take GPT3-175B as an example, the data parallel bandwidth requirement for 1000 card parallel training is about 27GB / s. Under the current mainstream high-end networking, taking 8 200Gbps InfiniBand network cards as an example, the addition of backup computing nodes is equivalent to adding a copy of data parallelism, and the expansion efficiency can be close to 100%. Therefore, the addition of backup computing nodes is completely insensitive to the training task itself. Compared with the general checkpoint process, no additional model state information snapshot time is generated, and the fastest model intermediate state information backup is achieved. When the model training is in an interrupted state, since the general model state recovery is loaded from non-volatile media (file storage or object storage) or memory into the computing device, the backup computing node can back up the model state to the video memory of the computing unit, and complete the model state recovery through the data stored in the video memory. Therefore, compared with general computing nodes, the backup computing nodes have a faster recovery speed for continued training.

[0089] In a preferred example, in combination with the actual application environment and the above definition and composition description of the backup computing node, the hardware device corresponding to the backup computing node can be customized as a special computing node with high video memory, high bandwidth and low computing power from the cost aspect. In another example, a server with the same configuration as the ordinary computing node can be directly used, or a computing device with equivalent video memory and bandwidth and lower computing power performance requirements can be used.

[0090] In the embodiment of the present application, during the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node; when the model training is interrupted, the number of the most recent iteration before the interruption is obtained; then the model state information is obtained from the corresponding backup computing node according to the number of the most recent iteration; and training is continued according to the obtained model state information. The present application saves the checkpoints by setting up multiple backup computing nodes, thereby realizing the backup of the model state without affecting the training task, facilitating the parameter recovery when the model training is interrupted, thereby saving the model training time and improving the model training efficiency. At the same time, the embodiment of the present application supports the uninterrupted checkpoint technology, and the backup process of the intermediate state of the model is relatively independent of the model training task. At the same time, by setting up multiple backup computing nodes to alternately back up the model state, the model state information of each iterative training will be completely saved. Even if the training task is abnormally interrupted, the corresponding model parameters can be restored from the most recent iterative training, avoiding the waste of model training time and maximizing the model training efficiency.

[0091] The present application embodiment also provides a model training device 300, such as Figure 2 As shown, including:

[0092] The model state backup module 301 is used to select a backup computing node according to the current number of iterations after each iteration of the model state update is completed during the model training process, and store the current model state information in the backup computing node;

[0093] The target iteration acquisition module 302 is used to obtain the number of the most recent iteration before the interruption when the model training is interrupted;

[0094] The target model state acquisition module 303 is used to acquire model state information from the corresponding backup computing node according to the number of the most recent iteration;

[0095] The model training recovery module 304 is used to perform continuous training according to the acquired model status information.

[0096] It should be noted that a model training device and a model training method are both derived from the same inventive concept. For the relevant explanation of a model training device, reference can be made to the embodiments in a model training method, which will not be repeated here.

[0097] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computing node includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a model training method is implemented.

[0098] In one embodiment, a computer device is also provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 4As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a model training method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0099] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, a model training method described in any one of the above embodiments is implemented.

[0100] The present invention may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0101] It should be understood that the embodiments of the present application are not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the embodiments of the present application is limited only by the appended claims.

[0102] The above-mentioned embodiments only express several implementation methods of the embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the embodiments of the present application, and these all belong to the protection scope of the embodiments of the present application.

Claims

1. A model training method, characterized in that: include: During the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node; When model training is interrupted, get the number of the most recent iteration before the interruption; According to the number of the most recent iteration, obtaining model status information from the corresponding backup computing node; Continue training based on the obtained model status information.

2. The model training method according to claim 1, characterized in that: In the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node, including: During the model training process, after each iteration completes the model state update, if the current iteration number is an odd number, the current model state information is stored in the first backup computing node; If the current number of iterations is an even number, the current model state information is stored in the second backup computing node.

3. The model training method according to claim 2, characterized in that: The acquiring model status information from the corresponding backup computing node according to the number of the most recent iteration includes: If the number of the most recent iteration is an odd number, obtaining model state information from the first backup computing node; If the number of the most recent iteration is an even number, the model state information is obtained from the second backup computing node.

4. The model training method according to claim 1, characterized in that: In the model training process, after each iteration completes the model state update, a backup computing node is selected according to the current number of iterations, and the current model state information is stored in the backup computing node, including: During the model training process, after each iteration completes the model status update, the current iteration number i is divided by the total number of backup computing nodes n to obtain the remainder x; If x=0, the model state information after the current i-th iteration is completed is stored in the n-th backup computing node; If x≠0, the model state information after the current i-th iteration is completed is stored in the x-th backup computing node; Wherein, n is greater than 2.

5. The model training method according to claim 4, characterized in that: The acquiring model status information from the corresponding backup computing node according to the number of the most recent iteration includes: Divide the number of the most recent iteration j by the total number of backup computing nodes n to obtain a remainder y; If y=0, obtain the model status information from the nth backup computing node; If y≠0, obtain the model status information from the yth backup computing node.

6. The model training method according to any one of claims 1 to 5, characterized in that: The model state information is stored in the video memory of the computing unit in the backup computing node; After the backup computing node executes the storage of the model state information after the kth iteration, in the first idle state, the backup computing node first unloads the model state information after the kth iteration from the video memory to the internal memory, and in subsequent idle state cycles, gradually unloads the model state information from the internal memory to the permanent storage space; Wherein, k is a specified iteration number threshold; the idle state is the period from when the backup computing node completes one execution of model state information storage to when it executes the next model state information storage.

7. The model training method according to claim 6, characterized in that: The model training method also includes: When it is necessary to return to the kth iteration, the model state information after the kth iteration is obtained from the permanent storage space, and the training is continued by returning to the kth iteration.

8. The model training method according to any one of claims 1 to 5, characterized in that: The continuous training according to the acquired model state information includes: By using a broadcasting method, multiple computing nodes that execute model training can synchronously load the acquired model status information for continuous training.

9. A model training device, characterized in that: include: A model state backup module is used to select a backup computing node according to the current number of iterations after each iteration of the model state update is completed during the model training process, and store the current model state information in the backup computing node; The target iteration acquisition module is used to obtain the number of the most recent iteration before the interruption when the model training is interrupted; A target model state acquisition module, used to acquire model state information from a corresponding backup computing node according to the number of the most recent iteration; The model training recovery module is used to perform continuous training based on the acquired model status information.

10. A computer device, characterized in that: It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements the model training method as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which controls the device where the computer-readable storage medium is located to execute the model training method according to any one of claims 1 to 8 when the computer program is running.