Model checkpoint preservation based on multi-tier storage
Through the multi-layer storage method, checkpoints of machine learning models can be quickly saved and restored, which solves the problem in the existing technology that checkpoint saving takes up GPU resources and the frequency is too low, and improves the efficiency and stability of model training.
Patent Information
- Application Number
- CN202310246286.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2024-09-20
AI Technical Summary
In the existing technology, the checkpoint saving process of the machine learning model occupies a large amount of GPU resources, resulting in model training and saving cannot be performed at the same time, and the checkpoint saving frequency is too low, which will cause the loss of long training resources when the training process is interrupted, increasing the training time. Waste of time and resources.
Using a multi-layer storage model checkpoint saving method, the checkpoint to be saved is identified through the GPU memory and quickly saved to the CPU memory, and then saved from the CPU memory to local, neighbor or remote non-transitory memory to implement checkpointing A layered storage and recovery mechanism allows the training process to occur in the background.
It achieves fast model checkpoint saving, reduces resource overhead, improves the speed and stability of model training, provides a flexible recovery mechanism, and reduces the waste and loss of training resources.
Smart Images

Figure CN118672476A
Abstract
Description
Background Art
[0001] With the growth of computing data and the improvement of computing power, machine learning has been widely used in various fields. Various machine learning models have been continuously developed and have performed well in many fields such as natural language processing and computer vision. For example, the Bidirectional Encoder Resentations from Transformers (BERT) model and the third-generation generative pre-trained transformer (GPT-3) model have been proven to have excellent results in the field of natural language processing. Such models are often large-scale or ultra-large-scale deep learning models that rely on deep networks with huge parameters. Training such models is usually very time-consuming. Summary of the invention
[0002] This Summary is provided to introduce a group of concepts that will be further described in the following Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
[0003] Embodiments of the present disclosure propose a method, apparatus, and computer-readable medium for model checkpoint preservation based on multi-layer storage. During the training of a machine learning model performed by a graphics processing unit (GPU) in a target node, a checkpoint to be saved of the machine learning model can be identified from a GPU memory that directly exchanges data with the GPU. The checkpoint can be saved from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node. The checkpoint can be saved from the CPU memory to a non-transitory memory, the non-transitory memory including at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located at a remote end of the target node.
[0004] It should be noted that one or more of the above aspects include features described in detail below and specifically pointed out in the claims. The following description and drawings set forth in detail certain illustrative features of the one or more aspects. These features are merely indicative of various ways in which the principles of the various aspects may be employed, and the present disclosure is intended to include all such aspects and their equivalents. BRIEF DESCRIPTION OF THE DRAWINGS
[0005] The disclosed aspects will be described below in conjunction with the accompanying drawings, which are provided to illustrate rather than limit the disclosed aspects.
[0006] Figure 1 An exemplary process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0007] Figure 2 A first example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0008] Figure 3 A second example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0009] Figure 4 A third example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0010] Figure 5 A fourth example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0011] Figure 6 A fifth example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0012] Figure 7 A sixth example of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0013] Figure 8 The invention is a flowchart of an exemplary method for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure.
[0014] Fig. 9 An exemplary apparatus for saving model checkpoints based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0015] Fig.10 Another exemplary apparatus for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0016] The present disclosure will now be discussed with reference to several exemplary embodiments. It should be understood that the discussion of these embodiments is only used to enable those skilled in the art to better understand and thereby implement the embodiments of the present disclosure, and does not teach any limitation on the scope of the present disclosure.
[0017] The training of the machine learning model can be performed collaboratively by a group of machines. In this article, the machine used to perform the training of the machine learning model is referred to as a node. Each node may include several graphics processing units (GPUs). The training of the machine learning model can be performed in each GPU. The training process of the machine learning model is usually very long, especially for ultra-large-scale deep learning models. During the training of the machine learning model, the training process will inevitably be interrupted due to reasons such as node failure. In order to enable the training process to be restored after the training process is interrupted, the state of the machine learning model can be saved during the training. The state of the machine learning model saved during the training of the machine learning model can be referred to as the checkpoint of the machine learning model. At present, the checkpoint created at a node is usually saved directly from the GPU memory of the node to the final memory, such as directly saved to the hard disk of the node or to the memory located at the far end of the node. This process will take up a lot of GPU resources, so model training and model checkpoint saving cannot be performed at the same time. For example, after each stage of training is completed, it is necessary to pause the training first and then save the model checkpoint at the current moment. Subsequently, the model training can be continued only after the model checkpoint is saved. However, model checkpoint saving often takes a long time, especially for large-scale or ultra-large-scale deep learning models. Therefore, the overhead generated by the model checkpoint saving process is huge and will greatly increase the time required to complete model training. The overhead generated by the model checkpoint saving process can be reduced by reducing the number of model checkpoint saves, that is, increasing the time interval between two adjacent model checkpoint saves. However, when the model training process is interrupted and the last saved checkpoint is needed to resume the training process, if the time interval between two adjacent model checkpoint saves is too long, a long training process will be lost. This also results in a large waste of training resources.
[0018] The embodiments of the present disclosure propose model checkpoint preservation based on multi-tier storage. For example, during the training of a machine learning model performed by a GPU in a target node, a checkpoint to be saved of the machine learning model can be identified from a GPU memory that directly exchanges data with the GPU. In this article, the target node refers to a node for which the model checkpoint preservation is to be performed. The GPU memory is usually a transitory memory. Then, the checkpoint can be saved from the GPU memory to the CPU memory that directly exchanges data with the central processing unit (CPU) in the target node. The CPU memory is usually a temporary memory. In this article, the checkpoint preservation process with the destination being the CPU memory is referred to as the first layer of storage. Data transmission from the GPU memory to the CPU memory can achieve a higher speed. Therefore, the checkpoint can be quickly saved from the GPU memory to the CPU memory. The first layer of storage is usually performed after each stage of model training is completed, but because it only takes a very small amount of time, the next stage of model training can be started in a very short time.
[0019] After the checkpoint is saved to the CPU memory, the checkpoint can be saved from the CPU memory to a local non-transitory memory located in the target node and / or a neighbor non-transitory memory located in a neighbor node of the target node. In this article, the non-transitory memory located in the target node is referred to as the local non-transitory memory of the target node. The neighbor node of the target node refers to a node that is located in the same cluster as the target node and whose IP address is close to the IP address of the target node or whose index in the cluster is close to the index of the target node. The neighbor node is illustrated below by taking a cluster containing N nodes as an example. The index of each node in the cluster can be i (0≤i≤N-1). When the index of the target node in the cluster is i∈[0,N-2], its neighbor node can be a node located in the same cluster and whose index in the cluster is i+1. When the index of the target node in the cluster is i=N-1, its neighbor node can be a node located in the same cluster and whose index in the cluster is 0. It should be understood that the target node and the neighbor node are relative. When a model checkpoint is to be saved for the neighbor node, the neighbor node becomes the target node. In this article, the non-transitory memory located in the neighbor node of the target node can be referred to as the neighbor non-transitory memory of the target node. The checkpoint saving process with the destination being the local non-transitory memory and / or the neighbor non-transitory memory can be referred to as the second-tier storage. The process of saving the checkpoint from the CPU memory to the local non-transitory memory and / or the neighbor non-transitory memory can be performed in the background of the model training. Therefore, the model training and the second-tier storage can be performed simultaneously.
[0020] Subsequently, the checkpoint can be saved from the local non-transitory memory and / or the neighbor non-transitory memory to a remote non-transitory memory located remotely from the target node. The remote non-transitory memory can be, for example, a non-transitory memory located in the cloud. The remote non-transitory memory can be designed to save checkpoints created at one or more clusters. In this article, the checkpoint saving process with the destination being the remote non-transitory memory is referred to as the third-tier storage. The process of saving the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory can also be performed in the background of the model training. Therefore, model training and the third-tier storage can also be performed simultaneously.
[0021] The above technical solution adopts multiple processes including first-layer storage, second-layer storage and third-layer storage to save the checkpoints of the machine learning model, so it can be called model checkpoint preservation based on multi-layer storage.
[0022] The first layer storage, the second layer storage, and the third layer storage can all be executed at a faster speed, so fast model checkpoint saving can be achieved. In addition, the second layer storage and the third layer storage can be carried out simultaneously with the model training, so the speed of model training can be improved, which is particularly beneficial for large-scale or ultra-large-scale deep learning models. In addition, during the training of the machine learning model, the CPU memory or non-transient memory in each node is usually not fully utilized. The above process uses the available space of the CPU memory or non-transient memory in the node to save the checkpoint, which can improve the utilization of resources and thereby reduce the resource overhead generated by the model checkpoint saving.
[0023] By saving the checkpoint from the GPU memory to the CPU memory through the first layer of storage, the training process executed at the GPU of the target node can be restored by using the checkpoint saved in the CPU memory when a failure occurs. By saving the checkpoint from the CPU memory to the neighbor non-transient memory through the second layer of storage, the training process can be restored by using the checkpoint saved in the neighbor non-transient memory when a failure occurs at the target node. By saving the checkpoint from the local non-transient memory and / or the neighbor non-transient memory to the remote non-transient memory through the third layer of storage, the training process can be restored by using the checkpoint saved in the remote non-transient memory when the entire training task fails or the entire cluster fails. Therefore, the model checkpoint preservation based on multi-layer storage can realize a hierarchical recovery mechanism. In the prior art, the checkpoint created at the node is directly saved from the GPU memory of the node to the final memory. Therefore, no matter which level of failure or fault occurs, it is necessary to retrieve the checkpoint from the final memory. Therefore, model checkpoint saving based on multi-layer storage provides a more flexible recovery measure compared to the existing technology, which can restore the training process in a shorter time and thus improve the stability of model training. In addition, when performing checkpoint saving through each layer of storage, the time interval between two adjacent checkpoint saves can be shortened due to the small overhead and no impact on model training, and the time interval can be set according to actual application requirements. This can reduce the loss of training processes when the model training process is interrupted and reduce the waste of training resources.
[0024] The above-mentioned technical solution for model checkpoint preservation based on multi-layer storage is not limited to any specific machine learning platform for providing computing resources and storage resources required for machine learning, and can therefore be run on various machine learning platforms. In addition, the technical solution does not rely on any specific machine learning framework for providing machine learning tools, and therefore is compatible with various machine learning frameworks.
[0025] It should be understood that although the above discussion and the following discussion may involve the use of the first-tier storage, the second-tier storage, and the third-tier storage to perform model checkpoint preservation, the embodiments of the present disclosure are not limited thereto. According to actual application requirements, it is also possible to perform model checkpoint preservation using only one or two of the first-tier storage, the second-tier storage, and the third-tier storage.
[0026] Various embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0027] Figure 1 An exemplary process 100 for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0028] At 102, during the training of the machine learning model performed by the GPU in the target node, a checkpoint to be saved of the machine learning model can be identified from a GPU memory that directly exchanges data with the GPU. The GPU memory is generally a temporary memory. The checkpoint to be saved of the machine learning model can be created during the training of the machine learning model, which can include the model state at the current moment, such as parameters of the model, gradients, optimizer state, etc. The optimizer state can include, for example, momentum, variance, parameters with 32-bit floating point precision, gradients with 32-bit floating point precision, etc.
[0029] At 104, the checkpoint can be saved from the GPU memory to the CPU memory that directly exchanges data with the CPU in the target node. The CPU memory is usually a temporary memory. This process can be regarded as the first layer of storage. The checkpoint can be retained in the CPU memory for a period of time so that when the training process is interrupted, the checkpoint retained in the CPU memory can be used to quickly resume the training process. The CPU can also be used to perform the training of the machine learning model. In this case, the checkpoint can be saved to the CPU memory through a memory copy. The data transmission from the GPU memory to the CPU memory can achieve a higher speed. For example, the throughput from the GPU memory to the CPU memory can usually reach more than 10GB / s. Therefore, the checkpoint can be quickly saved from the GPU memory to the CPU memory. The first layer of storage is usually performed after each stage of model training is completed, but because it only takes a very small amount of time, the next stage of model training can be started in a very short time.
[0030] Subsequently, the checkpoint may be saved from the CPU memory to a non-transitory memory. The non-transitory memory may be a hard disk, such as a hard disk that complies with the Non-Volatile Memory Express (NVMe) specification. The non-transitory memory may include, for example, a local non-transitory memory located in a target node, a neighbor non-transitory memory located in a neighbor node of the target node, a remote non-transitory memory located at a remote end of the target node, and the like.
[0031] In one embodiment, after performing step 104, at 106, the checkpoint can be saved from the CPU memory to the local non-transient memory and / or the neighbor non-transient memory. This process can be regarded as a second-tier storage. Data transmission from the CPU memory to the local non-transient memory and / or the neighbor non-transient memory can achieve a higher speed. For example, the throughput from the CPU memory to the local non-transient memory and / or the neighbor non-transient memory can generally reach more than 5GB / s. Therefore, the checkpoint can be quickly saved from the CPU memory to the local non-transient memory and / or the neighbor non-transient memory. The process of saving the checkpoint from the CPU memory to the local non-transient memory and / or the neighbor non-transient memory can be performed in the background of model training. Therefore, model training and the second-tier storage can be performed simultaneously. The local non-transient memory and / or the neighbor non-transient memory can be the final storage of the checkpoint. In this way, the checkpoint can be saved by the first-tier storage and the second-tier storage. Alternatively, the local non-transient memory and / or the neighbor non-transient memory can also be an intermediate storage of the checkpoint. In this case, the checkpoint can be further saved to a remote non-transitory memory. For example, optionally, at 108, the checkpoint can be saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory. At this point, the remote non-transitory memory can be the final memory of the checkpoint. This process can be regarded as a third-tier storage. In this way, the checkpoint can be saved by the first-tier storage, the second-tier storage, and the third-tier storage. The throughput from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory can typically be 0.1 to 1 GB / s. The process of saving the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory can also be performed in the background of the model training. Therefore, model training and the third-tier storage can also be performed simultaneously.
[0032] In another embodiment, after executing step 104, at 110, the checkpoint can be saved from the CPU memory to the remote non-transitory memory. In this way, the checkpoint can be saved through the first-tier storage and the third-tier storage. That is, after executing the first-tier storage, the second-tier storage can be skipped and the third-tier storage can be directly executed.
[0033] The space of the CPU memory is usually limited. Preferably, the previously saved checkpoints in the CPU memory can be deleted regularly. This can ensure that the available space of the CPU memory is sufficient to accommodate the checkpoints to be saved at any time, so that the first layer of storage can be smoothly executed. Alternatively, before saving the checkpoint from the GPU memory to the CPU memory, it can also be determined whether the available space of the CPU memory is sufficient to accommodate the checkpoint. If it is determined that the available space of the CPU memory is sufficient to accommodate the checkpoint, the checkpoint can be saved from the GPU memory to the CPU memory. If it is determined that the available space of the CPU memory is insufficient to accommodate the checkpoint, the checkpoint can be saved from the GPU memory to the non-transient memory. In other words, the first layer of storage may not be executed. The non-transient memory may include, for example, a local non-transient memory, a neighbor non-transient memory, a remote non-transient memory, and the like.
[0034] In one embodiment, after executing step 102, if it is determined that the available space of the CPU memory is insufficient to accommodate the checkpoint, the process 100 may proceed to 112. At 112, the checkpoint may be saved from the GPU memory to the local non-transient memory and / or the neighbor non-transient memory. The checkpoints may be saved in batches to the local non-transient memory and / or the neighbor non-transient memory using the CPU memory as a transmission medium. For example, a portion of the checkpoints may be first transferred from the GPU memory to the CPU memory. Then, the CPU memory may further transfer the portion of the checkpoints to the local non-transient memory and / or the neighbor non-transient memory. After the CPU memory transfers the portion of the checkpoints to the local non-transient memory and / or the neighbor non-transient memory, the portion of the checkpoints may be deleted in the CPU memory. Subsequently, the GPU memory may transfer the next portion of the checkpoints to the CPU memory. The CPU memory may transfer the next portion of the checkpoints to the local non-transient memory and / or the neighbor non-transient memory in the above manner, and so on. The operation at 112 may be considered as a second-tier storage. The local non-transitory memory and / or the neighbor non-transitory memory may be the final memory of the checkpoint. In this manner, the checkpoint may be saved by the second-tier storage. Alternatively, the local non-transitory memory and / or the neighbor non-transitory memory may also be the intermediate memory of the checkpoint. In this case, the checkpoint may be further saved in the remote non-transitory memory. For example, optionally, at 114, the checkpoint may be saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory. At this point, the remote non-transitory memory may be the final memory of the checkpoint. This process may be regarded as the third-tier storage. In this manner, the checkpoint may be saved by the second-tier storage and the third-tier storage.
[0035] In another embodiment, after executing step 102, if it is determined that the available space of the CPU memory is insufficient to accommodate the checkpoint, the process 100 may proceed to 116. At 116, the checkpoint may be saved from the GPU memory to the remote non-transitory memory. Similar to step 112, the checkpoints may be saved in batches to the remote non-transitory memory using the CPU memory as a transmission medium. For example, a portion of the checkpoints may be first transferred from the GPU memory to the CPU memory. The CPU memory may further transfer the portion of the checkpoints to the remote non-transitory memory. After the CPU memory transfers the portion of the checkpoints to the remote non-transitory memory, the portion of the checkpoints may be deleted in the CPU memory. Subsequently, the GPU memory may transfer the next portion of the checkpoints to the CPU memory, and the CPU memory may transfer the next portion of the checkpoints to the remote non-transitory memory in the above manner, and so on. In this manner, the checkpoints may be saved through the third-tier storage. That is, the first-tier storage and the second-tier storage may be skipped, and the third-tier storage may be directly executed.
[0036] The first layer storage at step 104, the second layer storage at step 106 or step 112, and the third layer storage at step 108, step 110, step 114 or step 116 can all be executed at a faster speed, so fast model checkpoint preservation can be achieved. In addition, the second layer storage and the third layer storage can be performed simultaneously with the model training, so the speed of model training can be improved, which is particularly beneficial for large-scale or ultra-large-scale deep learning models. In addition, during the training of the machine learning model, the CPU memory or non-transitory memory in each node is usually not fully utilized. The above process utilizes the available space of the CPU memory or non-transitory memory in the node to save the checkpoint, which can improve the utilization of resources and thereby reduce the resource overhead generated by the model checkpoint preservation.
[0037] By saving the checkpoint from the GPU memory to the CPU memory through the first layer of storage, the training process executed at the GPU of the target node can be restored by using the checkpoint saved in the CPU memory when a failure occurs. By saving the checkpoint from the CPU memory to the neighbor non-transient memory through the second layer of storage, the training process can be restored by using the checkpoint saved in the neighbor non-transient memory when a failure occurs at the target node. By saving the checkpoint from the local non-transient memory and / or the neighbor non-transient memory to the remote non-transient memory through the third layer of storage, the training process can be restored by using the checkpoint saved in the remote non-transient memory when a failure occurs in the entire training task or the entire cluster. Therefore, the model checkpoint preservation based on multi-layer storage can realize a hierarchical recovery mechanism. In the prior art, the checkpoint created at the node is usually saved directly from the GPU memory of the node to the final memory. Therefore, no matter which level of failure or fault occurs, it is necessary to retrieve the checkpoint from the final memory. Therefore, model checkpoint saving based on multi-layer storage provides a more flexible recovery measure compared to the existing technology, which can restore the training process in a shorter time and thus improve the stability of model training. In addition, when performing checkpoint saving through each layer of storage, the time interval between two adjacent checkpoint saves can be shortened due to the small overhead and no impact on model training, and the time interval can be set according to actual application requirements. This can reduce the loss of training processes and reduce the waste of training resources when the model training process is interrupted.
[0038] It should be understood that the above Figure 1 The described process for saving model checkpoints based on multi-layer storage is only exemplary. According to actual application requirements, the steps in the process for saving model checkpoints based on multi-layer storage can be replaced or modified in any way, and the process can include more or fewer steps. For example, although in Figure 1 In the process 100 of FIG. 1 , multiple implementations for model checkpoint preservation are shown, but it is also possible to use only any one or more of these implementations to perform the process of model checkpoint preservation. In addition, the specific order or hierarchy of the steps in the process 100 is only exemplary, and the process for model checkpoint preservation based on multi-layer storage can be performed in an order different from the described order.
[0039] Figure 2A first example 200 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the first example 200, two layers of storage including a first layer of storage and a second layer of storage are used to save a checkpoint of a machine learning model created at a target node 210, such as a checkpoint created during training of a machine learning model performed by a GPU in the target node 210. The first example 200 may correspond to Figure 1 Steps 102 to 106 in .
[0040] The GPU memory 212 is a memory that directly exchanges data with the GPU in the target node 210. The GPU memory 212 is a temporary memory. The checkpoint to be saved of the machine learning model can be identified from the GPU memory 212.
[0041] The checkpoint may be first saved from the GPU memory 212 to the CPU memory 214 through the first layer of storage. The CPU memory 214 may be a memory that directly exchanges data with the CPU in the target node 210. The CPU memory 214 is a temporary memory.
[0042] Next, the checkpoint may be saved from the CPU memory 214 to the neighbor non-transitory memory 226 in the neighbor node 220 through the second layer of storage. The neighbor node 220 may also include a GPU memory 222 and a CPU memory 224. The GPU memory 222 and the CPU memory 224 may be used to perform the save process of the checkpoint of the machine learning model created at the neighbor node 220. Optionally, the checkpoint may be saved from the CPU memory 214 to the local non-transitory memory 216 in the target node 210 through the second layer of storage.
[0043] In the first example 200 , the local non-transitory memory 216 and / or the neighbor non-transitory memory 226 may be the final memory for saving the checkpoint created at the target node 210 .
[0044] Figure 3 A second example 300 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the second example 300, a three-layer storage including a first-layer storage, a second-layer storage, and a third-layer storage is used to save a checkpoint of a machine learning model created at a target node 310. The second example 300 may correspond to Figure 1 The target node 310, the GPU memory 312, the CPU memory 314, and the local non-transitory memory 316 may correspond to the respective Figure 2The target node 210, GPU memory 212, CPU memory 214 and local non-transitory memory 216 in. The neighbor node 320, GPU memory 322, CPU memory 324 and neighbor non-transitory memory 326 may correspond to Figure 2 The neighbor nodes 220, GPU memory 222, CPU memory 224 and neighbor non-temporary memory 226 in.
[0045] A checkpoint of the machine learning model to be saved may be identified from the GPU memory 312 .
[0046] The checkpoint may first be saved from the GPU memory 312 to the CPU memory 314 through the first layer of storage.
[0047] Next, the checkpoint may be saved from the CPU memory 314 to the neighbor non-transitory memory 326 in the neighbor node 320 via the second layer of storage. Alternatively, the checkpoint may be saved from the CPU memory 314 to the local non-transitory memory 316 in the target node 310 via the second layer of storage.
[0048] The checkpoint may then be saved from the neighbor non-transitory storage 326 to the remote non-transitory storage 330 via the third layer of storage. In the case where the checkpoint is saved to the local non-transitory storage 316, the checkpoint may also be saved from the local non-transitory storage 316 to the remote non-transitory storage 330 via the third layer of storage.
[0049] In the second example 300 , the remote non-transitory storage 330 may be the final storage for saving the checkpoint created at the target node 310 .
[0050] Figure 4 A third example 400 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the third example 400, two layers of storage including a first layer of storage and a third layer of storage are used to save a checkpoint of a machine learning model created at a target node 410. The third example 400 may correspond to Figure 1 The target node 410, the GPU memory 412, the CPU memory 414, and the local non-temporary memory 416 may correspond to steps 102 to 104 and step 110, respectively. Figure 2 The target node 210, GPU memory 212, CPU memory 214 and local non-transitory memory 216 in. The neighbor node 420, GPU memory 422, CPU memory 424 and neighbor non-transitory memory 426 may correspond to Figure 2The neighbor nodes 220, GPU memory 222, CPU memory 224 and neighbor non-temporary memory 226 in.
[0051] A checkpoint of the machine learning model to be saved may be identified from GPU memory 412 .
[0052] The checkpoint may first be saved from the GPU memory 412 to the CPU memory 414 through the first layer of storage.
[0053] The checkpoint may then be saved from the CPU memory 414 to the remote non-transitory memory 430 via the third layer of storage.
[0054] In the third example 400, the remote non-transitory memory 430 may be the final memory for saving the checkpoint created at the target node 410. In addition, the checkpoint is saved from the CPU memory 414 to the remote non-transitory memory 430 without first being saved to the local non-transitory memory 416 or the neighbor non-transitory memory 426.
[0055] Figure 5 A fourth example 500 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the fourth example 500, a single-layer storage including a second-layer storage is used to save a checkpoint of a machine learning model created at a target node 510. The fourth example 500 may correspond to Figure 1 The target node 510, the GPU memory 512, the CPU memory 514, and the local non-transitory memory 516 may correspond to Figure 2 The target node 210, GPU memory 212, CPU memory 214 and local non-transitory memory 216 in. The neighbor node 520, GPU memory 522, CPU memory 524 and neighbor non-transitory memory 526 may correspond to Figure 2 The neighbor nodes 220, GPU memory 222, CPU memory 224 and neighbor non-temporary memory 226 in.
[0056] A checkpoint of the machine learning model to be saved may be identified from the GPU memory 512 .
[0057] The CPU memory 514 may be used as a transmission medium to save the checkpoints in batches to the local non-transitory memory 516 and / or the neighbor non-transitory memory 526. For example, a portion of the checkpoints may be first transferred from the GPU memory 512 to the CPU memory 514. The CPU memory 514 may further transfer the portion of the checkpoints to the neighbor non-transitory memory 526 in the neighbor node 520. Alternatively, the CPU memory 514 may further transfer the portion of the checkpoints to the local non-transitory memory 516 in the target node 510. After the CPU memory transfers the portion of the checkpoints to the local non-transitory memory 516 and / or the neighbor non-transitory memory 526, the portion of the checkpoints may be deleted in the CPU memory 514. Subsequently, the GPU memory 512 may transfer the next portion of the checkpoints to the CPU memory 514. The CPU memory 514 may transfer the next portion of the checkpoints to the local non-transitory memory 516 and / or the neighbor non-transitory memory 526 in the above manner, and so on. The above process may be regarded as a second-tier storage.
[0058] In the fourth example 500, the local non-transitory memory 516 and / or the neighbor non-transitory memory 526 may be the final memory for saving the checkpoint created at the target node 510. The fourth example 500 may be performed if it is determined that the available space of the CPU memory 514 is insufficient to accommodate the checkpoint to be saved.
[0059] Figure 6 A fifth example 600 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the fifth example 600, two layers of storage including a second layer of storage and a third layer of storage are used to save a checkpoint of a machine learning model created at a target node 610. The fifth example 600 may correspond to Figure 1 The target node 610, the GPU memory 612, the CPU memory 614, and the local non-temporary memory 616 may correspond to the steps 102 and 112 to 114, respectively. Figure 2 The target node 210, GPU memory 212, CPU memory 214 and local non-transitory memory 216 in. The neighbor node 620, GPU memory 622, CPU memory 624 and neighbor non-transitory memory 626 may correspond to Figure 2 The neighbor nodes 220, GPU memory 222, CPU memory 224 and neighbor non-temporary memory 226 in.
[0060] A checkpoint of the machine learning model to be saved may be identified from the GPU memory 612 .
[0061] The CPU memory 614 may be used as a transmission medium to save the checkpoints in batches to the local non-transitory memory 616 and / or the neighbor non-transitory memory 626. For example, a portion of the checkpoints may be first transferred from the GPU memory 612 to the CPU memory 614. The CPU memory 614 may further transfer the portion of the checkpoints to the neighbor non-transitory memory 626 in the neighbor node 620. Alternatively, the CPU memory 614 may further transfer the portion of the checkpoints to the local non-transitory memory 616 in the target node 610. After the CPU memory transfers the portion of the checkpoints to the local non-transitory memory 616 and / or the neighbor non-transitory memory 626, the portion of the checkpoints may be deleted in the CPU memory 614. Subsequently, the GPU memory 612 may transfer the next portion of the checkpoints to the CPU memory 614. The CPU memory 614 may transfer the next portion of the checkpoints to the local non-transitory memory 616 and / or the neighbor non-transitory memory 626 in the above manner, and so on. The above process may be regarded as a second-tier storage.
[0062] Next, the checkpoint may be saved from the neighbor non-transitory storage 626 to the remote non-transitory storage 630 via the third layer of storage. In the case where the checkpoint is saved to the local non-transitory storage 616, the checkpoint may also be saved from the local non-transitory storage 616 to the remote non-transitory storage 630 via the third layer of storage.
[0063] In the fifth example 600, the remote non-transitory memory 630 may be the final memory for saving the checkpoint created at the target node 610. The fifth example 600 may be performed if it is determined that the available space of the CPU memory 614 is insufficient to accommodate the checkpoint to be saved.
[0064] Figure 7 A sixth example 700 of a process for saving a model checkpoint based on multi-layer storage according to an embodiment of the present disclosure is shown. In the sixth example 700, a single-layer storage including a third-layer storage is used to save a checkpoint of a machine learning model created at a target node 710. The sixth example 700 may correspond to Figure 1 The target node 710, the GPU memory 712, the CPU memory 714, and the local non-temporary memory 716 may correspond to Figure 2 The target node 210, GPU memory 212, CPU memory 214 and local non-temporal memory 216 in. The neighbor node 720, GPU memory 722, CPU memory 724 and neighbor non-temporal memory 726 may correspond to Figure 2The neighbor nodes 220, GPU memory 222, CPU memory 224 and neighbor non-temporary memory 226 in.
[0065] A checkpoint of the machine learning model to be saved may be identified from GPU memory 712 .
[0066] The CPU memory 714 may be used as a transmission medium to save the checkpoints in batches to the remote non-transitory memory 730. For example, a portion of the checkpoints may be first transmitted from the GPU memory 712 to the CPU memory 714. The CPU memory 714 may further transmit the portion of the checkpoints to the remote non-transitory memory 730. After the CPU memory transmits the portion of the checkpoints to the remote non-transitory memory 730, the portion of the checkpoints may be deleted in the CPU memory 714. Subsequently, the GPU memory 712 may transmit the next portion of the checkpoints to the CPU memory 714. The CPU memory 714 may transmit the next portion of the checkpoints to the remote non-transitory memory 730 in the above manner, and so on. The above process may be regarded as a third-tier storage.
[0067] In the sixth example 700, the remote non-transitory memory 730 may be the final memory for saving the checkpoint created at the target node 710. The sixth example 700 may be performed if it is determined that the available space of the CPU memory 714 is insufficient to accommodate the checkpoint to be saved.
[0068] It should be understood that Figures 2 to 7 Only some examples of the process for saving model checkpoints based on multi-layer storage are shown. According to actual application requirements, model checkpoint saving based on multi-layer storage can also be implemented through any other process. For example, in Examples 200 to 700, the process of saving the checkpoint from the local non-transitory memory to the neighbor non-transitory memory is not involved. However, in some embodiments, it is also possible to save the checkpoint from the local non-transitory memory to the neighbor non-transitory memory. In addition, in Examples 200 to 700, the checkpoint created at the target node is only saved to one neighbor non-transitory memory. However, in some embodiments, it is also possible for the checkpoint created at the target node to be saved to multiple neighbor non-transitory memories.
[0069] Figure 8 is a flowchart of an exemplary method 800 for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure.
[0070] At 810, during training of a machine learning model performed by a graphics processing unit (GPU) in a target node, a checkpoint of the machine learning model to be saved may be identified from a GPU memory that directly exchanges data with the GPU.
[0071] At 820, the checkpoint may be saved from the GPU memory to a central processing unit (CPU) memory that directly exchanges data with a CPU in the target node.
[0072] At 830, the checkpoint can be saved from the CPU memory to a non-transitory memory, the non-transitory memory including at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located remotely from the target node.
[0073] In one embodiment, the checkpoint to be saved of the machine learning model may include at least one of the parameters, gradients, and optimizer states of the machine learning model.
[0074] In one implementation, the non-transitory memory may be the local non-transitory memory and / or the neighbor non-transitory memory. Method 800 may also include: saving the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
[0075] In one implementation, the method 800 may further include: periodically deleting the checkpoints previously saved in the CPU memory.
[0076] In one embodiment, the method 800 may further include determining whether the available space of the CPU memory is sufficient to accommodate the checkpoint. Saving the checkpoint from the GPU memory to the CPU memory may be performed in response to determining that the available space of the CPU memory is sufficient to accommodate the checkpoint.
[0077] The method 800 may further include: in response to determining that the available space of the CPU memory is insufficient to accommodate the checkpoint, saving the checkpoint from the GPU memory to the non-transitory memory. The non-transitory memory may be the local non-transitory memory and / or the neighbor non-transitory memory. The method 800 may further include: saving the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
[0078] It should be understood that the method 800 may also include any steps / processes for saving model checkpoints based on multi-layer storage according to the embodiments of the present disclosure described above.
[0079] Fig. 9 An exemplary apparatus 900 for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0080] The device 900 may include: a checkpoint identification module 910, which is used to identify the checkpoint to be saved of the machine learning model from the GPU memory that directly exchanges data with the GPU during the training of the machine learning model performed by the GPU in the target node; a first saving module 920, which is used to save the checkpoint from the GPU memory to the CPU memory that directly exchanges data with the central processing unit (CPU) in the target node; and a second saving module 930, which is used to save the checkpoint from the CPU memory to a non-transitory memory, wherein the non-transitory memory includes at least one of the following: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located at the remote end of the target node. In addition, the device 900 may also include any other module configured for model checkpoint preservation based on multi-layer storage according to the embodiments of the present disclosure as described above.
[0081] Fig.10 Another exemplary apparatus 1000 for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure is shown.
[0082] The apparatus 1000 may include: a processor 1010; and a memory 1020 storing computer executable instructions. When the computer executable instructions are executed, the processor 1010 may: during the training of the machine learning model performed by a graphics processing unit (GPU) in a target node, identify a checkpoint of the machine learning model to be saved from a GPU memory that directly exchanges data with the GPU, save the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node, and save the checkpoint from the CPU memory to a non-transitory memory, wherein the non-transitory memory includes at least one of the following: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located remote from the target node.
[0083] In one embodiment, the checkpoint to be saved of the machine learning model may include at least one of the parameters, gradients, and optimizer states of the machine learning model.
[0084] In one embodiment, the non-transitory memory may be the local non-transitory memory and / or the neighbor non-transitory memory. When the computer executable instructions are executed, the processor 1010 may also: save the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
[0085] In one implementation, the computer executable instructions, when executed, may further cause the processor 1010 to: periodically delete previously saved checkpoints in the CPU memory.
[0086] In one embodiment, the computer executable instructions, when executed, may further cause the processor 1010 to determine whether the available space of the CPU memory is sufficient to accommodate the checkpoint. Saving the checkpoint from the GPU memory to the CPU memory is performed in response to determining that the available space of the CPU memory is sufficient to accommodate the checkpoint.
[0087] The computer executable instructions, when executed, may also cause the processor 1010 to: in response to determining that the available space of the CPU memory is insufficient to accommodate the checkpoint, save the checkpoint from the GPU memory to the non-transitory memory. The non-transitory memory may be the local non-transitory memory and / or the neighbor non-transitory memory. The computer executable instructions, when executed, may also cause the processor 1010 to: save the checkpoint from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
[0088] It should be understood that the processor 1010 may also execute any other steps / processes of the method for saving model checkpoints based on multi-layer storage according to the embodiments of the present disclosure described above.
[0089] The embodiment of the present disclosure proposes a computer program product for model checkpoint preservation based on multi-layer storage, including a computer program, which is executed by a processor to: during the training of a machine learning model by a graphics processor (GPU) in a target node, identify the checkpoint to be saved of the machine learning model from a GPU memory that directly exchanges data with the GPU; save the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node; and save the checkpoint from the CPU memory to a non-transitory memory, the non-transitory memory including at least one of the following: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located at a remote end of the target node. In addition, the computer program can also be executed to implement any other steps / processes of the method for model checkpoint preservation based on multi-layer storage according to the embodiment of the present disclosure as described above.
[0090] Embodiments of the present disclosure may be embodied in a computer-readable medium. The computer-readable medium may include instructions that, when executed, cause a processor to: during the training of a machine learning model performed by a graphics processor (GPU) in a target node, identify a checkpoint to be saved for the machine learning model from a GPU memory that directly exchanges data with the GPU; save the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node; and save the checkpoint from the CPU memory to a non-transitory memory, the non-transitory memory including at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located at a remote end of the target node. In addition, when executed, the instructions may also cause the processor to perform any other steps / processes of the method for model checkpoint preservation based on multi-layer storage according to an embodiment of the present disclosure as described above.
[0091] It should be understood that all operations in the above-described methods are merely exemplary, and the present disclosure is not limited to any operations in the methods or the order of these operations, but should cover all other equivalent transformations under the same or similar concepts. In addition, unless otherwise specified or it is clear from the context that it is directed to a singular form, the articles "a" and "an" as used in this specification and the appended claims should generally be interpreted as meaning "one" or "one or more".
[0092] It should also be understood that all modules in the above described device can be implemented in various ways. These modules can be implemented as hardware, software, or a combination thereof. In addition, any module in these modules can be further divided into submodules or combined together functionally.
[0093] Processors have been described in conjunction with various devices and methods. These processors can be implemented using electronic hardware, computer software or any combination thereof. Whether these processors are implemented as hardware or software will depend on specific application and the overall design constraints imposed on the system. As an example, the processor provided in the present disclosure, any part of the processor or any combination of processors can be implemented using a microprocessor, a microcontroller, a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic device (PLD), a state machine, a gated logic unit, a discrete hardware circuit, and other suitable processing components configured to perform the various functions described in the present disclosure. The function of the processor provided in the present disclosure, any part of the processor or any combination of processors can be implemented using software executed by a microprocessor, a microcontroller, a DSP or other suitable platforms.
[0094] Software should be broadly considered to mean instructions, instruction sets, codes, code segments, program codes, programs, subroutines, software modules, applications, software applications, software packages, routines, subroutines, objects, running threads, processes, functions, etc. Software can reside in a computer-readable medium. A computer-readable medium can include, for example, a memory, which can be, for example, a magnetic storage device (e.g., a hard disk, a floppy disk, a magnetic stripe), an optical disk, a smart card, a flash memory device, a random access memory (RAM), a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), a register, or a removable disk. Although the memory is shown as being separated from the processor in the multiple aspects provided in the present disclosure, the memory can also be located inside the processor, such as a cache or a register.
[0095] The above description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects. Therefore, the claims are not intended to be limited to the aspects shown herein. All structural and functional equivalents to the elements of the various aspects described in this disclosure that are known or to be known to those of ordinary skill in the art are expressly incorporated herein and covered by the claims.
Claims
1. A method for saving model checkpoints based on multi-layer storage, include: During training of a machine learning model performed by a graphics processing unit (GPU) in a target node, identifying a checkpoint of the machine learning model to be saved from a GPU memory that directly exchanges data with the GPU; Saving the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node; as well as The checkpoint is saved from the CPU memory to a non-transitory memory, wherein the non-transitory memory includes at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located remote from the target node.
2. The method according to claim 1, in, The checkpoint to be saved of the machine learning model includes at least one of the parameters, gradients, and optimizer states of the machine learning model.
3. The method according to claim 1, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the method further comprises: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
4. The method according to claim 1, further comprising: include: The previously saved checkpoints in the CPU memory are periodically deleted.
5. The method according to claim 1, further comprising: include: determining whether the available space in the CPU memory is sufficient to accommodate the checkpoint, and Wherein, saving the checkpoint from the GPU memory to the CPU memory is performed in response to determining that available space in the CPU memory is sufficient to accommodate the checkpoint.
6. The method according to claim 5, further comprising: include: In response to determining that the available space of the CPU memory is insufficient to accommodate the checkpoint, the checkpoint is saved from the GPU memory to the non-transitory memory.
7. The method according to claim 6, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the method further comprises: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
8. A device for saving model checkpoints based on multi-layer storage, include: processor; as well as a memory storing computer executable instructions that, when executed, cause the processor to: During training of a machine learning model performed by a graphics processing unit (GPU) in a target node, identifying a checkpoint of the machine learning model to be saved from a GPU memory that directly exchanges data with the GPU, saving the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node, and The checkpoint is saved from the CPU memory to a non-transitory memory, wherein the non-transitory memory includes at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located remote from the target node.
9. The device according to claim 8, in, The checkpoint to be saved of the machine learning model includes at least one of the parameters, gradients, and optimizer states of the machine learning model.
10. The device according to claim 8, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the computer-executable instructions, when executed, further cause the processor to: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
11. The device according to claim 8, in, The computer executable instructions, when executed, further cause the processor to: The previously saved checkpoints in the CPU memory are periodically deleted.
12. The device according to claim 8, in, The computer executable instructions, when executed, further cause the processor to: determining whether the available space in the CPU memory is sufficient to accommodate the checkpoint, and Wherein, saving the checkpoint from the GPU memory to the CPU memory is performed in response to determining that available space in the CPU memory is sufficient to accommodate the checkpoint.
13. The device according to claim 12, in, The computer executable instructions, when executed, further cause the processor to: In response to determining that the available space of the CPU memory is insufficient to accommodate the checkpoint, the checkpoint is saved from the GPU memory to the non-transitory memory.
14. The device according to claim 13, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the computer-executable instructions, when executed, further cause the processor to: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
15. A computer-readable medium for multi-layer storage-based model checkpoint preservation, comprising instructions that, when executed, cause a processor to: During training of a machine learning model performed by a graphics processing unit (GPU) in a target node, identifying a checkpoint of the machine learning model to be saved from a GPU memory that directly exchanges data with the GPU; Saving the checkpoint from the GPU memory to a CPU memory that directly exchanges data with a central processing unit (CPU) in the target node; and The checkpoint is saved from the CPU memory to a non-transitory memory, wherein the non-transitory memory includes at least one of: a local non-transitory memory located in the target node, a neighbor non-transitory memory located in a neighbor node of the target node, and a remote non-transitory memory located remote from the target node.
16. The computer readable medium of claim 15, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the instructions, when executed, further cause the processor to: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
17. The computer readable medium of claim 15, in, The instructions, when executed, further cause the processor to: The previously saved checkpoints in the CPU memory are periodically deleted.
18. The computer readable medium of claim 15, in, The instructions, when executed, further cause the processor to: determining whether the available space in the CPU memory is sufficient to accommodate the checkpoint, and Wherein, saving the checkpoint from the GPU memory to the CPU memory is performed in response to determining that available space in the CPU memory is sufficient to accommodate the checkpoint.
19. The computer readable medium of claim 18, in, The instructions, when executed, further cause the processor to: In response to determining that the available space of the CPU memory is insufficient to accommodate the checkpoint, the checkpoint is saved from the GPU memory to the non-transitory memory.
20. The computer readable medium of claim 19, in, The non-transitory memory is the local non-transitory memory and / or the neighbor non-transitory memory, and the instructions, when executed, further cause the processor to: The checkpoint is saved from the local non-transitory memory and / or the neighbor non-transitory memory to the remote non-transitory memory.
Citation Information
Cited By
Model check point file management system, method and equipment and storage medium
CN122064535A
Model checkpoint file management system, method, equipment and storage medium
CN122064535B
