Method, device, equipment and storage medium for fine-tuning model
Through the collaborative management of model fine-tuning tasks by proxy units and target work units, the interleaved scheduling strategies of distributed storage and multi-graphic processing units are used to solve the problems of complexity and low efficiency of model fine-tuning in the existing technology, and an efficient model fine-tuning process is realized.
Patent Information
- Application Number
- CN202411391800.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In the prior art, the model fine-tuning process requires in-depth understanding of the underlying hardware resources and machine configuration, resulting in high technical thresholds, cumbersome resource allocation and environment initialization, extending execution time and inefficient GPU utilization and long waiting time.
The agent unit receives the model fine-tuning task, determines the target work unit and submits the task. The target work unit obtains training data based on the distributed storage unit to perform fine-tuning, and stores the updated model parameters to the local storage unit. The agent unit is asynchronously uploaded to the distributed storage unit, and uses multiple graphics processing units to execute tasks in parallel, and uses interleaved scheduling strategies to improve efficiency.
It reduces users' understanding of the underlying hardware and system configuration, simplifies the task submission process, improves the efficiency and overall performance of model fine-tuning, and reduces the cost of code writing.
Smart Images

Figure CN119227838B_ABST
Abstract
Description
Technical Field
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to a method, apparatus, device, and computer-readable storage medium for fine-tuning a model. Background Art
[0002] With the rapid development of artificial intelligence (AI), large-scale models are increasingly being used in a variety of applications. Model fine-tuning is a technique in machine learning that involves additional training of a model that has been pre-trained on a large dataset to adapt it to a specific task or dataset. This process, typically performed after the model's pre-training phase, aims to adjust the model's weights to optimize it for the target task. However, efficiently fine-tuning models has become a technical challenge. Summary of the Invention
[0003] In a first aspect of the present disclosure, a method for fine-tuning a model is provided. The method includes: an agent unit receiving a model fine-tuning task from a user; the agent unit determining a target work unit for executing the model fine-tuning task and submitting the model fine-tuning task to the target work unit, wherein the target work unit is associated with multiple graphics processing units; the target work unit executing the model fine-tuning task based on training data obtained from a distributed storage unit; and the target work unit storing updated model parameters in a local storage unit, thereby triggering the agent unit to upload the model parameters from the local storage unit to the distributed storage unit.
[0004] In a second aspect of the present disclosure, a system for model fine-tuning is provided. The system includes: an agent configured to receive a model fine-tuning task from a user; determine a target work unit for executing the model fine-tuning task, and submit the model fine-tuning task to the target work unit, wherein the target work unit is associated with multiple graphics processing units; and the target work unit is configured to execute the model fine-tuning task based on training data obtained from a distributed storage unit; and store updated model parameters in a local storage unit, thereby triggering the agent to upload the model parameters from the local storage unit to the distributed storage unit.
[0005] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. When executed by the at least one processing unit, the instructions cause the device to perform the method of the first aspect.
[0006] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.
[0007] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer-executable instructions, wherein the computer-executable instructions implement the method of the first aspect when executed by a processor.
[0008] It should be understood that the content described in this summary section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0010] Figure 1 shows an example architecture according to some embodiments of the present disclosure;
[0011] Figure 2 A flowchart illustrating an example process for fine-tuning a model according to some embodiments of the present disclosure;
[0012] Figures 3A to 3C A schematic diagram illustrating a scheduling method according to some embodiments of the present disclosure is shown;
[0013] Figure 4 A schematic diagram illustrating an example system in which embodiments according to the present disclosure may be implemented; and
[0014] Figure 5 A block diagram of an electronic device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0015] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0016] It should be noted that the titles of any section / subsection provided herein are not limiting. Various embodiments are described throughout this document, and any type of embodiment may be included under any section / subsection. Furthermore, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or in different sections / subsections.
[0017] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.
[0018] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects shall comply with the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user is aware of and confirms them. Accordingly, when implementing the various embodiments of the present disclosure, the types, scope of use, and usage scenarios of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method may vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.
[0019] If this specification and the solutions in the examples involve the processing of personal information, such processing will be done only with a legitimate basis (such as with the consent of the subject of personal information or as necessary for the performance of a contract) and only within the prescribed or agreed scope. A user's refusal to process personal information other than that required for basic functions will not affect the user's use of basic functions.
[0020] As mentioned above, model fine-tuning is a technique in machine learning that involves additional training of a model that has been pre-trained on a large dataset to adapt it to a specific task or dataset. Traditionally, fine-tuning requires in-depth knowledge of the underlying hardware resources and machine configuration, which increases the technical barrier to entry and makes it difficult for non-expert system developers to participate.
[0021] Furthermore, traditional approaches require cumbersome and time-consuming resource allocation and environment initialization, which not only prolongs the total execution time of fine-tuning tasks but also adds additional system overhead. When faced with a large number of fine-tuning requests, traditional fine-tuning methods often struggle to effectively utilize limited computing resources, such as graphics processing units (GPUs), leading to inefficient GPU utilization and long queue waiting times.
[0022] Embodiments of the present disclosure provide a model fine-tuning solution. The solution includes: an agent unit receiving a model fine-tuning task from a user; the agent unit determining a target work unit for executing the model fine-tuning task and submitting the model fine-tuning task to the target work unit, where the target work unit is associated with multiple graphics processing units; the target work unit executing the model fine-tuning task based on training data obtained from a distributed storage unit; and the target work unit storing updated model parameters in a local storage unit, thereby triggering the agent unit to upload the model parameters from the local storage unit to the distributed storage unit.
[0023] In this way, embodiments of the present disclosure enable developers to easily submit and manage fine-tuning tasks without having to deeply understand the complexity of the underlying hardware and system configuration. Thus, embodiments of the present disclosure can reduce users' code writing costs and improve the overall efficiency of model fine-tuning.
[0024] Various example implementations of this solution are described in detail below in conjunction with the accompanying drawings.
[0025] Example Architecture
[0026] Figure 1 1 shows a schematic diagram of an example architecture 100 according to some embodiments of the present disclosure. Figure 1 As shown, the architecture 100 may include an agent unit 130, a work unit 140, and a distributed storage unit 170, wherein the agent unit 130 may be associated with a control unit 150. The basic principle of each unit will be described below.
[0027] In some embodiments, the agent unit 130 may be configured to receive a model fine-tuning task 120 from the user 110. As an example, such a model fine-tuning task 120 may include a LoRA (Low-Rank Adaptation) fine-tuning task.
[0028] In some embodiments, the agent unit 130 may be deployed with only a central processing unit (CPU) and not a graphics processing unit (GPU). After receiving the model fine-tuning task 120 from the user 110, the agent unit 130 may start a new worker unit 140 to execute the model fine-tuning task 120, or assign the model fine-tuning task 120 to an already started worker unit 140.
[0029] Furthermore, the agent unit 130 may send the model scheduling task 120 to the worker unit 140 for execution. During task execution, the agent unit 130 may check the status of the task and collect task results from the worker unit 140 in real time.
[0030] Additionally, the agent unit 130 can also present task information of the model fine-tuning task 120 to the user 110, where the task information is determined based on the status data received from the worker unit 140. As an example, the agent unit 130 can display the training progress and performance indicators of the task (such as the remaining cycles and training loss), thereby providing a graphical interface for the user 110 to view the execution status of the task. In this way, the agent unit 130 can serve as the only component that interacts with the user 110, thereby reducing the complexity of the model fine-tuning system and providing a more efficient low-code interface for task submission.
[0031] In some embodiments, the worker unit 140 may be associated with multiple graphics processing units (GPUs) 160 and may utilize the multiple GPUs 160 to execute tasks submitted by the agent unit 130 in parallel. When the worker unit 140 is started, it may load the initial parameters (e.g., initial weights) of the pre-trained model from the distributed storage unit 170 and store such initial parameters in the video memory of the multiple GPUs 160.
[0032] Furthermore, when agent unit 130 submits model fine-tuning task 120 to worker unit 140, worker unit 140 can load training data from distributed storage unit 170 and start the fine-tuning process. As will be described in detail below, worker unit 140 can use a task interleaving scheduling strategy to concurrently execute multiple model fine-tuning tasks to improve system efficiency.
[0033] During the fine-tuning process, the worker unit 140 is configured to perform forward and backward passes to update the model parameters. When the fine-tuning task is completed, the worker unit can store the fine-tuned model parameters in the local storage unit and trigger the agent unit 130 to upload the model parameters from the local storage unit to the distributed storage unit 170.
[0034] In some embodiments, the proxy unit 130 may be configured to asynchronously upload the model parameters from the local storage unit to the distributed storage unit 170 , which enables the worker unit 140 to execute the next model fine-tuning task without waiting for the model parameter upload to be completed.
[0035] In some embodiments, as Figure 1As shown, each work unit 140 may also be associated with a control unit 150. The control unit 150 may be used to manage the execution of the work unit 140 and the interaction between the work unit 140 and the agent unit 130. In the case where the work unit 140 executes multiple tasks concurrently, the control unit 150 is configured to decide which task to execute next. In addition, at the end of each step, the control unit 150 collects the outputs from the work unit 140, which may include the results of multiple tasks, and passes the results to the corresponding agent unit 130. Once a task is completed or terminated, the control unit 150 may clean up the resources used by the task and remove the task from the job queue of the work unit 140.
[0036] In some embodiments, distributed storage unit 170 can be a distributed file system, such as HDFS. For example, distributed storage unit 170 can provide shared storage for the entire architecture 100. Distributed storage unit 170 can store the weights of all supported pre-trained models. Additionally, user 110 can upload training data to distributed storage unit 170 to perform model fine-tuning tasks and obtain a checkpoint of the fine-tuned model after the task is completed.
[0037] It will be understood that the structure and function of each element in the environment are described for illustrative purposes only and do not imply any limitation on the scope of the present disclosure.
[0038] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0039] Example Process
[0040] Figure 2 FIG2 is a flow chart showing an example process 200 for fine-tuning a model according to some embodiments of the present disclosure. The process 200 may be implemented at the system 100. Figure 1 2. Process 200 will be described.
[0041] like Figure 2 As shown, at block 210 , the agent unit 130 receives the model fine-tuning task 120 from the user 110 .
[0042] As reference Figure 1 As shown and described, the agent unit 130 can provide a task upload interface for the user 110 to receive the model fine-tuning task 120.
[0043] In some embodiments, the model fine-tuning task 120 sent by user 110 may specify at least one of the following: the model to be fine-tuned; the path to the training data; or a set of hyperparameters. For example, the model fine-tuning task 120 may specify a pre-trained base model. Additionally, the model fine-tuning task 120 may also specify the path to the distributed storage unit 170 where the training data is stored. Furthermore, the model fine-tuning task 120 may also specify one or more hyperparameters, such as LoRa configuration, learning rate, batch size, and maximum number of epochs. This allows users to focus on the fine-tuning process without worrying about the underlying infrastructure, resulting in a more streamlined task submission.
[0044] In block 220, the agent unit 130 determines the target work unit 140 for executing the model fine-tuning task and submits the model fine-tuning task to the target work unit 130. Figure 1 As depicted, the target work unit 130 may be associated with multiple GPUs 160 .
[0045] In some embodiments, the agent unit 130 may determine whether a set of currently enabled candidate work units is suitable for executing the model fine-tuning task 120 based on the working status of the set of candidate work units. For example, the agent unit 130 may determine whether the set of candidate work units is suitable for executing the to-be-assigned model fine-tuning task 120 based on the computing resource usage of the set of candidate work units.
[0046] In some embodiments, if a specific enabled candidate work unit is suitable for executing the model fine-tuning task 120, the agent unit 130 may assign the to-be-model-fine-tuning task 120 to the candidate work unit. Conversely, if the set of candidate work units is determined to be unsuitable for executing the model fine-tuning task, the agent unit 130 may trigger the startup of a new work unit as the target work unit.
[0047] As reference Figure 1 As described, when the working unit 140 is started, the initial parameters (e.g., initial weights) of the pre-trained model can be loaded from the distributed storage unit 170 , and such initial parameters can be stored in the video memory of the plurality of graphics processing units 160 .
[0048] In block 230 , the target work unit 140 performs the model fine-tuning task 120 based on the training data obtained from the distributed storage unit 170 .
[0049] In some embodiments, after receiving the model fine-tuning task 120 to be executed from the agent unit 130, the target work unit 140 can load the training data for the model fine-tuning task 120 from the distributed storage unit 170 based on the path indicated by the model fine-tuning task 120, and can start executing the fine-tuning process.
[0050] In some embodiments, as shown in FIG. Figure 1 As described, the target work unit 140 may also be configured to concurrently execute multiple model fine-tuning tasks, and the control unit 150 may be configured to schedule the execution of the multiple model fine-tuning tasks on multiple GPUs 160 .
[0051] In some embodiments, the control unit 150 may utilize a one forward one backward (1F1B) scheduling strategy. Figure 3A As shown, the 1F1B scheduling strategy may include three phases, namely, a warm-up phase 305 , a stabilization phase 310 , and a cool-down phase 315 .
[0052] During the warm-up phase 305, the worker 140 performs a forward pass of a portion of a mini-batch. To reduce the memory footprint of activations, the number of mini-batches in the pipeline during the warm-up phase 305 is limited to the pipeline parallelism. After the warm-up phase 305, the worker 140 may enter the stabilization phase 310, which may perform a forward pass followed by a backward pass, i.e., 1F1B.
[0053] Further, after completing all forward passes, the worker 140 may enter a cool-down phase 315 to perform the remaining backward passes. Idle (also known as bubbling) occurs when the worker 140 is in the warm-up phase 305 or the cool-down phase 315. Figure 3A As shown in Figure 1, staggered 1F1B scheduling reduces the bubble rate by dividing each stage into multiple virtual stages. For example, a single batch includes mini-batches numbered 0 to 7, where 0 to 3 constitute the first virtual stage and 4 to 7 constitute the second virtual stage. As the number of virtual stages increases, the pipeline can be flushed earlier, thereby reducing the idle rate of work units.
[0054] refer to Figure 3A As shown, according to the 1F1B scheduling scheme, the warm-up phase 305 and the cool-down phase 315 still exist and contain bubbles. In order to reduce the idle rate, the control unit 150 can also use a cross-scheduling strategy based on training batches.
[0055] Specifically, if Figure 3B As shown, the multiple model fine-tuning tasks may include, for example, a first task J1 and a second task J2. In response to the graphics processing unit 160 completing the stabilization phase 325 of the first training batch of the first task J1, the control unit 150 utilizes the graphics processing unit 160 to alternately perform the cooling phase of the first training batch of the first task J1 and the warm-up phase of the second training batch of the second task J2, thereby forming a longer stabilization phase 325.
[0056] like Figure 3B As shown, each training batch of the first task J1 and the second task J2 has 8 micro-batches, and uses a staggered 1F1B schedule with 2 virtual phases. Initially, the worker 140 can process the first training batch of the first task J1. Then, the worker can enter the warm-up phase and the steady-state phase in the order of the 1F1B schedule.
[0057] When the cooldown phase of the first training batch begins, the worker 140 can interleave it with the warmup phase of the next training batch of the second task J2. This interleaving continues until the worker 140 completes all micro-batches of the first task J1. Further, the worker 140 can switch to the steady-state phase of the second training batch of the second task J2 and repeat the process.
[0058] In this way, worker 140 can achieve a zero bubble rate except during the warm-up phase of the first global training batch. Furthermore, worker 140 maintains a 1F1B approach during the interleaved warm-up and cool-down phases, and the number of micro-batches in the pipeline remains constrained to the pipeline parallelism. In this way, embodiments of the present disclosure ensure that batch-level interleaved scheduling does not incur additional peak memory overhead for activations compared to 1F1B scheduling.
[0059] In some scenarios, when the training batch size of a task is too small, the number of micro-batches in each training batch may not be an integer multiple of the pipeline parallelism. In this case, interleaved 1F1B cannot be applied to each individual task, and batch-level interleaved scheduling cannot be used directly.
[0060] In some embodiments, the control unit 150 may further employ a micro-batch-based cross-scheduling strategy. Specifically, the control unit 150 may construct multiple logical training batches based on multiple model fine-tuning tasks, wherein at least one logical training batch includes micro-batches associated with at least two model fine-tuning tasks. Furthermore, the control unit 150 may schedule multiple GPUs 160 to execute the multiple model fine-tuning tasks based on the multiple logical training batches.
[0061] by Figure 3CAs an example, the work unit 140 includes 4 pipeline stages and 5 model fine-tuning tasks (J1, J2, J3, J4, J5). The first four tasks J1 to J4 have 2 micro-batches in each training batch, and J5 includes 4 micro-batches in each training batch. Since each task does not need to wait for the completion of the previous task, the work unit can execute multiple tasks concurrently. According to the micro-batch processing level interleaved scheduling strategy, the control unit 150 can combine J1, J2, J3, and J4 into a group and execute them in the same training batch. Thus, this group can include 8 micro-batches in each training batch, thereby realizing staggered 1F1B scheduling. Therefore, the micro-batch processing level interleaved scheduling can achieve zero bubble rate and improve system efficiency in the stable stage 335 after the warm-up stage 330, and is suitable for fine-tuning tasks with small batch sizes.
[0062] In some embodiments, during the process of constructing a logic training batch, the control unit 150 may also dynamically create a logic training batch based on the execution status of multiple model fine-tuning tasks. Specifically, the control unit 150 may determine whether the multiple model fine-tuning tasks include a target task, where a portion of the target task's micro-batches have been added to an existing logic training batch. If the multiple model fine-tuning tasks include the target task, the control unit 150 may add the remaining micro-batches of the target task to the target logic training batch to be scheduled for execution.
[0063] For example, task J includes 8 micro-batches, and its first 4 micro-batches have been added to the created logical training batch. Accordingly, when creating the next logical training batch, the control unit 150 can add the remaining 4 micro-batches of task J to the new logical training batch.
[0064] Furthermore, the control unit 150 may determine that the number of micro-batches added to the target logic training batch is less than a threshold (e.g., an upper limit). If the number does not reach the upper limit, the control unit 150 may further add at least one micro-batch to the target logic training batch based on the remaining training steps of the multiple model fine-tuning tasks. For example, the control unit 150 may preferentially add the micro-batch of the model fine-tuning task with the largest number of remaining training steps to the target logic training batch.
[0065] In this way, the embodiments of the present disclosure can further increase the proportion of staggered scheduling at the micro-batch processing level, thereby reducing the idle rate of the work unit.
[0066] In block 240 , the target work unit 140 stores the updated model parameters in the local storage unit to trigger the agent unit 130 to upload the model parameters from the local storage unit to the distributed storage unit 170 .
[0067] As reference Figure 1As described, when the fine-tuning task is completed, the working unit may store the fine-tuned model parameters in the local storage unit and trigger the agent unit 130 to upload the model parameters from the local storage unit to the distributed storage unit 170 .
[0068] In some embodiments, the proxy unit 130 may be configured to asynchronously upload the model parameters from the local storage unit to the distributed storage unit 170 , which enables the worker unit 140 to execute the next model fine-tuning task without waiting for the model parameter upload to be completed.
[0069] In this way, embodiments of the present disclosure enable developers to easily submit and manage fine-tuning tasks without having to deeply understand the complexity of the underlying hardware and system configuration. Thus, embodiments of the present disclosure can reduce users' code writing costs and improve the overall efficiency of model fine-tuning.
[0070] Example System
[0071] The embodiments of the present disclosure also provide corresponding systems for implementing the above methods or processes. Figure 4 1 is a schematic block diagram of an example system 400 in which embodiments of the present disclosure may be implemented. The system 400 may be implemented as or included in the environment 100. Each module / component in the system 400 may be implemented by hardware, software, firmware, or any combination thereof.
[0072] like Figure 4 As shown, the system 400 includes: an agent unit 410 is configured to: receive a model fine-tuning task from a user; and determine a target work unit for performing the model fine-tuning task, and submit the model fine-tuning task to the target work unit, wherein the target work unit is associated with multiple graphics processing units; and a target work unit 420 is configured to: perform the model fine-tuning task based on training data obtained from a distributed storage unit; and store the updated model parameters in the local storage unit to trigger the agent unit to upload the model parameters from the local storage unit to the distributed storage unit.
[0073] In some embodiments, the model fine-tuning task indicates at least one of: a model to be fine-tuned; a path to training data; and a set of hyperparameters.
[0074] In some embodiments, the agent unit 410 is further configured to: determine whether a set of currently enabled candidate work units are suitable for performing the model fine-tuning task; and trigger the startup of the target work unit in response to determining that a set of candidate work units are not suitable for performing the model fine-tuning task.
[0075] In some embodiments, the target work unit 420 is configured to: load initial parameters of the pre-trained model from the distributed storage unit in response to the target work unit being triggered to start; and store the initial parameters in the graphics memory of multiple graphics processing units.
[0076] In some embodiments, the proxy unit 410 is configured to asynchronously upload the model parameters from the local storage unit to the distributed storage unit, and the target work unit 420 allows the next model fine-tuning task to be executed without waiting for the model parameter upload to be completed.
[0077] In some embodiments, the system 400 also includes a target work unit configured to execute multiple model fine-tuning tasks concurrently. The system 400 also includes a control unit, and the target work unit is also associated with the control unit, which is configured to schedule the execution of multiple model fine-tuning tasks on multiple graphics processing units.
[0078] In some embodiments, the multiple model fine-tuning tasks include a first task and a second task, and the control unit is further configured to: in response to the image processing unit completing the stabilization phase of the first batch of the first task, use the graphics processing unit to cross-execute the cooling phase of the first batch of the first task and the warm-up phase of the second batch of the second task.
[0079] In some embodiments, the multiple model fine-tuning tasks include a first task and a second task, and the control unit is configured to: in response to the image processing unit completing the stabilization phase of the first training batch of the first task, use the graphics processing unit to interleave the cooling phase of the first training batch of the first task and the warm-up phase of the second training batch of the second task.
[0080] In some embodiments, the control unit is configured to: construct a plurality of logical training batches based on a plurality of model fine-tuning tasks, wherein at least one logical training batch includes micro-batches associated with at least two model fine-tuning tasks; and schedule a plurality of graphics processing units to execute the plurality of model fine-tuning tasks based on the plurality of logical training batches.
[0081] In some embodiments, the control unit is configured to: determine whether the multiple model fine-tuning tasks include a target task, and part of the micro-batches of the target task have been added to an existing logic training batch; in response to the multiple model fine-tuning tasks including the target task, add the remaining micro-batches of the target task to the target logic training batch to be scheduled for execution; and in response to the number of micro-batches added to the target logic training batch being less than a threshold, add at least one micro-batch to the target logic training batch based on the remaining number of training steps of the multiple model fine-tuning tasks.
[0082] In some embodiments, the agent unit 410 is further configured to present task information of the model fine-tuning task to the user, where the task information is determined based on the status data received from the target work unit.
[0083] like Figure 5 As shown, in some embodiments, electronic device 500 is in the form of a general-purpose electronic device. Components of electronic device 500 may include, but are not limited to, one or more processors or processing units 510, memory 520, storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. Processing unit 510 may be a real or virtual processor and is capable of performing various processes according to a program stored in memory 520. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to increase the parallel processing capabilities of electronic device 500.
[0084] The electronic device 500 typically includes a plurality of computer storage media. Such media can be any accessible media that can be obtained by the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and / or data and can be accessed within the electronic device 500.
[0085] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5 As shown in FIG, a magnetic disk drive for reading from or writing to a removable, non-volatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to a bus (not shown) by one or more data media interfaces. Memory 520 may include a computer program product 525 having one or more program modules configured to perform various methods or actions of various embodiments of the present disclosure.
[0086] The communication unit 540 enables communication with other electronic devices via a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.
[0087] Input device 550 may be one or more input devices, such as a mouse, keyboard, or trackball. Output device 560 may be one or more output devices, such as a display, a speaker, or a printer. Electronic device 500 may also communicate with one or more external devices (not shown) via communication unit 540 as needed, such as a storage device, a display device, or the like, with one or more devices that allow a user to interact with electronic device 500, or with any device that allows electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).
[0088] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
[0089] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0090] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0091] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0092] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple implementations of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part for a module, program segment or instruction, and a part for a module, program segment or instruction comprises one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.
[0093] While various implementations of the present disclosure have been described above, the foregoing description is intended to be illustrative, not exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is selected to best explain the principles of the implementations, their practical applications, or improvements to existing technologies, or to enable others skilled in the art to understand the various implementations disclosed herein.
Claims
1. A method for fine-tuning a model, comprising: The agent unit receives the model fine-tuning task from the user; The agent unit determines a target work unit for executing the model fine-tuning task, and submits the model fine-tuning task to the target work unit, wherein the target work unit is associated with a plurality of graphics processing units; The target work unit executes the model fine-tuning task based on the training data obtained from the distributed storage unit; as well as The target working unit stores the updated model parameters in the local storage unit to trigger the agent unit to upload the model parameters from the local storage unit to the distributed storage unit; The target work unit is configured to concurrently execute a plurality of model fine-tuning tasks, wherein the plurality of model fine-tuning tasks include a first task and a second task, and the target work unit is further associated with a control unit; the control unit is configured to: In response to the graphics processing unit completing the stabilization phase of the first training batch of the first task, interleavingly performing the cooling phase of the first training batch of the first task and the warming phase of the second training batch of the second task using the graphics processing unit, Wherein, during the stabilization phase, the target work unit performs a forward pass followed by a backward pass.
2. The method of claim 1, wherein the model fine-tuning task indicates at least one of the following: The model to be fine-tuned; The path of the training data; A set of hyperparameters.
3. The method according to claim 1, further comprising: Determining, by the agent unit, whether a set of currently enabled candidate work units are suitable for performing the model fine-tuning task; as well as In response to determining that the set of candidate work units are not suitable for performing the model fine-tuning task, the proxy unit triggers the startup of the target work unit.
4. The method according to claim 3, further comprising: In response to the target work unit being triggered to start, loading the initial parameters of the pre-trained model from the distributed storage unit; as well as The target work unit stores the initial parameters in the graphics memories of the multiple graphics processing units.
5. The method according to claim 1, wherein the agent unit is configured to asynchronously upload the model parameters from the local storage unit to the distributed storage unit, and the target work unit allows the next model fine-tuning task to be executed without waiting for the model parameter upload to be completed.
6. The method according to claim 1, wherein The control unit is configured to schedule execution of the plurality of model fine-tuning tasks on the plurality of graphics processing units.
7. The method according to claim 6, wherein the control unit is configured to: constructing a plurality of logical training batches based on the plurality of model fine-tuning tasks, wherein at least one logical training batch includes mini-batches associated with at least two model fine-tuning tasks; and The plurality of graphics processing units are scheduled to execute the plurality of model fine-tuning tasks based on the plurality of logical training batches.
8. The method according to claim 7, wherein constructing a plurality of logical training batches based on the plurality of model fine-tuning tasks comprises: Determining whether the plurality of model fine-tuning tasks include a target task, wherein a portion of the micro-batches of the target task have been added to the existing logical training batch; In response to the multiple model fine-tuning tasks including the target task, adding the remaining micro-batches of the target task to the target logic training batch to be scheduled for execution; as well as In response to the number of micro-batches added to the target logic training batch being less than a threshold, at least one micro-batch is added to the target logic training batch based on remaining training steps of the multiple model fine-tuning tasks.
9. The method according to claim 1, further comprising: The agent unit presents task information of the model fine-tuning task to the user, where the task information is determined based on the status data received from the target work unit.
10. A system for fine-tuning a model, comprising an agent unit and a target work unit, wherein: The agent unit is configured to: receive a model fine-tuning task from a user; determine a target work unit for executing the model fine-tuning task, and submit the model fine-tuning task to the target work unit, wherein the target work unit is associated with a plurality of graphics processing units; as well as The target work unit is configured to: perform the model fine-tuning task based on the training data obtained from the distributed storage unit; and storing the updated model parameters in the local storage unit to trigger the agent unit to upload the model parameters from the local storage unit to the distributed storage unit; The target work unit is configured to concurrently execute a plurality of model fine-tuning tasks, wherein the plurality of model fine-tuning tasks include a first task and a second task, and the target work unit is further associated with a control unit; the control unit is configured to: In response to the graphics processing unit completing the stabilization phase of the first training batch of the first task, interleavingly performing the cooling phase of the first training batch of the first task and the warming phase of the second training batch of the second task using the graphics processing unit, Wherein, during the stabilization phase, the target work unit performs a forward pass followed by a backward pass.
11. An electronic device comprising: at least one processing unit; as well as At least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 9 when executed by the at least one processing unit.
12. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 9.
13. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Deep learning task processing method and device and computer readable storage medium
CN112306623A
Distributed training and reasoning method, system and device based on artificial intelligence, and readable storage medium
CN114035937A
Deep neural network model parallel computing task asynchronous scheduling method
CN115994567A