Training method, device and system, and storage medium
By using distributed training groups and elastic training frameworks in AI training to dynamically adjust preemptive instance resources, the problem of training interruption caused by preemptive instance recycling is solved, training quality and efficiency are improved, and both cost and quality are achieved.
Patent Information
- Application Number
- PCT/CN2024/087829
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-27
- Filing Date
- 2024-04-15
- Publication Date
- 2024-10-31
AI Technical Summary
Existing AI training methods based on preemptible instances cannot take into account training quality while reducing costs. Preempted instances may be recycled due to price fluctuations or insufficient inventory, resulting in abnormal termination of training operations and affecting training efficiency.
Using distributed training groups combined with an elastic training framework, elastic expansion or contraction is performed based on the usage status of preemptive instance nodes and the availability in the resource pool, and the resource allocation of training tasks is dynamically adjusted to ensure the stability and efficiency of training tasks.
While making full use of preemptible instances, it avoids training tasks from being terminated due to instance recycling, improves training quality and efficiency, and achieves a balance between cost and quality.
Smart Images

Figure CN2024087829_31102024_PF_FP_ABST
Abstract
Description
Training methods, equipment, systems and storage media
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 27, 2023, with application number 202310494610.0 and application name “Training Method, Device, System and Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of cloud computing technology, and in particular to a training method, device, system and storage medium. Background Art
[0003] With the advancement of artificial intelligence (AI), AI models are becoming increasingly larger, driving up the cost of training AI tasks. Currently, there's a method for executing training tasks based on preemptible instances (also known as spot instances). Preemptible instances are on-demand instances provided by cloud computing platforms, offering a price discount compared to non-preemptible on-demand instances. Training AI models on preemptible instances can reduce the instance cost of AI training tasks.
[0004] However, while preemptible instances significantly reduce costs, they also introduce instability. Preemptible instances can be reclaimed due to price fluctuations or insufficient inventory, causing AI training jobs running on preemptible instances to terminate abnormally. Therefore, how to reduce training costs while maintaining training quality is a pressing technical challenge.
[0005] Summary of the Invention
[0006] Various aspects of the present application provide a training method, device, system, and storage medium for reducing training costs while ensuring training quality.
[0007] An embodiment of the present application provides a training method, including: receiving a training task and obtaining a job type corresponding to the training task; scheduling the training task to a distributed training group corresponding to the job type for training; the distributed training group is used to execute the training task based on an elastic training framework corresponding to the job type; the distributed training group includes at least one preemptive instance node in a resource pool; and controlling the distributed training group to elastically expand or shrink the training task based on the usage status of the at least one preemptive instance node and / or the availability of preemptive instance resources in the resource pool.
[0008] Optionally, the training task is elastically scaled down within the distributed training group based on the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, including: if the first node of the at least one preemptible instance node is updated to an unavailable state, triggering the distributed training group to perform elastic scaling to reallocate the training task based on the remaining available nodes in the distributed training group.
[0009] Optionally, it also includes: judging whether to restart the working process on the first node according to preset training configuration information; if yes, restarting the working process and setting the working process to a paused state; controlling the distributed training group to elastically expand the training task according to the usage status of the at least one preemptive instance node and / or the availability of preemptive instance resources in the resource pool, including: adding a second node to the distributed training group to restore the working process from a paused state to a running state; triggering the distributed training group to perform elastic expansion so that the working process runs on the newly added second node.
[0010] Optionally, adding a second node to the distributed training group includes: determining whether there is a preemptible instance resource in the resource pool that matches a preset resource preemption policy; if so, creating a preemptible instance node in the resource pool as the second node; and adding the second node to the distributed training group.
[0011] Optionally, it also includes: if there is no preemptible instance resource in the resource pool that matches the preset resource preemption policy, then according to the training task volume of the work process, creating at least one on-demand instance node in the resource pool as the second node; and adding the second node to the distributed training group.
[0012] Optionally, based on the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, the distributed training group is controlled to elastically expand the training task, including: if the preemptible instance resources in the resource pool meet the preset resource preemption policy, a third node is created in the resource pool, and the third node is a preemptible instance node; the third node is added to the distributed training group, and the distributed training group is triggered to perform elastic expansion to reallocate the training task based on the distributed training group after the newly added node.
[0013] Optionally, the method further includes: monitoring a recycling event of a preemptible instance node in the resource pool; if it is monitored that any preemptible instance node in the resource pool is recycled, determining that the usage status of the preemptible instance node is an unavailable status.
[0014] An embodiment of the present application also provides a training system, comprising: an elastic training control component, a scheduling decision maker, an elastic scaling component, and a distributed training group; wherein, the distributed training group includes at least one preemptive instance node in a resource pool; wherein, the elastic training control component is used to: receive a training task and obtain the job type corresponding to the training task; use the scheduling decision maker to schedule the training task to the distributed training group corresponding to the job type, so that the distributed training group executes the training task based on the elastic training framework corresponding to the job type; and use the elastic scaling component to control the distributed training group to elastically expand or shrink the training task according to the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool.
[0015] An embodiment of the present application also provides a server, comprising: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to: execute the steps in the method provided in the embodiment of the present application.
[0016] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps of the method provided in the embodiment of the present application.
[0017] In an embodiment of the present application, the distributed training group executes the training task based on the elastic training framework, so that the working process of the training task can run on the instance node of the distributed training group. Since the elastic training framework supports the dynamic changes of the working process of the training task, the training process can support the dynamic changes in the number of distributed nodes required for training. On this basis, when the distributed training group contains preemptive instance nodes, the training task can be elastically expanded or shrunk in combination with the status of the preemptive instance nodes. Furthermore, while making full use of preemptive instances for training to reduce training costs, the training task can be automatically expanded or shrunk instead of terminated, which is beneficial to improving training quality and training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] FIG1 is a schematic diagram of the structure of a training system provided by an exemplary embodiment of the present application;
[0020] FIG2 is a schematic structural diagram of an elasticity training control component provided by an exemplary embodiment of the present application;
[0021] FIG3 is a schematic diagram of an elastic expansion and contraction process provided by an exemplary embodiment of the present application;
[0022] FIG4 is a flow chart of a training method provided by an exemplary embodiment of the present application;
[0023] FIG5 is a schematic diagram of the structure of a server provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0024] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0025] The terms used in the embodiments of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The singular forms "a," "the," and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. "A plurality" generally includes at least two, but does not exclude the inclusion of at least one.
[0026] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.
[0027] It should also be noted that the terms "include," "comprises," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a product or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such product or system. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the product or system comprising the element.
[0028] In a training solution based on preemptible instances, when users submit training tasks, they can specify the use of preemptible instance resources for training. In this solution, when a preemptible instance is about to be reclaimed, the training state can be saved. When the price or inventory of the preemptible instance meets the user's specified requirements again, the training task can be automatically restarted to complete the task. However, in this solution, when preemptible resources are limited, the user's training task may still not be executed, resulting in reduced training efficiency.
[0029] In response to the technical problem in the prior art that it is impossible to balance training cost and training quality, a solution is provided in some embodiments of the present application. The technical solutions provided in each embodiment of the present application are described in detail below with reference to the accompanying drawings.
[0030] FIG1 is a schematic structural diagram of a training system provided by an exemplary embodiment of the present application. The training system can be deployed on a container cluster. As shown in FIG1 , the training system includes: an operation layer 10 , a scheduling layer 20 , and a resource layer 30 .
[0031] The operation layer 10 includes: at least one elastic training control component 101, and different elastic training control components correspond to different operation types.
[0032] The scheduling layer 20 includes a scheduling decision maker 201 and an elastic scaling component 202. The elastic scaling component 202 may include the cluster automatic scaling service and the elastic scaling service as shown in FIG1.
[0033] The resource layer 30 is used to provide a resource pool that can provide both preemptible instance resources and non-preemptible on-demand instance resources. An on-demand instance is an elastic container instance that is created and paid for based on user specifications and needs. A preemptible instance is a type of on-demand instance that is created through bidding and can be dynamically reclaimed. The price of a preemptible instance can be lower than a non-preemptible on-demand instance. The lifecycle of a non-preemptible on-demand instance is determined by the user's purchase duration. To simplify the description and facilitate distinction, the on-demand instances described in the following embodiments are non-preemptible on-demand instances, unless otherwise specified. Based on the resources provided by the resource layer 30, instance nodes can be created, and distributed training groups can be formed based on the instance nodes, such as the distributed training group 301 shown in Figure 1. A distributed training group can include multiple instance nodes, with each instance node corresponding to one elastic container instance. In this embodiment, to reduce training costs, a distributed training group can include at least one preemptible instance node.
[0034] Any distributed training group is used to execute training tasks based on a flexible training framework. A flexible training framework refers to a distributed training framework that can support dynamic changes in the number of worker processes participating in training. The flexible training framework is deployed on instance nodes in the distributed training group to implement flexible distributed training based on the computing resources provided by the distributed training group. The flexible training framework typically includes a control (or driver) process and worker processes. The control process can run on a CPU (Central Processing Unit) instance node, while the worker process can run on a CPU or GPU (Graphics Processing Unit) instance node. In the flexible distributed training framework, worker processes are primarily responsible for executing assigned training tasks. The control process is primarily responsible for assigning tasks to available worker processes and detecting changes in existing worker processes in real time, such as detecting process disconnections. The control process can also be used to monitor host changes in real time. If a new host joins, a new worker process can be generated on the new host and a new communication loop can be established between the new worker process and the existing worker process. In this embodiment, the host used to deploy the elastic training framework is provided by the instance node in the resource pool, that is, the control and work of the elastic training framework are run on the instance node, and the instance node may include at least one of a preemptive instance node and an on-demand instance node.
[0035] Based on the above training system, we can provide users with low-cost, high-quality AI training services. The following is an example.
[0036] Figure 2 illustrates the structure of the elastic training control component, which is primarily used to control the resources it manages through monitoring and management. As shown in Figure 2, the elastic training control component includes a set of training controllers: a training task controller, a scaling controller, and an expansion controller.
[0037] The scaling controller is responsible for managing the lifecycle of training tasks. The scaling controller and scaling controller are responsible for managing the elastic scaling of training tasks. Elastic scaling of training tasks includes elastic scaling up and scaling down. Elastic scaling refers to launching the worker processes of a training task on more instance nodes. That is, using more instance nodes to execute the training task expands the number of resources available for executing the training task, thereby improving training efficiency. Elastic scaling refers to terminating the worker processes of a deployed training task from one or more instance nodes to reduce the number of resources available for executing the training task. A training task can be split into multiple subtasks, and any worker thread can execute one or more subtasks of a training task. Elastic scaling up a training task means increasing the number of instance nodes used to run the worker threads of the training task; elastic scaling down a training task means reducing the number of instance nodes used to run the worker threads of the training task. This allows the training task to tolerate the recycling of preemptible instance resources, while reducing training costs, while improving training quality.
[0038] The launcher shown in Figure 2 is used to create a container (application container) and obtain an elastic container instance. As shown in Figure 2, the launcher is used to start one or more initialization containers before creating an application container in a POD (the smallest deployable unit in the container engine) to complete the initialization and verification of the pre-conditions required for the application container. When the elastic container instance is recycled or created, the launcher can update the host file to trigger the elastic scaling operation of the training task. As shown in Figure 2, multiple working processes of the elastic training framework can be run on the distributed training group. Any working process runs in the container of the POD and is configured as a headless service (Headless Services) for external search. The keys (public and private keys) shown in Figure 2 are used to log in and authenticate container users to improve the security of container use. Among them, the expansion component can create a new elastic container instance through the launcher and start the working process of the training task on the new elastic instance to achieve elastic scaling of the training task.
[0039] In some embodiments, the resource layer 30 may include multiple different distributed training groups. Different distributed training groups may perform different types of training tasks based on the same or different elastic training frameworks. In the training system, any elastic training control component 101 is used to receive a training task, obtain the job type corresponding to the training task, and use the scheduling decision maker 201 to schedule the training task to the distributed training group corresponding to the job type for training. The distributed training group is used to execute the training task based on the elastic training framework corresponding to the job type.
[0040] During the execution of training. The elastic training control component 101 can use the elastic scaling component 202 to control the distributed training group to elastically expand or shrink the training task according to the usage status of at least one preemptible instance node in the distributed training group and / or the availability of the preemptible instance resources in the resource pool. Among them, the availability of the preemptible instance resources in the resource pool means that the preemptible instance resources in the resource pool meet the preset resource preemption policy, and the preset resource preemption policy can be used to describe at least one of the instance type, instance specification, region (Region), availability zone (Availability Zone) and bidding price. For example, when a certain type of preemptible instance resource in the resource pool meets the user's instance specification requirements, the inventory is sufficient, and the price is lower than the bidding price set by the user, it is determined that the preemptible instance resource is available.
[0041] The usage status of any node includes: available or unavailable. For on-demand instance nodes, their usage status is available from the moment they are created. If the lifecycle of an on-demand instance node ends, their usage status becomes unavailable. For preemptible instance nodes, when a preemptible instance node is created because it meets the user's bid price, the preemptible instance node is in available status. When a preemptible instance node is recycled due to price fluctuations or insufficient inventory, the preemptible instance node becomes unavailable.
[0042] In some embodiments, when the usage status of a preemptible instance node or an on-demand instance node in a distributed training group is unavailable, the elastic training control component 101 can use the elastic scaling component 202 to control the distributed training group to elastically scale down the training task. During elastic scaling, the working process of the running training task on the unavailable instance node can be terminated to remove the training task from the instance node.
[0043] In other embodiments, after elastic scaling, if there are available preemptible instance resources in the resource pool, the elastic training control component 101 can use the elastic scaling component 202 to control the distributed training group to elastically scale the training task. During elastic scaling, a preemptible instance node can be created based on the available preemptible instance resources, and a working process for the training task can be started on the preemptible instance node to deploy the training task to the preemptible instance node.
[0044] In some other embodiments, without performing elastic scaling, if there are available preemptible instance resources in the resource pool, the elastic training control component 101 can use the elastic scaling component 202 to control the distributed training group to elastically scale the training task, so as to add more low-cost preemptible instance nodes in the distributed training group.
[0045] Optionally, the usage status of the preemptive instance node in the above embodiment can be monitored by the job supervision component 102 in the job layer 10, as shown in Figure 1. The job supervision component 102 can provide timely termination capability, release notification capability, observability, failover capability, fault tolerance capability, and scaleout capability for training tasks. Among them, the observability capability for training tasks refers to the ability of the job supervision component 102 to detect the running status of the training task, thereby providing feedback information to the user in a timely manner. Among them, the failover capability for training tasks refers to the ability of the job supervision component 102 to restart the work process and continue to execute the training task after part of the work process of the training task ends abnormally. Among them, the fault tolerance capability for training tasks refers to the ability of the job supervision component 102 to restore the training task on the faulty node after a part of the nodes of the training task fails.
[0046] In this embodiment, the job supervision component 102 is primarily configured to monitor the recycling of preemptible instance nodes in the resource pool. If any preemptible instance node in the resource pool is detected to be recycled, the preemptible instance node's usage status is determined to be unavailable. Furthermore, when any preemptible instance node in the distributed training group is recycled, the job supervision component 102 triggers the elastic training control component 101 to elastically scale down the training task.
[0047] In this embodiment, the distributed training group executes the training task based on the elastic training framework, so that the working process of the training task can run on the instance node of the distributed training group. Since the elastic training framework supports the dynamic changes of the working process of the training task, the training process can support the dynamic changes in the number of distributed nodes required for training. On this basis, when the distributed training group contains preemptive instance nodes, the training task can be elastically expanded or shrunk in combination with the status of the preemptive instance nodes. Furthermore, while making full use of preemptive instances for training to reduce training costs, the training task can be automatically expanded or shrunk instead of terminated, which is beneficial to improving training quality and training efficiency.
[0048] The following will take the recycling of any preemptible instance node (for example, the first node) in the distributed training group as an example to illustrate the elastic scaling of training tasks.
[0049] In some exemplary embodiments, if the distributed training group includes at least one preemptive instance node, and the first node is updated to an unavailable state, the elastic training control component may trigger the distributed training group to perform elastic scaling to reallocate the training task based on the remaining available nodes in the distributed training group. In this embodiment, the elastic training control component may monitor changes in the work processes running on the distributed training group. After the first node is recycled, the work process on the first node is deleted. When the elastic training control component monitors that the work process is deleted, it may update the host file (hostfile) of the elastic training framework. The control process running on the distributed training group may sense that the work process is offline by reading the host file, and may start the elastic scaling process to reallocate the training tasks according to the remaining work processes. During the elastic scaling process, the control process may notify the remaining work processes to restart, and rebuild the distributed training group based on the restarted work processes.
[0050] Optionally, after the first node is recycled, the elastic training control component may determine whether to restart the working process on the first node based on the preset training configuration information. The training configuration information may be set by the user, and the user may submit the training configuration information together when submitting a training task. The configuration information may be used to configure at least one of the node quantity threshold (including the upper quantity threshold and / or the lower quantity threshold) required for the training task, the resource preemption strategy, the on-demand resource replenishment strategy, and the processing strategy after the preemptive instance resources are recycled. The processing strategy after the preemptive instance resources are recycled may include: ending the process on the preemptive instance resources or restarting the process on the preemptive instance resources.
[0051] If the elastic training control component determines, based on the processing policy after the preemptible instance resources are reclaimed, that the working process on the first node should be restarted after the first node is reclaimed, the working process can be set to a pending state. In this case, the elastic training control component can add new nodes to the distributed training group based on the resource availability in the resource pool and the user-configured on-demand resource replenishment policy. In other words, after the training task is elastically scaled down, the elastic training control component can elastically scale up the training task again to replenish computing power.
[0052] Optionally, when the elastic training control component controls the distributed training group to elastically expand the training task, it can add a second node to the distributed training group, restore the working process on the first node from a paused state to a running state, and trigger the distributed training group to perform elastic expansion so that the working process runs on the newly added second node.
[0053] In this embodiment, after the work process returns to the running state, the elastic training control component can monitor changes in the work process and update the host file of the elastic training framework. The control process running on the distributed training group can sense that the work process is online again by reading the host file and can initiate the elastic expansion process to redistribute training tasks according to the expanded work process. During the elastic expansion process, the control process can notify the newly added and the original remaining work processes to restart, so that the newly added work processes can join the distributed training group.
[0054] The second node can be a preemptible instance node determined based on the preemptive instance resource preemption policy and resource availability in the resource pool, or an on-demand instance node determined based on a user-configured on-demand resource replenishment policy.
[0055] In some optional embodiments, the elastic training control component can determine whether there are preemptible instance resources in the resource pool that match the preset resource preemption policy; if so, a preemptible instance node can be created in the resource pool as a second node, and the second node can be added to the distributed training group. The resource preemption policy can be used to describe at least one of the instance type, instance specification, region, availability zone, and bidding price. The elastic training control component can monitor whether there are available preemptible instance resources in the resource pool based on the resource preemption policy. When configuring the resource preemption policy, multiple different instance types, multiple different regions, and multiple different availability zones can be configured to improve the availability of preemptible resources.
[0056] Optionally, if there are no preemptible instance resources in the resource pool that match the preset resource preemption policy, the elastic training control component may create at least one on-demand instance node in the resource pool as a second node based on the training task volume of the working process on the recycled first node, and add the second node to the distributed training group.
[0057] The following will be further illustrated in conjunction with Figure 3. As shown in Figure 3, training task-01 is deployed on the distributed training group and is in a running state. The distributed training group includes a launcher process and three running worker processes. When a preemptible instance node in the distributed training group is recycled, the node is in an unavailable state, and accordingly, the worker process on the node is deleted. As shown in Figure 3, the elastic training control component can trigger the distributed training group to perform elastic scaling by updating the host file. At this time, the job status of the training task is still in a running state. As shown in 3, if the deleted process needs to be restarted, the elastic training control component can restart the worker process and set the worker process to a paused state. At this time, the job status of the training task is a running state. When a preemptible instance node or an on-demand instance node is added to the distributed training group, as shown in Figure 3, the elastic training control component can update the host file again to trigger the distributed training group to perform elastic scaling. The worker process in a paused state will be restored to a running state. At this time, the job status of the training task is still in a running state.
[0058] In this implementation, on the one hand, on-demand instances can be automatically replenished when preemptible instances are not available to improve the availability of training tasks. On the other hand, on-demand instance nodes are created according to the amount of training tasks, which is conducive to replenishing instances according to training needs, thereby saving training costs.
[0059] The preceding embodiments describe elastic scaling after a preemptible instance node in a distributed training group is recycled, and elastic scaling after elastic scaling. In some optional embodiments, if no node recycling occurs in the distributed training group, elastic scaling can also be performed based on available preemptible instance resources. This is exemplified below.
[0060] Optionally, when the elastic training control component controls the distributed training group to elastically scale out training tasks based on the usage status of the nodes in the distributed training group, it may create a preemptible instance node in the resource pool as a third node when the preemptible instance resources in the resource pool meet a preset resource preemption policy. The elastic training control component may add the third node to the distributed training group and trigger elastic scaling of the distributed training group to redistribute training tasks based on the distributed training group after the addition of the node.
[0061] Based on this implementation method, when no node recycling occurs in the distributed training group, elastic expansion is performed based on the available preemptible instance resources in the resource pool, and the training computing power can be increased at a lower training cost, thereby improving training quality and training efficiency.
[0062] FIG4 is a flow chart of a training method provided by an exemplary embodiment of the present application. The method may include the steps shown in FIG4 :
[0063] Step 401: Receive a training task and obtain the job type corresponding to the training task.
[0064] Step 402: Schedule the training task to the distributed training group corresponding to the job type for training; the distributed training group is used to execute the training task based on the elastic training framework corresponding to the job type; the distributed training group includes at least one preemptive instance node in the resource pool.
[0065] Step 403: Control the distributed training group to elastically expand or shrink the training task according to the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool.
[0066] In some exemplary embodiments, a method of elastically scaling down the training task within the distributed training group based on the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool includes: if the first node of the at least one preemptible instance node is updated to an unavailable state, triggering the distributed training group to perform elastic scaling to reallocate the training task based on the remaining available nodes in the distributed training group.
[0067] In some exemplary embodiments, the method further includes: judging whether to restart the working process on the first node according to preset training configuration information; if yes, restarting the working process and setting the working process to a paused state; accordingly, according to the usage status of the at least one preemptive instance node and / or the availability of preemptive instance resources in the resource pool, controlling the distributed training group to elastically expand the training task in a manner including: adding a second node to the distributed training group to restore the working process from a paused state to a running state; triggering the distributed training group to perform elastic expansion so that the working process runs on the newly added second node.
[0068] In some exemplary embodiments, a method of adding a second node to the distributed training group includes: determining whether there is a preemptible instance resource in the resource pool that matches a preset resource preemption policy; if so, creating a preemptible instance node in the resource pool as the second node; and adding the second node to the distributed training group.
[0069] In some exemplary embodiments, the method further includes: if there is no preemptible instance resource in the resource pool that matches the preset resource preemption policy, then according to the training task volume of the work process, creating at least one on-demand instance node in the resource pool as the second node; and adding the second node to the distributed training group.
[0070] In some exemplary embodiments, a method of controlling the distributed training group to elastically expand the training task based on the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool includes: if the preemptible instance resources in the resource pool meet the preset resource preemption policy, creating a third node in the resource pool, and the third node is a preemptive instance node; adding the third node to the distributed training group, and triggering the distributed training group to perform elastic expansion, so as to reallocate the training task based on the distributed training group after the newly added node.
[0071] In some exemplary embodiments, the method further includes: monitoring the recycling event of the preemptible instance node in the resource pool; if it is monitored that any preemptible instance node in the resource pool is recycled, determining that the usage status of the preemptible instance node is unavailable.
[0072] In this embodiment, the distributed training group executes the training task based on the elastic training framework, so that the working process of the training task can run on the instance node of the distributed training group. Since the elastic training framework supports the dynamic changes of the working process of the training task, the training process can support the dynamic changes in the number of distributed nodes required for training. On this basis, when the distributed training group contains preemptive instance nodes, the training task can be elastically expanded or shrunk in combination with the status of the preemptive instance nodes. Furthermore, while making full use of preemptive instances for training to reduce training costs, the training task can be automatically expanded or shrunk instead of terminated, which is beneficial to improving training quality and training efficiency.
[0073] It should be noted that the execution entity of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution entity of steps 401 to 404 can be device A; for another example, the execution entity of steps 401 and 402 can be device A, and the execution entity of step 403 can be device B; and so on.
[0074] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The sequence numbers of the operations, such as 401, 402, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to being different types.
[0075] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0076] FIG5 is a schematic diagram illustrating the structure of a server provided by an exemplary embodiment of the present application, which is applicable to the training system provided by the aforementioned embodiment. As shown in FIG5 , the server includes: a memory 501 , a processor 502 , and a communication component 503 .
[0077] The memory 501 is used to store computer programs and can be configured to store various other data to support operations on the server, such as instructions for any application or method used to operate on the server.
[0078] The processor 502 is coupled to the memory 501 and is used to execute the computer program in the memory 501, so as to: receive a training task and obtain the job type corresponding to the training task; schedule the training task to a distributed training group corresponding to the job type for training; the distributed training group is used to execute the training task based on the elastic training framework corresponding to the job type; the distributed training group includes at least one preemptive instance node in a resource pool; and according to the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool, control the distributed training group to elastically expand or shrink the training task.
[0079] In some exemplary embodiments, when the processor 502 elastically scales down the training task within the distributed training group based on the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool, it is specifically used to: if the first node of the at least one preemptive instance node is updated to an unavailable state, trigger the distributed training group to perform elastic scaling to reallocate the training task based on the remaining available nodes in the distributed training group.
[0080] In some exemplary embodiments, the processor 502 is further used to: determine whether to restart the working process on the first node based on preset training configuration information; if so, restart the working process and set the working process to a paused state. Accordingly, when the processor 502 controls the distributed training group to elastically expand the training task based on the usage status of the at least one preemptive instance node and / or the availability of preemptive instance resources in the resource pool, it is specifically used to: add a second node to the distributed training group, restore the working process from a paused state to a running state; trigger the distributed training group to perform elastic expansion so that the working process runs on the newly added second node.
[0081] In some exemplary embodiments, when the processor 502 adds a second node to the distributed training group, it is specifically used to: determine whether there is a preemptive instance resource in the resource pool that matches the preset resource preemption policy; if so, create a preemptive instance node in the resource pool as the second node; and add the second node to the distributed training group.
[0082] In some exemplary embodiments, the processor 502 is further used to: if there is no preemptible instance resource in the resource pool that matches the preset resource preemption policy, then according to the training task volume of the work process, create at least one on-demand instance node in the resource pool as the second node; and add the second node to the distributed training group.
[0083] In some exemplary embodiments, when the processor 502 controls the distributed training group to elastically expand the training task based on the usage status of the at least one preemptive instance node and / or the availability of the preemptive instance resources in the resource pool, it is specifically used to: if the preemptible instance resources in the resource pool meet the preset resource preemption policy, create a third node in the resource pool, and the third node is a preemptive instance node; add the third node to the distributed training group, and trigger the distributed training group to perform elastic expansion, so as to reallocate the training task based on the distributed training group after the newly added node.
[0084] In some exemplary embodiments, the processor 502 is further used to: monitor the recycling event of the preemptible instance node in the resource pool; if it is monitored that any preemptible instance node in the resource pool is recycled, determine that the usage status of the preemptible instance node is unavailable.
[0085] Furthermore, as shown in Figure 5 , the server also includes other components such as a power supply component 504. Figure 5 only schematically illustrates some components, which does not mean that the server only includes the components shown in Figure 5 .
[0086] Among them, the memory 501 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0087] The communication component 503 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as Wi-Fi (wireless network communication technology), 2G (such as Global System for Mobile Communications (GSM)), 3G (such as Wideband Code Division Multiple Access (WCDMA), 4G (such as Long Term Evolution (LTE)), 4G+ (such as upgraded Long Term Evolution (LTE-Advanced, LTE-A)), or 5G (5th Generation Mobile Communication Technology), or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0088] The power supply component 504 is used to provide power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.
[0089] In this embodiment, the distributed training group executes the training task based on the elastic training framework, so that the working process of the training task can run on the instance node of the distributed training group. Since the elastic training framework supports the dynamic changes of the working process of the training task, the training process can support the dynamic changes in the number of distributed nodes required for training. On this basis, when the distributed training group contains preemptive instance nodes, the training task can be elastically expanded or shrunk in combination with the status of the preemptive instance nodes. Furthermore, while making full use of preemptive instances for training to reduce training costs, the training task can be automatically expanded or shrunk instead of terminated, which is beneficial to improving training quality and training efficiency.
[0090] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be executed by the server in the above method embodiment.
[0091] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM (Compact Disc Read-Only Memory), optical storage, etc.) containing computer-usable program code.
[0092] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0093] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0094] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0095] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.
[0096] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0097] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, Parallel Random Access Machine (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, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0098] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0099] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A training method, characterized in that: include: Receive a training task and obtain a job type corresponding to the training task; The training task is dispatched to a distributed training group corresponding to the job type for training; the distributed training group is used to execute the training task based on an elastic training framework corresponding to the job type; the distributed training group includes at least one preemptible instance node in a resource pool; According to the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, the distributed training group is controlled to elastically expand or shrink the training task.
2. The method according to claim 1, characterized in that According to the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, elastically scaling down the training task in the distributed training group includes: If a first node among the at least one preemptible instance node is updated to an unavailable state, the distributed training group is triggered to perform elastic scaling to reallocate the training task based on the remaining available nodes in the distributed training group.
3. The method according to claim 2, characterized in that Also includes: Determine whether to restart the working process on the first node according to the preset training configuration information; If yes, restart the working process and set the working process to a paused state; According to the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, controlling the distributed training group to elastically expand the training task includes: Adding a second node to the distributed training group and resuming the working process from a paused state to a running state; The distributed training group is triggered to perform elastic expansion so that the work process runs on the newly added second node.
4. The method according to claim 3, characterized in that Adding a second node to the distributed training group includes: Determine whether there is a preemptible instance resource matching a preset resource preemption strategy in the resource pool; If yes, creating a preemptible instance node in the resource pool as the second node; The second node is added to the distributed training group.
5. The method according to claim 4, characterized in that Also includes: If there is no preemptible instance resource matching the preset resource preemption policy in the resource pool, at least one on-demand instance node is created in the resource pool as the second node according to the training task amount of the work process; The second node is added to the distributed training group.
6. The method according to any one of claims 1 to 5, characterized in that: According to the usage status of the at least one preemptible instance node and / or the availability of the preemptible instance resources in the resource pool, controlling the distributed training group to elastically expand the training task includes: If the preemptible instance resources in the resource pool meet the preset resource preemption strategy, create the first Three nodes, the third node is a preemptible instance node; The third node is added to the distributed training group, and the distributed training group is triggered to perform elastic expansion, so as to reallocate the training tasks based on the distributed training group after the newly added node.
7. The method according to any one of claims 1 to 5, characterized in that: Also includes: Monitoring the recycling events of the preemptible instance nodes in the resource pool; If it is monitored that any preemptible instance node in the resource pool is recycled, it is determined that the use status of the preemptible instance node is an unavailable status.
8. A training system, characterized in that: include: Elastic training control components, scheduling decision makers, elastic scaling components, and distributed training groups; Wherein, the distributed training group includes at least one preemptible instance node in a resource pool; Among them, the elastic training control component is used to: receive a training task and obtain the job type corresponding to the training task; use the scheduling decision maker to schedule the training task to the distributed training group corresponding to the job type, so that the distributed training group performs the training task based on the elastic training framework corresponding to the job type; and use the elastic scaling component to control the distributed training group to elastically expand or shrink the training task according to the usage status of at least one preemptive instance node and / or the availability of preemptive instance resources in the resource pool.
9. A server, characterized in that: include: Memory and processor; The memory is used to store one or more computer instructions; The processor is configured to execute the one or more computer instructions to: perform the steps in the method according to any one of claims 1-8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it can implement the training method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Distributed task processing method, device, equipment, storage medium and system
CN112416591A
Task execution method and device, electronic equipment and computer storage medium
CN114490048A
Training method, device and system and storage medium
CN116578417A
Neural network scheduler
US20220180178A1
Distributed training method and apparatus of deep learning model
WO2022033024A1
Cited By
Deployment method for realizing distributed training on k8s by using heterogeneous GPU (Graphics Processing Unit)
CN119718554A
