Batch processing parameter determination method and device, electronic equipment and readable storage medium

By automatically adjusting the starting and end values ​​of the interval to be tested, and determining batch processing parameters based on the performance value comparison of the target model, the problems of low efficiency and poor accuracy in the existing technology are solved, and more efficient and accurate parameters are achieved Sure.

CN118898282APending Publication Date: 2024-11-05STREAM COMPUTING INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310476801.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

The prior art requires a lot of labor costs and effort when determining batch processing parameters, and the selected parameters are not necessarily the optimal value, especially in the case of a large range of given intervals.

Method used

By obtaining the starting and ending values ​​of the interval to be tested, input them into the target model for processing, determining the corresponding performance value, and adjusting the interval according to the comparison results of the performance value until the optimal batch processing parameters are determined, the parameters are improved the accuracy and accuracy of determination.

Benefits of technology

Automatic search and approximation of the true value of the optimal performance is realized, manual participation is reduced, and the determination efficiency and accuracy of batch processing parameters are improved, and cost is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898282A_ABST
    Figure CN118898282A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a batch processing parameter determination method and device, electronic equipment and a readable storage medium, and the method comprises the steps: obtaining a starting value and an ending value of a to-be-tested interval corresponding to a current round, the method comprises the following steps: inputting sample data of which the quantity corresponds to a starting value and an ending value into a target model for processing to determine a corresponding first performance value and a corresponding second performance value, and determining a corresponding division value according to the starting value and the ending value when a to-be-tested interval can be divided; according to a comparison result of the first performance value and the second performance value, determining a division value as a starting value or an ending value of a to-be-tested interval corresponding to the next round until the to-be-tested interval cannot be divided, and according to the first performance value and the second performance value, determining batch processing parameters of the target model, the determination efficiency and accuracy of batch processing parameters can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a batch processing parameter method, device, electronic device and readable storage medium. Background Art

[0002] In machine learning, model inference usually refers to predicting a batch of data. Compared with single sample prediction, batch prediction can process multiple samples at the same time through one calculation, and the prediction efficiency is higher. In practical applications, batch prediction is usually a necessary step. For example, in image classification tasks, multiple images can be input into the convolutional neural network together for batch prediction, thereby improving the classification speed. The batch processing parameter (batch) is an important parameter that affects the efficiency of model prediction. If the batch processing parameter is too small, the hardware device (GPU or NPU, etc.) cannot be fully utilized, thereby reducing the prediction efficiency. If the batch processing parameter is too large, it will lead to insufficient memory or GPU / NPU video memory, making it impossible to make predictions. Therefore, it is particularly important to determine the batch processing parameter.

[0003] At present, most solutions are to determine the range of batch processing parameters based on experience, traverse the entire interval or select a special batch processing parameter value at the head, tail or middle position for testing, and select one of them as the optimal batch processing parameter based on the corresponding performance value of each batch processing parameter. However, since the performance of the model within a given range is not necessarily linearly correlated with the size of the batch processing parameter, the optimal value obtained from several typical batch processing parameters selected within the interval is not necessarily the optimal value of the entire interval. Moreover, when the given interval range spans a large range, if the above method is continued to be used to determine the batch processing parameters, the feasibility and accuracy will be worse, and the process of determining the results requires a lot of labor costs and effort. Summary of the invention

[0004] In view of this, embodiments of the present invention aim to provide a method, an apparatus, an electronic device and a readable storage medium for determining batch processing parameters, so as to improve the efficiency and accuracy of determining batch processing parameters.

[0005] In a first aspect, an embodiment of the present invention provides a method for determining batch processing parameters, the method comprising:

[0006] Obtaining a test interval corresponding to the current round, wherein the test interval includes a start value and an end value;

[0007] Inputting sample data corresponding to the start value and the end value into the target model for processing respectively, so as to determine a first performance value corresponding to the start value and a second performance value corresponding to the end value, wherein the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding sample data;

[0008] In response to the to-be-tested interval being divisible, determining a division value corresponding to the to-be-tested interval according to the start value and the end value;

[0009] Determining the partition value as a starting value or an ending value of a to-be-tested interval corresponding to a next round according to a comparison result of the first performance value and the second performance value;

[0010] In response to the to-be-tested interval being indivisible, a batch processing parameter of the target model is determined according to the first performance value and the second performance value.

[0011] Furthermore, the method further comprises:

[0012] Determining a sequence of parameters to be tested according to a preset initial range of candidate parameters;

[0013] The candidate parameter values ​​in the parameter sequence to be tested are screened based on preset rules to determine the interval to be tested.

[0014] Furthermore, the screening of candidate parameter values ​​in the parameter sequence to be tested based on a preset rule to determine the interval to be tested includes:

[0015] Determine a reference value corresponding to the parameter sequence to be measured;

[0016] The parameter values ​​in the parameter sequence to be tested that meet the preset multiples of the reference value are arranged in a preset order to generate corresponding intervals to be tested.

[0017] Further, the determining the first performance value corresponding to the starting value includes:

[0018] Determine the model processing parameters corresponding to the target model under the sample data of the number corresponding to the starting value, wherein the model processing parameters include the processing quantity and the processing time;

[0019] The first performance value is determined according to the processing quantity and the processing time.

[0020] Furthermore, the division value is determined by the following steps:

[0021] Rounding the average values ​​corresponding to the starting value and the ending value to determine a rounding result;

[0022] The candidate parameter value closest to the rounding result in the interval to be tested is determined as the partition value.

[0023] Further, determining the batch processing parameters of the target model according to the first performance value and the second performance value includes:

[0024] In response to the first performance value being greater than or equal to the second performance value, determining the starting value as a batch processing parameter of the target model;

[0025] In response to the first performance value being less than the second performance value, the end value is determined as a batch processing parameter of the target model.

[0026] Furthermore, the method further comprises:

[0027] In response to the interval to be tested including the start value, the end value and at least one candidate parameter between the start value and the end value, determining that the interval to be tested is divisible;

[0028] In response to the to-be-tested interval only including the start value and the end value, it is determined that the to-be-tested interval is indivisible.

[0029] In a second aspect, an embodiment of the present invention is to provide a batch processing parameter determination device, the device comprising:

[0030] An interval determination unit, used to obtain a to-be-tested interval corresponding to a current round, wherein the to-be-tested interval includes a start value and an end value;

[0031] a processing unit, configured to input the sample data corresponding to the starting value and the ending value into the target model for processing, so as to determine a first performance value corresponding to the starting value and a second performance value corresponding to the ending value, wherein the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding sample data;

[0032] an interval division unit, configured to, in response to the to-be-tested interval being divisible, determine a division value corresponding to the to-be-tested interval according to the starting value and the ending value, and determine the division value as a starting value or an ending value of the to-be-tested interval corresponding to a next round according to a comparison result between the first performance value and the second performance value;

[0033] A parameter determination unit is used to determine the batch processing parameters of the target model according to the first performance value and the second performance value in response to the to-be-tested interval being indivisible.

[0034] In a third aspect, an embodiment of the present invention is to provide an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement any of the methods described above.

[0035] In a fourth aspect, an embodiment of the present invention aims to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps as described in any one of the above items are implemented.

[0036] The technical solution of the embodiment of the present invention obtains the starting value and the ending value of the interval to be tested corresponding to the current round, and inputs the sample data of the corresponding number of the starting value and the ending value into the target model for processing to determine the corresponding first performance value and the second performance value. When the interval to be tested is divisible, the corresponding division value is determined according to the starting value and the ending value, and the division value is determined as the starting value or the ending value of the interval to be tested corresponding to the next round according to the comparison result of the first performance value and the second performance value, until the interval to be tested cannot be divided, and the batch processing parameters of the target model are determined according to the first performance value and the second performance value, which can realize automatic search and approximation to the true value of the optimal performance of the interval to be tested, provide a reliability basis for determining the batch processing parameters of the optimal performance, and thus improve the efficiency and accuracy of determining the batch processing parameters. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0038] Figure 1 is a flow chart of a method for determining batch processing parameters according to an embodiment of the present invention;

[0039] Figure 2 is a flow chart of a method for determining a first performance value according to an embodiment of the present invention;

[0040] Figure 3 is a flow chart of a method for determining a partition value according to an embodiment of the present invention;

[0041] Figure 4 is a flow chart of determining target model batch processing parameters according to an embodiment of the present invention;

[0042] Figure 5 is a schematic diagram of a batch processing parameter determination device according to an embodiment of the present invention;

[0043] Figure 6 is another schematic diagram of a batch processing parameter determination device according to an embodiment of the present invention;

[0044] Figure 7 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0045] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the detailed description of the present invention below, some specific details are described in detail. It is possible for a person skilled in the art to fully understand the present invention without the description of these details. In order to avoid confusing the essence of the present invention, known methods, processes, flows, components and circuits are not described in detail.

[0046] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0047] Unless the context clearly requires otherwise, words such as “include”, “including” and the like in the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as meaning “including but not limited to”.

[0048] In the description of the present invention, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0049] The solutions described in this specification and in the examples, if they involve the processing of personal information, will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.

[0050] The setting of batch processing parameters (batch, i.e. the number of samples in a batch) in model reasoning is of great significance for improving model reasoning efficiency and optimizing model performance. However, most current solutions are to traverse the known batch processing parameter interval range to determine the batch processing parameter value corresponding to the optimal performance value as the batch processing parameter of the model, or directly select a special batch processing parameter at the head, tail or middle position of the interval for performance testing, and select a batch processing parameter with the best performance as the optimal batch processing parameter of the model. For example, when the given batch processing parameter range is [16, 64], several values ​​such as 16, 32, 64 are generally selected for testing, and then the corresponding model is manually transferred and run again, and the performance values ​​obtained by running the model under these batch processing parameters are compared, and the batch processing parameter corresponding to the optimal performance value is selected as the final batch processing parameter.

[0051] However, since the performance of the model within a given range is not linearly correlated with the size of the batch processing parameters, the batch processing parameters obtained from several typical batch processing parameter values ​​selected within the interval are not necessarily the optimal batch processing parameters for the entire interval. Moreover, when the given interval spans a large range, if the above method is continued to be used to determine the batch processing parameters, the feasibility and accuracy will be worse, and the process of determining the results requires a lot of labor costs and effort. In view of this, the present embodiment aims to provide a method for determining batch processing parameters to improve the efficiency and accuracy of determining batch processing parameters.

[0052] Figure 1 FIG. 1 is a flow chart of a method for determining batch processing parameters according to an embodiment of the present invention. Figure 1 As shown, the batch processing parameter determination method in this embodiment includes the following steps.

[0053] In step S100, the to-be-tested interval corresponding to the current round is obtained, where the to-be-tested interval includes a start value and an end value.

[0054] In this embodiment, the interval to be tested includes multiple candidate parameters, the candidate parameter with the smallest value is the starting value, and the candidate parameter with the largest value is the ending value. Optionally, for ease of management, the candidate parameters in the interval to be tested in this embodiment are arranged in a manner from small to large or from large to small, so as to facilitate subsequent determination of the batch processing parameters corresponding to the best model performance from the interval to be tested.

[0055] In order to improve the accuracy of the interval to be tested, in this embodiment, different methods are used to determine the interval to be tested corresponding to the current round for the initial round and the non-initial round of test rounds. Optionally, in this embodiment, for the non-initial round of test rounds, the interval to be tested in the current round is determined according to the interval to be tested corresponding to the historical round, and compared with the interval to be tested in the historical round, the candidate parameters have been screened, and the candidate parameters in the interval to be tested in the current round are fewer. For the initial round of test rounds, the interval to be tested in the current round is determined according to the preset initial range of candidate parameters. Among them, the preset initial range of candidate parameters is determined according to the development experience of the operator, and can also be adjusted in combination with the actual application scenario or related hardware features (such as video memory size) to make the determination of the interval to be tested more practical, so that the determined interval to be tested is more accurate, thereby improving the accuracy of the determined batch processing parameters.

[0056] Furthermore, since the preset initial range of the candidate parameters is usually a continuous range, including a large number of integer values ​​and non-integer values, and the batch processing parameters can only be integers. Therefore, in order to improve the efficiency of determining the interval to be tested in this embodiment, when determining the interval to be tested of the current round corresponding to the initial round, the sequence of parameters to be tested is first determined according to the preset initial range of the candidate parameters, and then the candidate parameter values ​​in the sequence of parameters to be tested are screened based on the preset rules to determine the interval to be tested. Therefore, by first determining the sequence of parameters to be tested and then screening the sequence of parameters to be tested to determine the interval to be tested, it is possible to quickly eliminate unusable values ​​from the preset initial range of the candidate parameters and retain candidate parameters with representative characteristics, while ensuring the subsequent determination of the batch processing parameters. The number of candidate parameters can be effectively reduced, and the efficiency of determining the interval to be tested is improved, which is conducive to improving the efficiency of subsequent determination of the batch processing parameters.

[0057] Optionally, in this embodiment, the candidate parameter values ​​in the parameter sequence to be tested can be screened in a variety of ways to generate a test interval. For example, the candidate parameters in the initial range are screened using the power of a certain value as a screening condition, and the candidate parameters that meet the screening condition are selected to generate a test interval; or a certain value in the initial range can be used as a reference value, and an arithmetic or geometric progression is formed based on the reference value, and the parameters in the parameter sequence to be tested that overlap with the sequence are used as candidate parameters to generate a test interval.

[0058] Furthermore, when generating the interval to be tested, the present embodiment first determines the reference value corresponding to the sequence of parameters to be tested, and then arranges the parameters in the sequence of parameters to be tested that meet the preset multiples of the reference value in a preset order to generate the corresponding interval to be tested. In the present embodiment, assuming that the preset initial range of candidate parameters is [8, 512], and the corresponding sequence of parameters to be tested is {8, 9, 10, . . . , 511, 512}, 8 is used as the reference value, and 2 to the power of n is used as the preset multiple to screen the candidate parameters in the initial range, and the screened candidate parameters are arranged according to the preset order from small to large to generate the corresponding interval to be tested {8, 16, 32, 64, 128, 256, 512}.

[0059] It should be noted that the interval to be tested mentioned in this embodiment is only used to describe the range of optional values ​​of the batch processing parameter, and is not a continuous interval in the conventional understanding. For ease of understanding, it is assumed that the interval to be tested is {8, 16, 32}, and the candidate parameters corresponding to the optional values ​​of the batch processing parameter include 8, 16, and 32.

[0060] In step S200, sample data corresponding to the start value and the end value are respectively input into the target model for processing to determine a first performance value corresponding to the start value and a second performance value corresponding to the end value.

[0061] In this embodiment, different batch processing parameters will have an impact on the model reasoning performance, and the model reasoning performance under different batch processing parameters can be characterized by parameters related to model reasoning efficiency. Optionally, in this embodiment, the model reasoning performance is characterized by the throughput of the model. Both the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding number of sample data. Throughput refers to the number of data successfully transmitted per unit time, which is determined by the efficiency of the internal and external network port hardware and program algorithms of the network device. The method for determining the throughput of model reasoning is explained below using the first performance value as an example. It should be understood that the throughput of model reasoning corresponding to each candidate parameter can be determined by adopting the following method.

[0062] Figure 2 FIG. 1 is a flow chart of a method for determining a first performance value according to an embodiment of the present invention. Figure 2As shown, in this embodiment, the first performance value is determined through the following steps.

[0063] In step S210, the model processing parameters corresponding to the target model under the sample data corresponding to the starting value are determined, wherein the model processing parameters include the processing quantity and the processing time.

[0064] In this embodiment, the relevant information in the model reasoning process is often recorded through the operation log. When determining the first performance value of the target model, the sample data corresponding to the starting value is input into the target model for processing, and the operation log records the model processing parameters in the model reasoning process. By querying the model processing parameters in the operation log, the processing quantity and processing time of the processed data in the target model reasoning process corresponding to the starting value can be determined.

[0065] In step S220, a first performance value is determined according to the model processing parameters.

[0066] In this embodiment, the first performance value is determined according to the data quantity and processing time in the model processing parameters. After the data quantity and processing time are determined, the ratio of the processing quantity and the processing time is calculated, and the data transmitted by the target model in a unit time is represented by the ratio of the processing quantity and the processing time, and then determined as the first performance value.

[0067] It should be understood that the method for determining the second performance value corresponding to the end value in this embodiment is the same as the method for determining the first performance value, and will not be repeated here.

[0068] In step S300, it is determined whether the to-be-tested interval of the current round can be divided.

[0069] In this embodiment, whether the corresponding interval to be tested is divisible is determined by the existence of candidate parameters in the interval to be tested of the current round. Optionally, when the interval to be tested includes at least one candidate parameter between the starting value and the ending value in addition to the starting value and the ending value, it is determined that the corresponding interval to be tested is divisible, and step S400 is continued. When the interval to be tested only has the starting value and the ending value, and does not include other candidate parameters except the starting value and the ending value, it is determined that the corresponding interval to be tested is not divisible, and step S600 is continued.

[0070] In step S400, in response to the fact that the interval to be tested is divisible, a division value corresponding to the interval to be tested is determined according to a start value and an end value.

[0071] In this embodiment, the interval to be tested can be divided, which means that in addition to the starting value and the ending value, the interval to be tested also includes at least one candidate parameter between the starting value and the ending value. When the interval to be tested is in a divisible state, it indicates that the optimal batch processing parameter corresponding to the best performance can be the starting value, the ending value or any candidate parameter. At this time, the division value corresponding to the interval to be tested is determined according to the starting value and the ending value, so as to further refine the current interval to be tested according to the division value, and then determine a batch processing parameter with higher accuracy.

[0072] Figure 3 is a flow chart of a method for determining a partition value according to an embodiment of the present invention. Figure 3 As shown, the division value in this embodiment can be determined by the following steps.

[0073] In step S310, the average values ​​corresponding to the start value and the end value are rounded to determine a rounding result.

[0074] In this embodiment, after determining that the interval to be tested in the current round can be divided, the corresponding average value is determined according to the starting value and the ending value of the interval to be tested, and the average value of the starting value and the ending value is rounded to determine the division value according to the rounding result. When the average value of the starting value and the ending value of the interval to be tested is an integer, the rounding result is consistent with the average value. When the average value of the starting value and the ending value of the interval to be tested is a non-integer, the rounding result is an integer close to the average value. For example, the interval to be tested in the current round is {5, 8, 12, 64}, the average value of the starting value 5 and the ending value 64 is 34.5, and the rounding result obtained after rounding is 34. Therefore, the above method makes the division value determined when the average value is an integer a true average value, and can also make the division value determined when the average value is a non-integer close to the true average value, thereby improving the reliability of the division value.

[0075] In step S320, the candidate parameter value closest to the rounding result in the interval to be tested is determined as the partition value.

[0076] In this embodiment, after determining the rounding result corresponding to the average value of the starting value and the ending value of the interval to be tested, the candidate parameter value closest to the integer corresponding to the rounding result is selected as the partition value. Thus, when the interval to be tested in the current round includes the rounding result, the average value of the interval to be tested is used as the partition value; when the interval to be tested in the current round does not include the rounding result, the candidate parameter closest to the average value in the interval to be tested is determined as the partition value. For example, the interval to be tested in the current round is {5, 8, 12, 64}, and the rounding result obtained by rounding is 34. The candidate parameters in the interval to be tested do not include the rounding result, and the candidate parameter 12 closest to 34 is determined as the partition value. Thus, the partition value of the interval to be tested in the current round is determined by the above method, which can make the determination of the partition value more accurate, which is conducive to improving the accuracy and reliability of the subsequent partitioning of the interval to be tested.

[0077] In step S500, the partition value is determined as the start value or end value of the to-be-tested interval corresponding to the next round according to the comparison result of the first performance value and the second performance value.

[0078] In this embodiment, the direction of dividing the interval to be tested is determined by comparing the first performance value with the second performance value. When the first performance value is greater than the second performance value, it indicates that the probability of the starting value being the optimal batch processing parameter is higher. At this time, the starting value is retained, and the interval to be tested corresponding to the next round is determined according to the starting value and the dividing value, and the starting value in the interval to be tested of the current round is used as the starting value of the interval to be tested of the next round, and the dividing value in the interval to be tested of the current round is used as the ending value of the interval to be tested of the next round. When the first performance value is less than the second performance value, it indicates that the probability of the ending value being the optimal batch processing parameter is higher. At this time, the ending value is retained, and the interval to be tested corresponding to the next round is determined according to the ending value and the dividing value, and the dividing value in the interval to be tested of the current round is used as the starting value of the interval to be tested of the next round, and the ending value in the interval to be tested of the current round is used as the ending value of the interval to be tested of the next round. Therefore, in this embodiment, the partition value is determined as the starting value or ending value of the next round of test intervals through the comparison result of the first performance value and the second performance value, and then the next round of test intervals are determined according to the starting value and the partition value or according to the partition value and the ending value, so that the next round of test intervals are constantly close to the optimal batch processing parameters, thereby improving the accuracy of the optimal batch processing parameters of the determined target model.

[0079] In this embodiment, after determining the next round of test intervals according to the comparison result of the first performance value and the second performance value, the process returns to step S100, and uses the newly determined test interval as the current round of test intervals to perform subsequent processing until the test interval cannot be divided.

[0080] In step S600 , in response to the to-be-tested interval being indivisible, a batch processing parameter of the target model is determined according to the first performance value and the second performance value.

[0081] In this embodiment, the interval to be tested cannot be divided means that the interval to be tested only includes the starting value and the ending value, and there are no other candidate parameters. For example, when the interval to be tested in the current round is {8, 16}, the candidate parameters in the interval to be tested only include the starting value 8 and the ending value 16, and there are no other candidate parameters. At this time, the interval to be tested cannot be divided. Further, when the interval to be tested cannot be divided, the optimal batch processing parameter corresponding to the target model can only be selected from the starting value and the ending value, and the corresponding best performance value is the first performance value or the second performance value. By comparing the first performance value and the second performance value, the optimal batch processing parameter of the target model can be determined as the starting value or the ending value. Specifically, in this embodiment, when the batch processing parameter of the target model is determined according to the first performance value and the second performance value, in response to the first performance value being greater than or equal to the second performance value, the starting value is determined as the batch processing parameter of the target model; or, in response to the first performance value being less than the second performance value, the ending value is determined as the batch processing parameter of the target model.

[0082] The technical solution of this embodiment obtains the starting value and ending value of the interval to be tested corresponding to the current round, and inputs the sample data of the corresponding number of the starting value and the ending value into the target model for processing to determine the corresponding first performance value and second performance value; when the interval to be tested is divisible, the corresponding division value is determined according to the starting value and the ending value; according to the comparison result of the first performance value and the second performance value, the division value is determined as the starting value or the ending value of the interval to be tested corresponding to the next round, until the interval to be tested is indivisible; the batch processing parameters of the target model are determined according to the first performance value and the second performance value, which can improve the efficiency and accuracy of determining the batch processing parameters.

[0083] Figure 4 FIG. 1 is a flow chart of determining the batch processing parameters of the target model according to an embodiment of the present invention. Figure 4 As shown, in this embodiment, the batch processing parameters of the target model are determined through the following steps.

[0084] In step S410, a preset initial range is obtained.

[0085] In this embodiment, the preset initial range is a continuous range, including a large number of integer values ​​and non-integer values. Since the batch processing parameters of the model can only be integers, it is necessary to screen integers from the preset initial range as candidate parameters.

[0086] In step S420, a sequence of parameters to be measured is determined according to the initial range.

[0087] In this embodiment, integers in a preset initial range are screened, and a parameter sequence to be tested is generated according to each integer. Optionally, the data in the parameter sequence to be tested are arranged in order from small to large, which is conducive to improving subsequent processing efficiency.

[0088] In step S430, an initial interval to be tested is generated according to the sequence of parameters to be tested, and the initial interval to be tested includes a start value and an end value.

[0089] In this embodiment, the method for generating the initial to-be-tested interval is consistent with the aforementioned method for generating the to-be-tested interval, which will not be described in detail here.

[0090] In step S440, the division value of the to-be-tested interval of the current round is determined.

[0091] In this embodiment, the corresponding division value is determined by the start value and the end value of the to-be-tested interval of the current round. The method for determining the division value has been described above and will not be repeated here.

[0092] In step S450, a first performance value corresponding to the start value and a second performance value corresponding to the end value in the to-be-tested interval of the current round are determined.

[0093] In this embodiment, the first performance value and the second performance value respectively represent the data throughput corresponding to the number of sample data corresponding to the starting value and the ending value when they are input into the target model for processing. The specific determination method can adopt the same method as mentioned above, which will not be repeated here.

[0094] In step S460, it is determined whether the first performance value is less than the second performance value.

[0095] In this embodiment, the first performance value and the second performance value are compared to determine whether the first performance value is less than the second performance value. When the first performance value is less than the second performance value, step S470 is executed; when the first performance value is not less than the second performance value, step S480 is executed.

[0096] In step S470, a new interval to be tested is generated according to the division value and the end value of the current round, and the new interval to be tested is the interval to be tested in the next round.

[0097] In this embodiment, when the first performance value is less than the second performance value, the division value of the current round is determined as the starting value of the interval to be tested in the next round, and the end value of the current round is determined as the end value of the interval to be tested in the next round, thereby generating the interval to be tested in the next round.

[0098] In step S480, a new interval to be tested is generated according to the starting value and the partition value of the current round, and the new interval to be tested is the interval to be tested in the next round.

[0099] In this embodiment, when the first performance value is greater than or equal to the second performance value, the starting value of the current round is determined as the starting value of the interval to be tested in the next round, and the division value of the current round is determined as the ending value of the interval to be tested in the next round, thereby generating the interval to be tested in the next round.

[0100] In step S490, it is determined whether the new interval to be tested can be divided.

[0101] In this embodiment, after determining the updated interval to be tested, whether the corresponding interval to be tested can be divided is determined by judging whether the new interval to be tested includes other candidate parameters in addition to the starting value and the ending value. When the new interval to be tested includes other candidate parameters in addition to the starting value and the ending value, it is determined that the interval to be tested in the next round can be divided. When the new interval to be tested only includes the starting value and the ending value, it is determined that the interval to be tested in the next round cannot be divided. Further, when the new interval to be tested can be divided, return to execute step S440; when the new interval to be tested cannot be divided, continue to execute step S4100.

[0102] In step S4100, the best performance value is determined according to the first performance value and the second performance value corresponding to the new interval to be tested.

[0103] In this embodiment, the first performance value and the second performance value of the new interval to be tested are determined by the aforementioned method for determining the first performance value. When the first performance value is greater than or equal to the second performance value, the first performance value is determined as the best performance value; when the first performance value is less than the second performance value, the second performance value is determined as the best performance value.

[0104] In step S4110, the candidate parameter corresponding to the best performance value is determined as the batch processing parameter.

[0105] The technical solution of this embodiment can provide reasonable candidate parameters for the determination of batch processing parameters by determining the sequence of parameters to be tested according to the preset initial range of parameters and generating the initial interval to be tested according to the sequence of parameters to be tested. By determining the interval to be tested by multiple divisions and determining the division value of the interval to be tested in combination with the idea of ​​dichotomy, as well as calculating and comparing the first performance value and the second performance value corresponding to the starting value and the end value of the interval to be tested, an automated search and calculation comparison strategy is provided, which can automatically search and approximate the true value of the optimal performance of the interval to be tested to the maximum extent, provide a reliability basis for determining the batch processing parameters of the optimal performance, and can reduce manual participation in the process of determining the batch processing parameters, save labor cost investment, and reduce the cost of determining the batch processing parameters.

[0106] Figure 5 Schematic diagram of a batch processing parameter determination device according to an embodiment of the present invention. Figure 5As shown, the batch processing parameter determination device in this embodiment includes an interval determination unit 1, a processing unit 2, an interval division unit 3 and a parameter determination unit 4. Among them, the interval determination unit 1 is used to obtain the interval to be tested corresponding to the current round, and the interval to be tested includes a starting value and an ending value. The processing unit 2 is used to input the sample data corresponding to the starting value and the ending value into the target model for processing, so as to determine the first performance value corresponding to the starting value and the second performance value corresponding to the ending value, and the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding sample data. The interval division unit 3 is used to determine the division value corresponding to the interval to be tested according to the starting value and the ending value in response to the interval to be tested being divisible, and determine the division value as the starting value or the ending value of the interval to be tested corresponding to the next round according to the comparison result of the first performance value and the second performance value. The parameter determination unit 4 is used to determine the batch processing parameters of the target model according to the first performance value and the second performance value in response to the interval to be tested being indivisible.

[0107] Figure 6 FIG. 2 is another schematic diagram of a batch processing parameter determination device according to an embodiment of the present invention. Figure 6 As shown, the batch processing parameter determination device in this embodiment includes an interval determination unit 1 including a sequence determination module 11 and an interval determination module 12. Among them, the sequence determination module 11 is used to determine the parameter sequence to be tested according to the preset initial range of the candidate parameters, and is specifically used to determine the reference value corresponding to the initial range, and arrange the parameter values ​​in the initial range that meet the preset multiples of the reference value in a preset order to generate the corresponding parameter sequence to be tested. The interval determination module 12 is used to screen the candidate parameter values ​​in the parameter sequence to be tested based on preset rules and determine the interval to be tested.

[0108] Optionally, when determining the first performance value corresponding to the starting value, the processing unit 2 in this embodiment is specifically used to determine the model processing parameters corresponding to the target model under the number of sample data corresponding to the starting value, and determine the first performance value according to the processing quantity and processing time in the model processing parameters. Further, the method for determining the first performance value is the same as that for the second performance value, which will not be described in detail here.

[0109] Optionally, the interval division unit 3 in this embodiment includes a state determination module 31, a division value determination module 32 and an interval division module 33. Among them, the state determination module 31 is used to determine the divisible state of the interval to be tested, specifically when the interval to be tested includes a starting value, an end value and at least one candidate parameter between the starting value and the end value, to determine that the interval to be tested is divisible; or when the interval to be tested only includes the starting value and the end value, to determine that the interval to be tested is not divisible. The division value determination module 32 is used to determine the division value corresponding to the interval to be tested according to the starting value and the end value in response to the interval to be tested being divisible. Optionally, the division value determination module 32 in this embodiment is specifically used to round the average values ​​corresponding to the starting value and the end value, determine the rounding result, and determine the candidate parameter value closest to the rounding result in the interval to be tested as the division value. The interval division module 33 is used to determine the division value as the starting value or the end value of the interval to be tested corresponding to the next round according to the comparison result of the first performance value and the second performance value, and then determine the interval to be tested in the next round.

[0110] Optionally, the parameter determination unit 4 in this embodiment is specifically used to determine the starting value as the batch processing parameter of the target model in response to the first performance value of the current round being greater than or equal to the second performance value; and to determine the ending value as the batch processing parameter of the target model in response to the first performance value of the current round being less than the second performance value.

[0111] Figure 7 Schematic diagram of an electronic device according to an embodiment of the present invention. Figure 7 As shown, Figure 7 The electronic device shown is a general address query device, which includes a general computer hardware structure, which at least includes a processor 71 and a memory 72. The processor 71 and the memory 72 are connected via a bus 73. The memory 72 is suitable for storing instructions or programs executable by the processor 71. The processor 71 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 71 executes the instructions stored in the memory 72, thereby executing the method flow of the embodiment of the present invention as described above to realize the processing of data and the control of other devices. The bus 73 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 74 and the display device and the input / output (I / O) device 75. The input / output (I / O) device 75 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 75 is connected to the system via an input / output (I / O) controller 76.

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

[0113] The present application is described with reference to flowcharts of methods, apparatuses (devices) and computer program products according to embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.

[0114] These computer program instructions may be stored in a computer readable memory capable of directing 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 an article of manufacture including an instruction device that implements the process Figure 1 A function specified in a process or multiple processes.

[0115] These computer program instructions may also 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 the instructions for implementing the process Figure 1 A device that specifies functions in a process or multiple processes.

[0116] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.

[0117] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0118] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for determining batch processing parameters, characterized in that: The method comprises: Obtaining a test interval corresponding to the current round, wherein the test interval includes a start value and an end value; Inputting the sample data corresponding to the starting value and the ending value into the target model for processing respectively, so as to determine a first performance value corresponding to the starting value and a second performance value corresponding to the ending value, wherein the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding sample data; In response to the to-be-tested interval being divisible, determining a division value corresponding to the to-be-tested interval according to the start value and the end value; Determining the partition value as a starting value or an ending value of a to-be-tested interval corresponding to a next round according to a comparison result of the first performance value and the second performance value; In response to the to-be-tested interval being indivisible, a batch processing parameter of the target model is determined according to the first performance value and the second performance value.

2. The method according to claim 1, characterized in that The method further comprises: Determining a sequence of parameters to be tested according to a preset initial range of candidate parameters; The candidate parameter values ​​in the parameter sequence to be tested are screened based on preset rules to determine the interval to be tested.

3. The method according to claim 2, characterized in that The screening of candidate parameter values ​​in the parameter sequence to be tested based on a preset rule to determine the interval to be tested comprises: Determine a reference value corresponding to the parameter sequence to be measured; The parameter values ​​in the parameter sequence to be tested that meet the preset multiples of the reference value are arranged in a preset order to generate corresponding intervals to be tested.

4. The method according to claim 1, characterized in that Determining the first performance value corresponding to the starting value includes: Determine the model processing parameters corresponding to the target model under the sample data of the number corresponding to the starting value, wherein the model processing parameters include the processing quantity and the processing time; The first performance value is determined according to the processing quantity and the processing time.

5. The method according to claim 1, characterized in that The partition value is determined by the following steps: Rounding the average values ​​corresponding to the starting value and the ending value to determine a rounding result; The candidate parameter value closest to the rounding result in the interval to be tested is determined as the partition value.

6. The method according to claim 1, characterized in that Determining the batch processing parameters of the target model according to the first performance value and the second performance value includes: In response to the first performance value being greater than or equal to the second performance value, determining the starting value as a batch processing parameter of the target model; In response to the first performance value being less than the second performance value, the end value is determined as a batch processing parameter of the target model.

7. The method according to claim 1, characterized in that The method further comprises: In response to the interval to be tested including the start value, the end value and at least one candidate parameter between the start value and the end value, determining that the interval to be tested is divisible; In response to the to-be-tested interval only including the start value and the end value, it is determined that the to-be-tested interval is indivisible.

8. A batch processing parameter determination device, characterized in that: The device comprises: An interval determination unit, used to obtain a to-be-tested interval corresponding to a current round, wherein the to-be-tested interval includes a start value and an end value; a processing unit, configured to input the sample data corresponding to the starting value and the ending value into the target model for processing, so as to determine a first performance value corresponding to the starting value and a second performance value corresponding to the ending value, wherein the first performance value and the second performance value are used to characterize the throughput of the target model under the corresponding sample data; an interval division unit, configured to, in response to the to-be-tested interval being divisible, determine a division value corresponding to the to-be-tested interval according to the starting value and the ending value, and determine the division value as a starting value or an ending value of the to-be-tested interval corresponding to a next round according to a comparison result between the first performance value and the second performance value; A parameter determination unit is used to determine the batch processing parameters of the target model according to the first performance value and the second performance value in response to the to-be-tested interval being indivisible.

9. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 7.

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

Citation Information

Patent Citations

  • Data batch value adjustment method, device, readable storage medium and equipment

    CN110795255A

  • Model parameter determination method and device and storage medium

    CN111143148A

  • Deep learning model reasoning batch processing optimization method and system

    CN113902116A

  • Model reasoning scheduling method and system based on batch processing dynamic adjustment

    CN115408163A

  • Methods of operating a graphics processing unit (GPU) to train a deep neural network using a GPU local memory and related articles of manufacture

    US20200302304A1