Method and apparatus for accelerating model training, storage medium, and electronic device

By using unused sample data in the cache space for AI model training and delaying loading of target sample data on the hard disk, the slow training speed caused by the lack of data in the cache space is solved, and the utilization rate of GPU and model training efficiency are improved.

WO2025044317A1PCT designated stage expired Publication Date: 2025-03-06ZHEJIANG LAB
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/094596
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-25
Filing Date
2024-05-22
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

In the process of AI model training, when the target sample data is lacking in the cache space, data needs to be loaded from the hard disk, resulting in low GPU utilization and long training time.

Method used

Model training is performed by obtaining unused sample data in the cache space, and the sample data corresponding to the target identification in the delayed access queue is loaded from the hard disk to the cache space when the preset conditions are met.

Benefits of technology

This improves the speed of model training, reduces the time to obtain target sample data, and improves the utilization rate of GPU.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024094596_06032025_PF_FP_ABST
    Figure CN2024094596_06032025_PF_FP_ABST
Patent Text Reader

Abstract

A method and apparatus for accelerating model training, a storage medium, and an electronic device. The method comprises: determining identifiers of target sample data for model training as target identifiers (S100); when no sample data matching the target identifiers is present in a cache space, storing the target identifiers in a lazy access queue (S102); acquiring unused sample data in the cache space as target sample data, and using the target sample data to train a model (S104); when a preset condition is satisfied, acquiring from a hard disk sample data corresponding to at least some of the identifiers in the lazy access queue (S106); and loading the sample data acquired from the hard disk and corresponding to the at least some of the identifiers in the lazy access queue into the cache space (S108). When target sample data is not present in a cache, the target sample data is replaced with other unused sample data in the cache to increase the speed of model training, and the target sample data is lazily loaded into the cache, so as to reduce the time for acquiring the target sample data.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, storage medium and electronic device for accelerating model training Technical Field

[0001] The present disclosure relates to the field of computers, and in particular to a method, device, storage medium, and electronic device for accelerating model training. Background Art

[0002] With the development of artificial intelligence (AI) models, AI models are applied in various fields.

[0003] Summary of the Invention

[0004] The present disclosure provides a method, device, storage medium, and electronic device for accelerating model training.

[0005] This disclosure adopts the following technical solutions:

[0006] The present disclosure provides a method for accelerating model training, comprising:

[0007] Determine the identifier of the target sample data for model training as the target identifier;

[0008] When there is no sample data matching the target identifier in the cache space, storing the target identifier in a delayed access queue;

[0009] Acquire unused sample data in the cache space, and use the unused sample data to train the model;

[0010] When a preset condition is met, obtaining target sample data corresponding to at least part of the target identifiers in the delayed access queue from the hard disk;

[0011] The target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk is loaded into the cache space.

[0012] In some embodiments, storing the target identification in a delayed access queue comprises:

[0013] Determining whether the used storage space in the delayed access queue has reached a preset threshold;

[0014] In response to determining that the used storage space in the delayed access queue has not reached the preset threshold, storing the target identifier in the delayed access queue;

[0015] In response to determining that the used storage space in the delayed access queue reaches the preset threshold, obtaining unused sample data from the hard disk according to a preset ratio as hard disk sample data;

[0016] The hard disk sample data is loaded into the cache space.

[0017] In some embodiments, after loading the hard disk sample data into the cache space, the method further includes:

[0018] Determining whether the identifier of the hard disk sample data matches the target identifier;

[0019] In response to determining that the identifier of the hard disk sample data matches the target identifier, training the model using the hard disk sample data;

[0020] In response to determining that the identifier of the hard disk sample data does not match the target identifier, the target identifier is stored in the delayed access queue.

[0021] In some embodiments, obtaining unused sample data from the hard disk according to the preset ratio includes:

[0022] Get a random number;

[0023] When the random number is greater than the preset ratio, unused sample data is obtained from the hard disk according to the preset ratio.

[0024] In some embodiments, the cache space includes a plurality of cache blocks; and the method further includes:

[0025] For each cache block among the multiple cache blocks, when all sample data in the cache block have been used, all sample data cached in the cache block are cleared.

[0026] In some embodiments, the method further comprises:

[0027] In the delayed access queue, the target identifier corresponding to the target sample data loaded into the cache space is cleared.

[0028] In some embodiments, the cache space includes a plurality of cache blocks; and the method further includes:

[0029] For each cache block among the plurality of cache blocks, determining a time duration from the first use of sample data cached in the cache block to the time when all sample data in the cache block have been used, as a training time duration;

[0030] Determine the time from when unused sample data is obtained from the hard disk to when the unused sample data is loaded into the cache block as the cache time;

[0031] Determine whether the training duration is greater than the cache duration;

[0032] In response to determining that the training duration is greater than the cache duration, allocating a preset number of cache blocks in the cache space;

[0033] In response to determining that the training duration is less than or equal to the cache duration, the number of cache blocks in the cache space is determined based on the time difference between the training duration and the cache duration as the cache expansion number, wherein the cache expansion number is greater than a preset number.

[0034] The present disclosure provides a device for accelerating model training, comprising:

[0035] A target identification determination module is used to determine the identification of target sample data for model training as the target identification;

[0036] an identification storage module, configured to store the target identification in a delayed access queue when no sample data matching the target identification exists in the cache space;

[0037] A training module, configured to obtain unused sample data in the cache space and train the model using the unused sample data;

[0038] A sample data acquisition module, configured to acquire target sample data corresponding to at least part of the target identifiers in the delayed access queue from a hard disk when a preset condition is met;

[0039] A loading module is used to load target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk into the cache space.

[0040] In some embodiments, the identification storage module is used to determine whether the used storage space in the delayed access queue reaches a preset threshold; if not, the target identification is stored in the delayed access queue; if so, unused sample data is obtained from the hard disk as hard disk sample data according to the preset ratio; and the hard disk sample data is loaded into the cache space.

[0041] In some embodiments, the identification storage module is used to determine whether the identification of the hard disk sample data matches the target identification; if so, use the hard disk sample data to train the model; if not, store the target identification in the delayed access queue.

[0042] In some embodiments, the identification storage module is used to obtain a random number; when the random number is greater than a preset ratio, obtain unused sample data in the hard disk according to the preset ratio.

[0043] In some embodiments, the cache space includes a plurality of cache blocks; the apparatus further includes:

[0044] The sample data clearing module is used to clear all the sample data cached in each cache block when all the sample data in the cache block are used.

[0045] In some embodiments, the apparatus further comprises:

[0046] The identifier clearing module is used to clear the identifier corresponding to the sample data loaded into the cache space in the delayed access queue.

[0047] In some embodiments, the cache space includes a plurality of cache blocks; the apparatus further includes:

[0048] A cache determination module is used to determine, for each cache block, the time from the first use of sample data cached in the cache block to the use of all sample data in the cache block, as a training time; determine the time from the acquisition of unused sample data from the hard disk to the loading of unused sample data from the hard disk into the cache block, as a cache time; judge whether the training time is greater than the cache time; if so, allocate a preset number of cache blocks in the cache space; if not, determine the number of cache blocks in the cache space according to the time difference between the training time and the cache time, as a cache expansion number, wherein the cache expansion number is greater than the preset number.

[0049] The present disclosure provides a computer-readable storage medium storing a computer program, which implements the above-mentioned method for accelerating model training when executed by a processor.

[0050] The present disclosure provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for accelerating model training when executing the program.

[0051] At least one of the above technical solutions adopted in the present disclosure can achieve the following beneficial effects:

[0052] The present disclosure provides a method for accelerating model training, which determines an identifier of target sample data for model training as a target identifier. When sample data matching the target identifier does not exist in a cache space, the target identifier is stored in a delayed access queue, unused sample data is obtained in the cache space, and the model is trained using the unused sample data. When a preset condition is met, target sample data corresponding to at least part of the target identifiers in the delayed access queue are obtained from a hard disk, and the target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk are loaded into the cache space.

[0053] It can be seen from the above method that this method improves the speed of model training by replacing the target sample data with other unused sample data in the cache when the target sample data does not exist in the cache, and delays loading the target sample data into the cache to reduce the time to obtain the target sample data. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The drawings described herein are used to provide further understanding of the present disclosure and constitute a part of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute improper limitations on the present disclosure.

[0055] FIG1 is a flow chart of a method for accelerating model training provided in the present disclosure.

[0056] FIG2 is a schematic diagram of searching target sample data provided by the present disclosure.

[0057] FIG3 is a schematic diagram of a flow chart of a storage identification process provided by the present disclosure.

[0058] FIG4 is a schematic diagram of a device for accelerating model training provided by the present disclosure.

[0059] FIG5 is a schematic structural diagram of an electronic device provided by the present disclosure corresponding to FIG1 . DETAILED DESCRIPTION

[0060] To make the objectives, technical solutions, and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the specific embodiments of the present disclosure and the corresponding drawings. The described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.

[0061] As user needs change, more and more requirements are placed on the functions of AI models. In order to meet user needs, AI models can be trained more complexly. However, more complex training of AI models requires a lot of computing power and storage resources. In related technologies, the computing speed of the graphics processing unit (GPU) used to train AI models is getting faster and faster, while the cache space used to cache the sample data required for training AI models can store less sample data. If the GPU does not obtain the required sample data from the cache space when performing a training task, it will obtain the required sample data from a storage space such as a hard disk and load it into the cache space. However, it takes a long time to obtain the sample data from a storage space such as a hard disk and load it into the cache space, resulting in lower GPU utilization and a longer AI model training time.

[0062] Based on this, the present disclosure provides a method for accelerating model training to improve GPU utilization and accelerate model training.

[0063] The technical solutions provided by various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0064] FIG1 is a flow chart of a method for accelerating model training provided in the present disclosure, which includes the following steps S100 - S108 .

[0065] S100: Determine the identifier of target sample data for model training as the target identifier.

[0066] The model is trained using sample data according to the needs of the user so that the model can meet the needs. During the model training process, it is necessary to first obtain sample data. When obtaining sample data, since the sample data obtained from the hard disk is random, the sample data loaded into the cache does not necessarily contain the target sample data required in the current training process. Then, it is necessary to obtain the sample data from the hard disk again, which reduces the speed of model training. In order to improve the efficiency of model training, the present disclosure provides a method for accelerating model training. The execution subject of the method can be a server used for model training, such as a graphics processing unit (GPU), or other electronic devices with computing functions. For the sake of convenience, the following only takes the server as the execution subject to illustrate a method for accelerating model training provided by the present disclosure.

[0067] In one or more embodiments of the present disclosure, since the server searches for sample data based on its identifier, when acquiring sample data, it is necessary to determine the identifier of the target sample data for model training as the target identifier. The target sample data is the sample data required for the current training process. Each sample data has its own identifier to globally uniquely identify the sample data.

[0068] S102: When there is no sample data matching the target identifier in the cache space, the target identifier is stored in a delayed access queue.

[0069] FIG2 is a schematic diagram of searching target sample data provided by the present disclosure, as shown in FIG2 .

[0070] After obtaining the target identifier, the cache space is searched for sample data that matches the target identifier. If sample data matching the target identifier exists in the cache space, the sample data is used as the target sample data and the model is trained using the target sample data. If sample data matching the target identifier does not exist in the cache space, the target identifier is stored in a delayed access queue. The delayed access queue is used to record the target identifier of the target sample data when the target sample data is not in the cache space.

[0071] For example, if the target identifier is 7, the cache space is searched to see whether there is sample data matching the target identifier 7. If not, the target identifier 7 is stored in the delayed access queue.

[0072] S104: Acquire unused sample data in the cache space, and use the unused sample data to train the model.

[0073] In the disclosed embodiments, when training a model, the order in which sample data is accessed has no effect on the accuracy of the trained model. Therefore, other sample data can be used in place of the target sample data for training. In other words, when the target sample data does not exist in the cache, the server can retrieve unused sample data from the cache and use it to train the model. Unused sample data refers to sample data that was not used by the server to train the model when executing each training task.

[0074] Specifically, for each sample data in the cache space, a bitmap data structure can be used to record whether the sample data has been used. The size of the bitmap matches the number of sample data in the cache space. For example, if there are ten sample data in the cache space, the bitmap can record the usage of the ten sample data. When the sample data is used, the value of the position corresponding to the identifier of the sample data in the bitmap is set to 1, otherwise it is 0. Therefore, the server can randomly obtain sample data in the cache space, and then determine whether the sample data in the cache space is used based on the bitmap and the identifier of the sample data. If it is not used, the unused sample data is used to train the model. If it has been used, the sample data is obtained again from the cache space. Of course, the sample data can also be obtained nearby based on the logical address of the sample data, and then a judgment is made. The present disclosure does not limit the method of obtaining unused sample data.

[0075] S106: When a preset condition is met, target sample data corresponding to at least part of the target identifiers in the delayed access queue is obtained from the hard disk.

[0076] Since the storage space of the delayed access queue is limited, in order for the server to store the target identifier corresponding to the target sample data in the delayed access queue when the target sample data does not exist in the cache space next time, the server needs to regularly clear the target identifiers in the delayed access queue. Before clearing the target identifier in the delayed access queue, the target sample data corresponding to the target identifier in the delayed access queue needs to be loaded into the cache space, that is, when the preset conditions are met, the target sample data corresponding to at least part of the target identifiers in the delayed access queue are obtained from the hard disk, and the server can obtain the target sample data corresponding to the target identifier from the hard disk in the order in which the target identifiers are stored in the delayed access queue. For example, there are identifiers 1, 2, 3, and 4. These four target identifiers are stored in the delayed access queue in the order of 4, 3, 2, and 1. Therefore, when obtaining the target sample data, the target sample data corresponding to identifiers 4, 3, 2, and 1 are obtained in sequence. It should be noted that the preset condition can be that the current server is in an idle state, or it can be other conditions, and the present disclosure does not limit this.

[0077] S108: Loading target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk into the cache space.

[0078] Based on a model training acceleration method shown in Figure 1, this method uses other unused sample data in the cache for model training when the target sample data does not exist in the cache, thereby improving the speed of model training and delaying the loading of the target sample data into the cache to reduce the time to obtain the target sample data.

[0079] It should be noted that the cache space includes multiple cache blocks. To allow the server to continue loading unused sample data into each cache block, all sample data cached in each cache block is cleared when all sample data in the cache block is used. In some embodiments, a threshold for the number of used sample data may be preset. When the number of used sample data in the cache space reaches the preset threshold, the used sample data in the cache space is cleared. This is not a limitation of the present disclosure.

[0080] In addition, in the disclosed embodiment, if the server trains the model quickly but retrieves sample data from the hard disk and loads it into the cache space slowly, the server will need to wait for the sample data to be loaded into the cache space before continuing training. In order to reduce the server's waiting time and improve the efficiency of model training, the server may determine the size of the cache space during the initial period of model training based on the server's model training speed and the speed at which sample data is retrieved from the hard disk and loaded into the cache space. The initial period may be a period when the current number of iterations is less than a preset iteration threshold value during the execution of a training task.

[0081] Specifically, the cache space includes multiple cache blocks. In the initial period of model training, for each cache block, the time from the first use of the sample data cached in the cache block to the use of all the sample data in the cache block is determined as the training time. The time from the acquisition of unused sample data from the hard disk to the loading of the unused sample data acquired from the hard disk into the cache block is determined as the cache time. The present disclosure does not limit the order of determining the training time and the cache time. Since the model does not change, the training time and the cache time will not change much. Therefore, the training time can be determined based on the historical training time in the initial period of model training, and the cache time can be determined based on the historical cache time. For example, the average of multiple historical training times is calculated as the training time, and the average of multiple historical cache times is calculated as the cache time. The present disclosure does not limit this.

[0082] In some embodiments, the cache space includes multiple cache blocks. In the initial period of model training, for any cache block, the time from the first use of the sample data cached in the cache block to the use of all the sample data in the cache block is determined as the training time. The time from the acquisition of unused sample data from the hard disk to the loading of the unused sample data acquired from the hard disk into the cache block is determined as the cache time. The present disclosure does not limit the order of determining the training time and the cache time. Since the model does not change, the training time and the cache time will not change much. Therefore, the training time can be determined based on the historical training time in the initial period of model training, and the cache time can be determined based on the historical cache time.

[0083] Multiple cache blocks in the cache space can be stored and read simultaneously.

[0084] After determining the training duration and the cache duration, determine whether the training duration is greater than the cache duration. If so, allocate a preset number of cache blocks in the cache space. That is, when the speed of the server training model is slower than the speed of obtaining sample data from the hard disk and loading it into the cache space, a small number of cache blocks can be allocated. If not, the number of cache blocks in the cache space is determined based on the time difference between the training duration and the cache duration as the cache expansion number, wherein the cache expansion number is greater than the preset number. That is, when the speed of the server training model is faster than the speed of obtaining sample data from the hard disk and loading it into the cache space, more cache blocks can be allocated. For example, if the preset number is 2, the cache expansion number needs to be greater than 2.

[0085] Regarding step S102 , FIG3 is a schematic diagram of a flow chart of storing identification provided by the present disclosure, as shown in FIG3 .

[0086] Since the storage space of the delayed access queue is limited and cannot store a large number of identifiers, the server can obtain more sample data from the hard disk. Then, among the more sample data obtained from the hard disk, there is a greater possibility that target sample data corresponding to the target identifier exists, so as to reduce the number of target identifiers that need to be stored in the delayed access queue, thereby balancing the overall performance. Then, the server can set a threshold for the space that the delayed access queue can store. For example, the delayed access queue can store 10 target identifiers, and the threshold is set to 7. Before storing the target identifier in the delayed access queue, it is necessary to first determine whether the storage space used in the delayed access queue reaches the preset threshold. If not, it means that the space used in the delayed access queue is small, and the target identifier can be stored in the delayed access queue. If so, in order to reduce the number of target identifiers that need to be stored in the delayed access queue, unused sample data is obtained from the hard disk according to a preset ratio as hard disk sample data.

[0087] Continuing with the above example, before storing the target identifier in the delayed access queue, we first determine whether the number of identifiers already stored in the delayed access queue is greater than 7. If not, we can continue to store the target identifier. If so, we need to obtain some sample data from the hard disk as hard disk sample data. After obtaining the hard disk sample data, we load it into the cache space for subsequent use in model training.

[0088] The reason for setting the ratio is that when a large amount of target sample data is required to complete the current training task, in order to ensure the overall performance balance and reduce the number of target identifiers that need to be stored in the delayed access queue, the server can obtain part of the sample data from the hard disk according to a certain ratio, and the other part of the sample data can be obtained from the cache space. For example, the sample data can be obtained from the hard disk and the cache space respectively in a 1:1 ratio, that is, the same amount of sample data is obtained from the hard disk and the cache space respectively. In some embodiments, when obtaining a preset ratio of unused sample data from the hard disk, a random number is obtained. When the random number is greater than the preset ratio, the unused sample data is obtained from the hard disk according to the preset ratio. If the random number is less than the preset ratio, only the unused sample data is obtained from the hard disk. The preset ratio and the random number are both numbers in the range of 1 to 100. The preset ratio will increase as the number of target identifiers stored in the delayed access queue increases. The preset ratio indicates the ratio of sample data obtained from the hard disk to sample data obtained from the cache space. For example, if 10 sample data are needed, the random number is 80, the preset ratio is 70, and the random number is greater than the preset ratio, then 7 unused sample data are obtained from the hard disk and 3 unused sample data are obtained from the cache space. For example, if 10 sample data are needed, the random number is 50, the preset ratio is 70, and the random number is less than the preset ratio, then 7 unused sample data are obtained from the hard disk. As the delayed access queue has more storage space used, the number of sample data obtained from the hard disk increases, that is, the preset ratio increases. In some embodiments, the ratio may not be set, and as the delayed access queue has more storage space used, the number of sample data obtained from the hard disk increases.

[0089] Because the server randomly obtains sample data from the hard disk, the hard disk sample data is not necessarily the target sample data required to perform the current training task. Therefore, after loading the hard disk sample data into the cache space, the server needs to determine whether the hard disk sample data identifier matches the target identifier. If so, the hard disk sample data is used to train the model. If not, the target identifier is stored in the delayed access queue. When the hard disk sample data identifier is consistent with the target identifier, the hard disk sample data identifier matches the target identifier. This disclosure does not limit the method for determining whether the hard disk sample data identifier matches the target identifier.

[0090] For step S104, for different training tasks, in order to ensure that the model uses each sample data only once when executing the training task, the server can determine the storage location of the sample data in the Bloom filter based on the hash function and the identifier of the sample data. When the sample data has been used, the value of the storage location is set to 1; when the sample data has not been used, the value of the storage location is set to 0.

[0091] Specifically, in one or more embodiments of the present disclosure, in order to improve the accuracy of recording whether the sample data has been used, the server may use three different hash functions to calculate the three storage locations of the identifier of the sample data in the Bloom filter. When the sample data has been used, the values ​​of the locations where the identifier of the sample data is stored in the Bloom filter are all set to 1, otherwise they are set to 0. In other words, the accuracy of using only the value of one storage location to record whether the sample data has been used is low. For example, there are two identifiers, 14 and 15, and the sample data corresponding to 14 has been used, while the sample data corresponding to 15 has not been used. When only one hash function is used to calculate the storage locations of the two adjacent identifiers in the Bloom filter, 14 and 15 may be stored in the same location. Then, if the value of the storage location corresponding to 14 is set to 1, 15 may also be marked as used, but it is not actually used.

[0092] After executing step S108, the target identifier corresponding to the sample data loaded into the cache space is deleted from the delayed access queue, that is, the target identifier corresponding to the target sample data loaded into the cache space is cleared from the delayed access queue.

[0093] The above are one or more implementation methods of the present disclosure. Based on the same idea, the present disclosure also provides a corresponding device for accelerating model training, as shown in Figure 4.

[0094] FIG4 is a schematic diagram of a device for accelerating model training provided by the present disclosure, comprising:

[0095] A target identifier determination module 400 is configured to determine an identifier of target sample data for model training as a target identifier;

[0096] The identifier storage module 402 is configured to store the target identifier in a delayed access queue when no sample data matching the target identifier exists in the cache space;

[0097] A training module 404 is configured to obtain unused sample data in the cache space and train the model using the unused sample data;

[0098] The sample data acquisition module 406 is configured to acquire target sample data corresponding to at least part of the target identifiers in the delayed access queue from the hard disk when a preset condition is met;

[0099] The loading module 408 is configured to load target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk into the cache space.

[0100] In some embodiments, the identification storage module 402 is used to determine whether the used storage space in the delayed access queue reaches a preset threshold; if not, the target identification is stored in the delayed access queue; if so, unused sample data is obtained from the hard disk as hard disk sample data according to a preset ratio; and the hard disk sample data is loaded into the cache space.

[0101] In some embodiments, the identification storage module 402 is used to determine whether the identification of the hard disk sample data matches the target identification; if so, use the hard disk sample data to train the model; if not, store the target identification in the delayed access queue.

[0102] In some embodiments, the identification storage module 402 is used to obtain a random number; when the random number is greater than a preset ratio, obtain unused sample data from the hard disk according to the preset ratio.

[0103] In some embodiments, the cache space includes a plurality of cache blocks; the apparatus further includes:

[0104] The sample data clearing module 410 is configured to clear all sample data cached in each cache block when all sample data in the cache block have been used.

[0105] In some embodiments, the apparatus further comprises:

[0106] The identifier clearing module 412 is configured to clear, from the delayed access queue, the target identifier corresponding to the target sample data loaded into the cache space.

[0107] In some embodiments, the cache space includes a plurality of cache blocks; the apparatus further includes:

[0108] The cache determination module 414 is used to determine, for each cache block, the time from the first use of the sample data cached in the cache block to the time when all the sample data in the cache block have been used, as the training time; determine the time from the acquisition of unused sample data from the hard disk to the loading of the unused sample data from the hard disk into the cache block, as the cache time; determine whether the training time is greater than the cache time; if so, allocate a preset number of cache blocks in the cache space; if not, determine the number of cache blocks in the cache space according to the time difference between the training time and the cache time, as the cache expansion number, wherein the cache expansion number is greater than the preset number.

[0109] The present disclosure also provides a computer-readable storage medium storing a computer program, which can be used to execute a method for accelerating model training provided in FIG. 1 above.

[0110] The present disclosure also provides a structural diagram of an electronic device corresponding to Figure 1, as shown in Figure 5. As shown in Figure 5, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement a method for accelerating model training described in Figure 1 above.

[0111] Of course, in addition to software implementation, this disclosure does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0112] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0113] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to implement the same functions in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.

[0114] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0115] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing the present disclosure, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0116] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to hard disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0117] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the 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.

[0118] 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.

[0119] 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.

[0120] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0121] 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.

[0122] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, 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 (transitory media), such as modulated data signals and carrier waves.

[0123] 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.

[0124] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to hard disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0125] The present disclosure may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present disclosure may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0126] The various embodiments of this disclosure are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so their description is relatively simple. For relevant portions, refer to the description of the method embodiments.

[0127] The foregoing is merely an embodiment of the present disclosure and is not intended to limit the present disclosure. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure are intended to be included within the scope of the claims of the present disclosure.

Claims

1. A method for accelerating model training, characterized in that: The method comprises: Determine the identifier of the target sample data for model training as the target identifier; When there is no sample data matching the target identifier in the cache space, storing the target identifier in a delayed access queue; Acquire unused sample data in the cache space, and use the unused sample data to train the model; When a preset condition is met, obtaining target sample data corresponding to at least part of the target identifiers in the delayed access queue from the hard disk; The target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk is loaded into the cache space.

2. The method according to claim 1, characterized in that Storing the target identifier in the delayed access queue comprises: Determining whether the used storage space in the delayed access queue reaches a preset threshold; In response to determining that the used storage space in the delayed access queue does not reach the preset threshold, storing the target identifier in the delayed access queue; In response to determining that the used storage space in the delayed access queue reaches the preset threshold, unused sample data is obtained from the hard disk as hard disk sample data according to a preset ratio; and the hard disk sample data is loaded into the cache space.

3. The method according to claim 2, characterized in that After loading the hard disk sample data into the cache space, the method further includes: Determining whether the identifier of the hard disk sample data matches the target identifier; In response to determining that the identifier of the hard disk sample data matches the target identifier, training the model using the hard disk sample data; In response to determining that the identifier of the hard disk sample data does not match the target identifier, the target identifier is stored in the delayed access queue.

4. The method according to claim 2, characterized in that According to the preset ratio, unused sample data is obtained from the hard disk, including: Get a random number; When the random number is greater than the preset ratio, unused sample data is obtained from the hard disk according to the preset ratio.

5. The method according to claim 1, characterized in that The cache space includes a plurality of cache blocks; the method further includes: For each cache block among the multiple cache blocks, when all sample data in the cache block have been used, all sample data cached in the cache block are cleared.

6. The method according to claim 1, characterized in that The method further comprises: In the delayed access queue, the target identifier corresponding to the target sample data loaded into the cache space is cleared.

7. The method according to claim 1, characterized in that The cache space includes a plurality of cache blocks; the method further includes: For each cache block among the plurality of cache blocks, determining a time duration from the first use of sample data cached in the cache block to the time when all sample data in the cache block have been used as a training time duration; Determine the time from when the unused sample data is obtained from the hard disk to when the unused sample data is loaded into the cache block as the cache time; Determine whether the training duration is greater than the cache duration; In response to determining that the training duration is greater than the cache duration, allocating a preset number of cache blocks in the cache space; In response to determining that the training duration is less than or equal to the cache duration, the number of cache blocks in the cache space is determined according to the time difference between the training duration and the cache duration as a cache expansion number, wherein the cache expansion number is greater than a preset number.

8. A device for accelerating model training, characterized in that: The device comprises: A target identification determination module, used to determine the identification of target sample data for model training as the target identification; An identification storage module, used for storing the target identification in a delayed access queue when there is no sample data matching the target identification in the cache space; A training module, used to obtain unused sample data in the cache space and train the model using the unused sample data; A sample data acquisition module, used for acquiring target sample data corresponding to at least part of the target identifiers in the delayed access queue from the hard disk when a preset condition is met; A loading module is used to load target sample data corresponding to at least part of the target identifiers in the delayed access queue obtained from the hard disk into the cache space.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Block level cache prefetching optimization method and system based on deep learning

    CN110245094A

  • Cache data processing method and device, computer equipment and storage medium

    CN112487037A

  • Model training acceleration method and device, storage medium and electronic equipment

    CN116822657A

  • System and Method for Effective Caching Using Neural Networks

    US20120041914A1

  • Intelligent caching of data in a storage server victim cache

    US7752395B1