Data processing method and device, electronic device and computer readable storage medium
By adjusting the compression parameters in the deep neural network, combined with the ADMM scheme and the parameter correlation of the front and rear layers, we solve the problem of difficulty in achieving excellent results with fixed compression rates in the existing technology, and achieve more effective results without reducing calculation accuracy. Model compression.
Patent Information
- Application Number
- CN202110581028.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-05-26
AI Technical Summary
It is difficult to achieve a better compression effect using a fixed compression ratio in the existing technology. Especially in deep neural networks, the sparsity sensitivity of each layer is different, resulting in poor compression effects.
By obtaining the initial value of the compression parameter and the corresponding model accuracy value, comparing the model accuracy value with the original accuracy value, adjusting the compression parameter value, for example, reducing the compression parameter to one third or doubling, and introducing it in the ADMM scheme The compressed residual parameters of the current network layer's previous and next layers are used as additional constraints to comprehensively consider the parameter correlation between the neural network model layer and the previous and next layers.
It is possible to adjust the compression parameters according to the calculation accuracy of the target model, thereby achieving a better compression effect while ensuring the calculation accuracy, and improving the efficiency of model slimming and the utilization of computing resources.
Smart Images

Figure CN113673694B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a data processing method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the development of artificial intelligence technology, artificial intelligence technology has been used in more and more fields to perform computing tasks including computer vision, speech recognition, natural language processing, etc. In particular, deep neural networks can use long-term memory to learn, which greatly improves the self-learning ability and computing effect of artificial intelligence technology. Therefore, deep neural networks have been used more and more widely with the development of artificial intelligence technology. Due to its long-term memory characteristics, deep neural networks require huge computing overhead and memory storage space in use. However, with the increasing application of artificial intelligence technology, more and more application scenarios are computing environments with limited resources. Therefore, in such a computing environment, the computing efficiency of artificial intelligence technology using deep neural networks is limited and affected by computing resources on the one hand, and on the other hand, the huge demand for computing resources by deep neural networks even hinders its application in various scenarios that penetrate into people's lives.
[0003] In the prior art, it has been proposed to use appropriate model compression methods to compress deep neural networks with more or less parameter redundancy, so as to obtain a relatively lightweight network while maintaining a certain degree of accuracy, so as to adapt to application scenarios with limited computing resources. In the prior art, for example, ADMM (Alternating Direction Method of Multipliers) has been used to compress the parameters of neural networks. However, for compression schemes such as ADMM used in the prior art, it is usually necessary to manually specify a specific compression rate. For neural networks, the sparsity sensitivity of each layer is different. Therefore, it is difficult to achieve a better compression effect using a fixed compression rate in the prior art.
[0004] Therefore, a technical solution is needed that can quickly determine compression rate parameters to improve compression effect. Summary of the invention
[0005] The embodiments of the present application provide a data processing method and device, an electronic device, and a computer-readable storage medium to solve the defect in the prior art that it is difficult to achieve a better compression effect by using a fixed compression rate.
[0006] To achieve the above objectives, the present application provides a data processing method, including:
[0007] Acquire an initial value of a compression parameter and a model accuracy value corresponding to the initial value, wherein the model accuracy value is a calculation accuracy of a target model after compression using the initial value of the compression parameter;
[0008] Comparing the model precision value with the original precision value, and adjusting the value of the compression parameter according to the comparison result, wherein the original precision value is the calculation precision of the target model before compression;
[0009] The adjusted value of the compression parameter is output.
[0010] Further, according to an embodiment of the present application, in the data processing method of the present application, adjusting the value of the compression parameter may include: reducing the value of the compression parameter to one third.
[0011] Further, according to an embodiment of the present application, in the data processing method of the present application, the increase and decrease of the value of the compression parameter may be asymmetric.
[0012] Further, according to an embodiment of the present application, in the data processing method of the present application, adjusting the value of the compression parameter according to the comparison result may include: when the model accuracy value is greater than or equal to the original accuracy value, doubling the value of the compression parameter, and when the model accuracy value is less than the original accuracy value, reducing the value of the compression parameter to one third.
[0013] Further, according to an embodiment of the present application, in the data processing method of the present application, the ADMM scheme is adopted to perform compression processing on the target model, and the compression processing may further include: when compressing the current network layer of the target model, the remaining parameter amount of the associated layer of the current network layer is used as a new constraint of ADMM, wherein the remaining parameter amount of the associated layer may refer to the number of parameters remaining after the associated layer is compressed, and the associated layer of the current network layer may be the front layer and / or the back layer of the current layer.
[0014] Therefore, in an embodiment of the present application, by additionally introducing the compression residual parameter amount of the previous and next layers of the current network layer as an additional compression weight reference when the ADMM scheme performs compression processing, the correlation between the parameters of the neural network model layer based on the current compression parameters and the parameters of the previous and next layers is comprehensively considered during the compression processing, and the parameters of the target model left in the compression are determined based on the correlation, thereby further improving the compression effect.
[0015] Further, according to an embodiment of the present application, in the data processing method of the present application, an interactive interface can be further provided, through which the initial value of the compression parameter can be displayed to the user as an initial compression suggestion, and the user's feedback input on the displayed initial value can be received through the interface. The feedback input can be a compression parameter directly specified by the user, or it can be an adjustment indication of the user for the initial value of the compression parameter, for example, increasing or decreasing the initial value.
[0016] Further, according to an embodiment of the present application, in the data processing method of the present application, the interactive interface can further provide the user with basic information of the target model to be processed, and can also receive the user's confirmation or adjustment opinions on the basic information through the interactive interface, and further, the data processing method of the present application can further include: adjusting the initial value of the compression parameter according to the received user input of the basic information of the target model.
[0017] The present application also provides a data processing device, including:
[0018] An acquisition module, used for obtaining an initial value of a compression parameter and a model accuracy value corresponding to the initial value, wherein the model accuracy value is a calculation accuracy of a target model after compression using the initial value of the compression parameter;
[0019] A parameter adjustment module, used to compare the model accuracy value with the original accuracy value, and adjust the value of the compression parameter according to the comparison result, wherein the original accuracy value is the calculation accuracy of the target model before compression;
[0020] The output module is used to output the adjusted value of the compression parameter.
[0021] The present application also provides an electronic device, including:
[0022] Memory, used to store programs;
[0023] The processor is used to run the program stored in the memory, and the program executes the data processing method provided in the embodiment of the present application when it is run.
[0024] An embodiment of the present application also provides a computer-readable storage medium on which a computer program executable by a processor is stored, wherein the program, when executed by the processor, implements the data processing method provided in the embodiment of the present application.
[0025] The data processing method and device, electronic device and computer-readable storage medium provided in the embodiments of the present application adjust the value of the compression parameter by judging the change in the calculation accuracy of the target model before and after compression, thereby obtaining the compression parameter suitable for the target model, thereby being able to obtain the compression parameter suitable for the model.
[0026] For example, in the field of machine learning calculations, the neural network model used usually has multiple parameters, and the higher the accuracy or the more complex the model, the more parameters it usually has. Therefore, in order to obtain a more accurate result in the prior art, a more accurate or more complex neural network model is often used, which leads to a sharp increase in the number of parameters used in the calculation, resulting in not only a huge consumption of computing resources but also a slow calculation speed. However, in practical applications, although the more complex the neural network model, the more parameters are used, these parameters are not all equally important, and even many parameters are redundant parameters. In other words, some of the large number of parameters used in the more complex neural network model actually have very little effect on the accuracy of the calculation performed by the network model, or even no effect. Therefore, in the prior art, the redundant parameters in the model are usually removed by setting appropriate compression parameters for different models, thereby achieving the effect of slimming the calculation model by reducing the number of parameters. However, the most important premise of such compression processing is that the calculation accuracy of the compressed model cannot be affected. In other words, it is necessary to reduce the parameters used by the compressed model as much as possible while ensuring that the availability of the compressed model remains unchanged, so as to achieve the purpose of improving the calculation efficiency and reducing the demand for computing resources. However, in such a case, how to determine suitable parameters to achieve model slimming without reducing the calculation accuracy is the main problem faced in this field. Therefore, through the above-mentioned data processing method and device, electronic device and computer-readable medium provided by the embodiment of the present application, it is possible to compress the target model by first using the initial value of the predetermined or specified compression parameter, and compare the calculation accuracy of the compressed model with the original calculation accuracy to adjust the compression parameter according to the comparison result, so that the compression parameter can be adjusted according to whether the calculation accuracy of the compressed target model is reduced. In particular, in the embodiment of the present application, since the best possible compression parameter that does not affect the calculation accuracy of the target model is found through repeated iterative trial, compared with the solution in the prior art that can only use fixed compression parameters, the best possible compression effect can be obtained. In addition, since the initial value of the compression parameter of the present application can also be determined based on the historical compression parameters of the same type or similar model, or the initial value can also be determined by interaction with the user, it is also possible to further reduce the number of iterative trials and obtain the best possible compression parameter more quickly.
[0027] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0029] Figure 1 A schematic diagram of a data processing solution provided in an embodiment of the present application;
[0030] Figure 2 A flowchart of an embodiment of the data processing method provided by the present application;
[0031] Figure 3 A flowchart of another embodiment of the data processing method provided by the present application;
[0032] Figure 4 A schematic diagram of the structure of an embodiment of a data processing device provided by the present application;
[0033] Figure 5 A schematic diagram of the structure of an electronic device embodiment provided in this application. DETAILED DESCRIPTION
[0034] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0035] Embodiment 1
[0036] The solution provided in the embodiments of the present application can be applied to any device or system with algorithm execution, such as a distributed server, etc. Figure 1 A schematic diagram of the principle architecture of the data processing solution provided in the embodiment of the present application, Figure 1 The illustrated architecture is merely one example of an architecture to which the technical solution of the present application can be applied.
[0037] With the development of artificial intelligence technology, more and more fields have begun to use artificial intelligence technology to solve various problems in various fields. In particular, deep neural networks can use long-term memory to learn, which greatly improves the self-learning ability and computing effect of artificial intelligence technology. However, due to the characteristics of long-term memory, deep neural networks require huge computing overhead and memory storage space in use. With the increasing application of artificial intelligence technology, more and more application scenarios are computing environments with limited resources. Therefore, in such a computing environment, the computing efficiency of artificial intelligence technology using deep neural networks is limited and affected by computing resources on the one hand, and on the other hand, the huge demand for computing resources by deep neural networks even hinders its application in various scenarios that penetrate into people's lives.
[0038] In particular, a neural network model usually has multiple parameters, and a model with higher accuracy or more complexity usually has more parameters. Therefore, in order to obtain a higher accuracy result in the prior art, a neural network model with higher accuracy or more complexity is often used. However, such a neural network model not only requires a large amount of computing resources but also has a slow computing speed due to the large number of parameters. However, in fact, among the large number of parameters of such a network model, there are parameters that are not so important or even redundant. In other words, some of the large number of parameters used in the network model have little effect on the accuracy of the calculation performed by the network model. Therefore, in the prior art, it has been proposed to use an appropriate compression method to compress such a network model by reducing the parameters used in the network model that have little effect on the accuracy, thereby obtaining a network with fewer parameters and maintaining a certain degree of accuracy, so as to adapt to application scenarios with limited computing resources or requiring higher computing efficiency.
[0039] In the prior art, for example, compression schemes such as ADMM have been used to compress the parameters of neural network models. In particular, ADMM is an improved form proposed to integrate the decomposability of the dual ascent method and the excellent convergence properties of the multiplier method. Its purpose is to decompose the original function and the augmented function so as to facilitate parallel optimization under more general assumptions. That is, ADMM optimizes alternately by introducing new variables and then switching directions. Specifically, in ADMM, the disassembled variables are first regarded as different variables and, and the constraints are also treated in this way. The advantage of this is that the sum does not need to be fused together later, which ensures the decomposability of the previous optimization process, thereby obtaining sequential iterations. However, even such an optimized compression scheme usually requires manual specification of a fixed compression rate, that is, for a certain network neural model, a fixed compression rate is used to reduce the number of parameters that meet the compression rate. However, for neural networks, the sparsity sensitivity of each layer is different. Therefore, the use of a fixed compression rate to compress neural network models in the prior art often results in not reducing all or most of the parameters that have a smaller impact on accuracy as much as possible, making it difficult to achieve a better compression effect.
[0040] Figure 1 The schematic diagram of the data processing solution provided in the embodiment of the present application. Figure 1 As shown, in the processing scheme according to the embodiment of the present application, when the parameter amount of the neural network model is compressed by schemes such as ADMM, a compression parameter that has a greater impact on the compression effect is selected, such as the RHO parameter in the ADMM compression scheme for adjustment. In other words, the value of a parameter such as RHO usually has a greater impact on the accuracy of the calculation performed by the neural network model using the RHO parameter.
[0041] Therefore, based on this principle, in the embodiment of the present application, the RHO parameters can be adjusted by using the calculation accuracy of the neural network model as a judgment standard. Figure 1 As shown in , the target model to be compressed by the ADMM scheme can be first calculated to obtain the original calculation accuracy of the target model. For example, in an embodiment of the present application, the calculation performed by the neural network model to obtain the original accuracy can be a pre-set standard calculation process, or it can be an actual calculation task.
[0042] In addition, after the original calculation accuracy is obtained, an initial value can be given to the compression weight parameter such as the RHO parameter in the ADMM scheme. In an embodiment of the present application, the initial value can be obtained according to experience, or it can be a statistical value obtained by compressing multiple similar models separately, and then the compression processing can be performed on the target model based on the initial value, that is, the target neural network model is compressed using the ADMM compression scheme with the compression weight parameter of the above initial value to obtain a compressed neural network model, and the above calculation is repeated for the compressed neural network model to obtain the compressed calculation accuracy.
[0043] That is to say, after obtaining the original calculation accuracy of the target model performing the calculation task, when the compression parameter is assigned an initial value, ADMM can use the compression weight parameter with the initial value to compress the target model, and perform the above preset calculation processing task again or perform the actual calculation processing task for the compressed neural network model obtained after the compression processing to obtain the post-compression calculation accuracy corresponding to the value of the weight parameter of the compression scheme based on which the compression processing is performed on the model. Therefore, the compression effect of the compression processing using the compression weight coefficient of the initial value can be judged based on the post-compression calculation accuracy.
[0044] For example, the calculation accuracy after compression can be compared with the original accuracy value of the target model obtained as described above before compression, and the value of the compression parameter can be adjusted based on the comparison result of the two. For example, after the compression process is performed using the compression weight parameter with the above-mentioned preset initial value, the calculation accuracy after compression obtained by repeatedly performing the above-mentioned calculation on the compressed target model does not decrease compared with the original calculation accuracy. Then the comparison result can not only indicate that the compression process using the initial value is successful to a certain extent, and the accuracy of the calculation performed by the target model is not degraded, that is, since the number of parameters of the compressed target model must have been reduced compared with the original model, and the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy can obtain the same or similar calculation accuracy, then it can be shown that the compressed target model is usable. On the other hand, the comparison result can also indicate that there may be further compression space for using the initial value to perform compression, because the calculation accuracy of the target model after compression has not been degraded, or the parameters removed during the compression process have very little effect on the target model performing the target calculation task. Then it is easy to think that there is a high probability that there are still parameters that can be removed in the compressed target model.
[0045] For this reason, Figure 1As shown in , the process can be further returned to ADMM and the value of the compression weight parameter RHO can be adjusted, for example, from the initial value to twice the initial value, and the original target model can be compressed again with the modified value, and the compressed target model obtained after the compression process repeats the above calculation again to obtain the compressed calculation accuracy and the original target model performs the above repeated processing to obtain the original calculation accuracy. That is, it is determined whether the calculation accuracy of the target model is not degraded when the compression weight parameter RHO is increased to further increase the compression rate. Therefore, when the calculation accuracy of the compressed target model obtained after compressing the target model with a parameter value twice the initial value does not degrade, the above steps of adjusting the parameter value can be repeated, for example, the current value, that is, twice the initial value, is doubled again, that is, modified to four times the initial value, and the original target model is compressed again.
[0046] In addition, if after the compression process is performed using the compression weight parameter with the above-mentioned preset initial value, the compressed target model repeatedly performs the above-mentioned calculation to obtain a reduced calculation accuracy compared with the original calculation accuracy, then the comparison result can indicate that the compression process using the initial value is not successful, that is, the calculation accuracy of the target model is degraded. In particular, since the number of parameters of the compressed target model must have been reduced compared with the original model, but the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy cannot obtain the same or similar calculation accuracy, for example, the calculation accuracy of the compressed target model obtained after the compression process is reduced, then it is indicated that the compressed target model cannot be used. On the other hand, the comparison result can also indicate that there is probably no further compression space when the compression is performed using the initial value, or even that the last compression process is over-compressed. This is because the calculation accuracy of the target model after the compression is degraded, or there are parameters that have a greater impact on the target model performing the target calculation task among the parameters removed during the compression process. It is easy to think that there are probably parameters in the compressed target model that should not be taken out in the current compression process. That is, in the current compression process, the compression weight parameters such as RHO are not properly set.
[0047] Therefore, if it is determined through comparison that the compression processing of the current RHO parameter value has degraded the calculation accuracy of the target model, the current RHO parameter value can be reduced, for example, reduced to half of the current RHO parameter value, and the reduced RHO parameter is used as a suitable compression weight parameter. Of course, after reducing the current RHO parameter value, the above compression processing can be repeated again, and the above repeated calculation is performed again on the compressed target model to compare the original calculation accuracy and the calculation accuracy after compression, and iteration is performed in this way.
[0048] Of course, in the embodiment of the present application, the method of increasing the parameter value of the compression weight parameter when the calculation accuracy is not degraded is not limited to doubling, and can also be adjusted to three times or other multiples of the initial value, and the method of reducing the parameter value of the compression weight parameter when the calculation accuracy is degraded is not limited to reducing it by half, but can also be adjusted in a way of reducing it to one third, for example. In addition, the increase and decrease may not correspond, that is, the compression weight value can be adjusted in a way of doubling when increasing the weight parameter and reducing it to one third when reducing it. In addition, when the methods of increasing and reducing the compression weight value do not correspond to each other, for example, in the case of doubling when increasing and reducing it to one third when reducing it, the compression process can be performed again with the reduced parameter value after the reduction, and the above-mentioned repeated calculation is performed again on the compressed target model and the obtained compressed calculation accuracy value is compared with the original calculation accuracy value, and if it is confirmed that the calculation accuracy has not degraded, the reduced compression weight value can be output as a better compression weight value.
[0049] In addition, in an embodiment of the present application, when performing the above-mentioned compression processing, the compressed residual parameter amounts of the previous and next layers of the current network layer can be additionally introduced as additional compression weight references. Therefore, the correlation between the parameters of the neural network model layer based on the current compression parameters and the parameters of the previous and next layers can be comprehensively considered. Thus, the parameters that have a strong correlation with the remaining parameters after compression of the previous and next layers should have a higher probability of being retained during compression. This can further improve the compression effect.
[0050] Therefore, the data processing solution provided in the embodiment of the present application can adjust the value of the compression parameter by judging the change in the computational accuracy of the target model before and after compression, and quickly determine the value of the compression parameter suitable for the target model through an iterative method, thereby achieving a better compression effect while ensuring that the computational accuracy of the target model is not lost.
[0051] The above embodiments are illustrations of the technical principles and exemplary application frameworks of the embodiments of the present application. The specific technical solutions of the embodiments of the present application are further described in detail below through multiple embodiments.
[0052] Embodiment 2
[0053] Figure 2 This is a flowchart of an embodiment of the data processing method provided by the present application. The execution subject of the method can be various terminals or server devices with data processing capabilities, or it can be a device or chip integrated on these devices. Figure 2 As shown, the data processing method includes the following steps:
[0054] S201, obtaining an initial value of a compression parameter and a model accuracy value corresponding to the initial value.
[0055] In the embodiment of the present application, the model accuracy value may be the calculation accuracy of the target model after compression using the initial value of the compression parameter. Before the target model is subjected to parameter compression processing using a compression method such as ADMM, the calculation accuracy of the uncompressed target model is first calculated, i.e., the original accuracy value in the embodiment of the present application. Then, for the compression parameter in the compression algorithm, the target model is compressed once according to the manually set or default initial value, and the calculation accuracy of the target model at this time is calculated, i.e., the model accuracy value corresponding to the initial value of the compression parameter in the embodiment of the present application.
[0056] For example, Figure 1 As shown in , calculations can be first performed on the target model to be compressed using, for example, an ADMM compression scheme to obtain the original calculation accuracy of the target model. For example, in an embodiment of the present application, the calculation performed by the neural network model to obtain the original accuracy can be to perform a pre-set standard calculation process, or it can be to perform an actual calculation task. After obtaining the original calculation accuracy, an initial value can be given to a compression parameter such as the RHO parameter in the ADMM scheme that has a greater impact on the compression effect in step S201. In an embodiment of the present application, the initial value can be obtained empirically, or it can be a statistical value obtained by compressing multiple similar models separately, and then compression processing can be performed on the target model based on the initial value, that is, the target neural network model is compressed using the ADMM compression scheme with the compression parameters of the above initial values, thereby obtaining a compressed neural network model, and the same calculation task as the calculation task performed to obtain the original calculation accuracy is repeated for the compressed neural network model again to obtain a model accuracy value.
[0057] S202, comparing the model accuracy value with the original accuracy value, and adjusting the value of the compression parameter according to the comparison result.
[0058] In the embodiment of the present application, the original precision value is the calculation precision of the target model before compression. When comparing the model precision value after compression processing with the original precision value before compression, if the model precision value is greater than or equal to the original precision value, that is, the calculation precision of the target model is not lost, the value of the compression parameter can be increased; if the model precision value is less than the original precision value, that is, the target model has a precision loss, the value of the compression parameter can be reduced. In this way, by judging the change in the calculation precision of the target model before and after compression, the compression parameter is adjusted, and finally the value of the compression parameter suitable for the target model can be obtained, and compressing the target model according to the value can achieve a better compression effect under the premise of ensuring the calculation precision of the target model.
[0059] That is, after obtaining the original calculation accuracy of the target model for performing the calculation task, after assigning the initial value to the compression parameter in step S201, the target model can be compressed using the compression parameter with the initial value in step S202, and the same calculation task as that performed to obtain the original calculation accuracy is performed again for the compressed neural network model obtained after the compression process to obtain the post-compression calculation accuracy corresponding to the value of the weight parameter of the compression scheme based on which the compression process is performed on the model. Therefore, the compression effect of the compression process using the compression weight coefficient of the initial value can be judged based on the post-compression calculation accuracy.
[0060] For example, in step S202, the calculation accuracy obtained after the compression is compared with the original calculation accuracy of the target model obtained as described above before the compression, and the value of the compression parameter is adjusted based on the comparison result of the two. For example, after the compression process is performed using the compression parameter with the above-mentioned preset initial value, the model calculation accuracy obtained by repeatedly performing the above-mentioned calculation on the compressed target model does not decrease compared with the original calculation accuracy. Then the comparison result can not only indicate that the compression process using the initial value is successful to a certain extent, and the accuracy of the target model calculation is not degraded, that is, since the number of parameters of the compressed target model must have been reduced compared with the original model, and the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy can obtain the same or similar calculation accuracy, then it can be said that the compressed target model is usable. On the other hand, the comparison result can also indicate that there may be further compression space when using the initial value to perform compression, because the calculation accuracy of the target model after compression is not degraded, or the parameters removed during the compression process have very little effect on the target model to perform the target calculation task. Then it is easy to think that there is a high probability that there are still parameters that can be removed in the compressed target model. Therefore, by determining the compression parameter according to the change in calculation accuracy before and after compression, it is possible to obtain a compression parameter value that can achieve a better compression effect.
[0061] S203: Output the adjusted value of the compression parameter.
[0062] Therefore, after obtaining the adjusted compression parameter value in step S202, the compression parameter value can be output in step S203, so as to be directly used in subsequent other model compression processing or as a reference for setting the initial value of the compression parameter.
[0063] Therefore, the data processing solution provided in the embodiment of the present application can adjust the value of the compression parameter by judging the change in the calculation accuracy of the target model before and after compression, so as to obtain the compression parameter suitable for the target model, so that the compression method using this value can achieve a better compression effect when compressing the target model.
[0064] Embodiment 3
[0065] Figure 3 This is a flowchart of another embodiment of the data processing method provided by the present application. The execution subject of the method can be various terminals or server devices with algorithm data processing capabilities, or it can be a device or chip integrated on these devices. Figure 3 As shown in the above Figure 2 Based on the illustrated embodiment, the data processing method may include the following steps:
[0066] S301, obtaining an initial value of a compression parameter and a model accuracy value corresponding to the initial value.
[0067] In the embodiment of the present application, the model accuracy value may be the calculation accuracy of the target model after compression using the initial value of the compression parameter. Before the target model is subjected to parameter compression processing using a compression method such as ADMM, the calculation accuracy of the uncompressed target model is first calculated, i.e., the original accuracy value in the embodiment of the present application. Then, for the compression parameter in the compression algorithm, the target model is compressed once according to the manually set or default initial value, and the calculation accuracy of the target model at this time is calculated, i.e., the model accuracy value corresponding to the initial value of the compression parameter in the embodiment of the present application.
[0068] For example, Figure 1As shown in , calculations can be first performed on the target model to be compressed using, for example, an ADMM compression scheme to obtain the original calculation accuracy of the target model. For example, in an embodiment of the present application, the calculation performed by the neural network model to obtain the original accuracy can be to perform a pre-set standard calculation process, or it can be to perform an actual calculation task. After obtaining the original calculation accuracy, an initial value can be given to a compression parameter such as the RHO parameter in the ADMM scheme that has a greater impact on the compression effect in step S301. In an embodiment of the present application, the initial value can be obtained empirically, or it can be a statistical value obtained by compressing multiple similar models separately, and then compression processing can be performed on the target model based on the initial value, that is, the target neural network model is compressed using the ADMM compression scheme with the compression parameters of the above initial values, thereby obtaining a compressed neural network model, and the same calculation task as the calculation task performed to obtain the original calculation accuracy is repeated for the compressed neural network model again to obtain a model accuracy value.
[0069] In the embodiment of the present application, in the process of adjusting the value of the compression parameter according to the size of the model precision value and the original precision value, the following iterative method can be adopted:
[0070] S302, comparing the model accuracy value with the original accuracy value.
[0071] In the embodiment of the present application, the original precision value is the calculation precision of the target model before compression. When comparing the model precision value after compression processing with the original precision value before compression, if the model precision value is greater than or equal to the original precision value, that is, the calculation precision of the target model is not lost, the value of the compression parameter can be increased; if the model precision value is less than the original precision value, that is, the target model has a precision loss, the value of the compression parameter can be reduced. In this way, by judging the change in the calculation precision of the target model before and after compression, the compression parameter is adjusted, and finally the value of the compression parameter suitable for the target model can be obtained, and compressing the target model according to the value can achieve a better compression effect under the premise of ensuring the calculation precision of the target model.
[0072] That is, after obtaining the original calculation accuracy of the target model for performing the calculation task, after assigning the initial value to the compression parameter in step S301, the target model can be compressed using the compression parameter with the initial value in step S302, and the same calculation task as that performed to obtain the original calculation accuracy is performed again for the compressed neural network model obtained after the compression process to obtain the post-compression calculation accuracy corresponding to the value of the weight parameter of the compression scheme based on which the compression process is performed on the model. Therefore, the compression effect of the compression process using the compression weight coefficient of the initial value can be judged based on the post-compression calculation accuracy.
[0073] For example, in step S302, the calculation accuracy obtained after the compression is compared with the original calculation accuracy of the target model obtained as described above before the compression, and the value of the compression parameter is adjusted based on the comparison result of the two. For example, after the compression process is performed using the compression parameter with the above-mentioned preset initial value, the model calculation accuracy obtained by the compressed target model by repeatedly performing the above-mentioned calculation does not decrease compared with the original calculation accuracy. Then the comparison result can not only indicate that the compression process using the initial value is successful to a certain extent, and the accuracy of the target model calculation is not degraded, that is, since the number of parameters of the compressed target model must have been reduced compared with the original model, and the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy can obtain the same or similar calculation accuracy, then it can be said that the compressed target model is usable. On the other hand, the comparison result can also indicate that there may be further compression space when using the initial value to perform compression, because the calculation accuracy of the target model after compression is not degraded, or the parameters removed during the compression process have very little effect on the target model to perform the target calculation task. Then it is easy to think that there is a high probability that there are still parameters that can be removed in the compressed target model. Therefore, by determining the compression parameter according to the change in calculation accuracy before and after compression, it is possible to obtain a compression parameter value that can achieve a better compression effect.
[0074] S303, when the model accuracy value is greater than or equal to the original accuracy value, increase the value of the compression parameter, use the current value of the compression parameter to compress the target model, and obtain the calculation accuracy of the compressed target model to update the model accuracy value.
[0075] S304: When the model accuracy value is less than the original accuracy value, reduce the value of the compression parameter and end the iterative operation.
[0076] In an embodiment of the present application, when it is determined in step S303 that the model accuracy value is greater than or equal to the original accuracy value, that is, the calculation accuracy of the target model is not lost, the value of the compression parameter can be increased, for example, the compression parameter can be preferably doubled. Then, the current value of the compression parameter, that is, the increased value, is used to compress the target model again, and the calculation accuracy of the target model at this time is obtained. Then, the above-mentioned model accuracy value is updated with the calculation accuracy, and the above-mentioned step S302 is returned to perform further adjustment operations with the parameter value. In the above-mentioned iterative process, when it is detected that the current model accuracy value is less than the original accuracy value, that is, the target model has a loss of accuracy, it is indicated that the value after the last adjustment is the target value, so the operation of reducing the value of the compression parameter can be performed, for example, the value of the compression parameter can be reduced by half.
[0077] For example, Figure 1 As shown in , when it is determined in step S303 that the calculation accuracy value of the compressed target model performing the same calculation processing as the calculation processing performed to obtain the original calculation accuracy is greater than or equal to the original calculation accuracy value, the value of the compression weight parameter RHO can be adjusted in step S303, for example, modified from the initial value to twice the initial value, and the original target model is compressed again with the modified value, and the compressed target model obtained after the compression processing repeats the above calculation again to obtain the compressed calculation accuracy and the original target model performs the above repeated processing to compare the original calculation accuracy obtained. That is, it is determined whether the calculation accuracy of the target model is not degraded when the compression parameter RHO is increased to further increase the compression rate. Therefore, when the calculation accuracy of the compressed target model obtained after the target model is compressed with a parameter value twice the initial value is not degraded, the step of adjusting the parameter value in step S303 can be continued to be repeated, for example, the current value, that is, twice the initial value, is doubled again, that is, modified to four times the initial value, and the original target model is compressed again.
[0078] When the compression weight parameter of the preset initial value is determined in step S303 and the compression process is performed, the compressed target model repeatedly performs the above calculation to obtain a reduced calculation accuracy compared with the original calculation accuracy. Then the comparison result can indicate that the compression process using the initial value is not successful, that is, the calculation accuracy of the target model is degraded. In particular, since the number of parameters of the compressed target model must have been reduced compared with the original model, but the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy cannot obtain the same or similar calculation accuracy. For example, the calculation accuracy of the compressed target model obtained after the compression process is reduced, which indicates that the compressed target model cannot be used. On the other hand, the comparison result can also indicate that there is probably no further compression space when the initial value is used for compression, or even that the last compression process is over-compressed. This is because the calculation accuracy of the target model after compression is degraded, or there are parameters that have a greater impact on the target model's execution of the target calculation task among the parameters removed during the compression process. It is easy to imagine that there are probably parameters in the compressed target model that should not be taken out in the current compression process. That is, in the current compression process, for example, the compression weight parameter of RHO is not set properly.
[0079] Therefore, if it is determined through comparison in step S303 that the compression processing performed on the current RHO parameter value has degraded the calculation accuracy of the target model, the current RHO parameter value can be reduced, for example, reduced to half of the current RHO parameter value, and the reduced RHO parameter is used as a suitable compression parameter to terminate the iteration. Of course, after reducing the current RHO parameter value, the above compression processing can be repeated again, and the above repeated calculation is performed on the compressed target model again to compare the original calculation accuracy and the calculation accuracy after compression, and iteration is performed in this way.
[0080] Of course, in the embodiment of the present application, the method of increasing the parameter value of the compression weight parameter when the calculation accuracy is not degraded is not limited to doubling, and can also be adjusted to three times or other multiples of the initial value, and the method of reducing the parameter value of the compression weight parameter when the calculation accuracy is degraded is not limited to reducing it by half, but can also be adjusted in a way of reducing it to one third, for example. In addition, the increase and decrease may not correspond, that is, the compression weight value can be adjusted in a way of doubling when increasing the weight parameter and reducing it to one third when reducing it. In addition, when the methods of increasing and reducing the compression weight value do not correspond to each other, for example, in the case of doubling when increasing and reducing it to one third when reducing it, the compression process can be performed again with the reduced parameter value after the reduction, and the above-mentioned repeated calculation is performed again on the compressed target model and the obtained compressed calculation accuracy value is compared with the original calculation accuracy value, and if it is confirmed that the calculation accuracy has not degraded, the reduced compression weight value can be output as a better compression weight value.
[0081] Specifically, in an embodiment of the present application, when the ADMM method is used to reduce the number of parameters used by the target model to compress it, when the current network layer of the target model is compressed, the remaining parameter amount of the associated layer of the current network layer can be used as a new constraint of ADMM. The remaining parameter amount of the associated layer in the embodiment of the present application refers to the number of parameters remaining after the associated layer is compressed, wherein the associated layer of the current network layer may be the front layer and / or the back layer of the current layer.
[0082] In other words, in an embodiment of the present application, when performing the above-mentioned compression processing, the compressed residual parameters of the previous and next layers of the current network layer can be additionally introduced as additional compression weight references. Therefore, the correlation between the parameters of the neural network model layer based on the current compression parameters and the parameters of the previous and next layers can be comprehensively considered. Thus, the parameters that have a strong correlation with the remaining parameters after compression of the previous and next layers should have a higher probability of being retained during compression. This can further improve the compression effect.
[0083] S305: output the adjusted value of the compression parameter.
[0084] Therefore, the data processing solution provided in the embodiment of the present application can adjust the value of the compression parameter by judging the change in the computational accuracy of the target model before and after compression, and quickly determine the value of the compression parameter suitable for the target model through an iterative method, thereby achieving a better compression effect while ensuring that the computational accuracy of the target model is not lost.
[0085] Embodiment 4
[0086] Figure 4The schematic diagram of the structure of the data processing device embodiment provided in the present application can be used to perform the following steps: Figure 2 and Figure 3 The method steps shown. Figure 4 As shown, the data processing device may include: an acquisition module 41, a parameter adjustment module 42 and an output module 43.
[0087] The acquisition module 41 is used for the initial value of the compression parameter and the model accuracy value corresponding to the initial value, wherein the model accuracy value is the calculation accuracy of the target model after compression using the initial value of the compression parameter. The parameter adjustment module 42 is used to compare the above-mentioned model accuracy value with the original accuracy value, and adjust the value of the compression parameter according to the comparison result, wherein the original accuracy value is the calculation accuracy of the target model before compression; the output module 43 is used to output the adjusted value of the compression parameter.
[0088] In the embodiment of the present application, before the compression method such as ADMM is used to compress the parameter quantity of the target model, the calculation accuracy of the uncompressed target model is first calculated, that is, the original accuracy value in the embodiment of the present application. Then, for the compression parameter in the compression algorithm, the target model is compressed once according to the manually set or default initial value, and the calculation accuracy of the target model at this time is calculated, that is, the model accuracy value corresponding to the initial value of the compression parameter in the embodiment of the present application. The acquisition module 41 acquires this initial value and the model accuracy value corresponding to the initial value.
[0089] For example, calculations may be performed first on a target model to be compressed using, for example, an ADMM compression scheme to obtain the original computational accuracy of the target model. For example, in an embodiment of the present application, the calculations performed by the neural network model to obtain the original accuracy may be to perform a pre-set standard computational process, or may be to perform an actual computational task. After obtaining the original computational accuracy, the acquisition module 41 may obtain the initial value of a compression parameter such as the RHO parameter in the ADMM scheme that has a greater impact on the compression effect. In an embodiment of the present application, the initial value may be obtained empirically, or may be a statistical value obtained by compressing multiple similar models separately, and compression processing may then be performed on the target model based on the initial value, that is, the target neural network model may be compressed using an ADMM compression scheme with compression parameters having the above-mentioned initial values, thereby obtaining a compressed neural network model, and the same computational tasks as those performed to obtain the original computational accuracy are repeated for the compressed neural network model to obtain a model accuracy value.
[0090] Then, the parameter adjustment module 42 performs parameter adjustment. Specifically, when the parameter adjustment module 42 compares the model accuracy value after compression processing with the original accuracy value before compression, if the model accuracy value is greater than or equal to the original accuracy value, that is, the calculation accuracy of the target model is not lost, the value of the compression parameter can be increased; if the model accuracy value is less than the original accuracy value, that is, the target model has a loss of accuracy, the value of the compression parameter can be reduced. In this way, by judging the change in the calculation accuracy of the target model before and after compression, the compression parameter is adjusted, and finally the value of the compression parameter suitable for the target model can be obtained, and compressing the target model according to the value can achieve a better compression effect under the premise of ensuring the calculation accuracy of the target model.
[0091] In the embodiment of the present application, the original precision value is the calculation precision of the target model before compression. And when the parameter adjustment module 42 compares the model precision value after compression processing with the original precision value before compression, if the model precision value is greater than or equal to the original precision value, that is, the calculation precision of the target model is not lost, then the value of the compression parameter can be increased; if the model precision value is less than the original precision value, that is, the target model produces precision loss, then the value of the compression parameter can be reduced. In this way, by judging the change in the calculation precision of the target model before and after compression, the compression parameter is adjusted, and finally the value of the compression parameter suitable for the target model can be obtained, and compressing the target model according to the value can achieve a better compression effect under the premise of ensuring the calculation precision of the target model.
[0092] That is, after obtaining the original calculation accuracy of the target model to perform the calculation task, after the acquisition module 41 obtains the initial value of the compression parameter, the parameter adjustment module 42 can use the compression parameter with the initial value to perform compression processing on the target model, and perform the same calculation processing task as the calculation task performed to obtain the original calculation accuracy on the compressed neural network model obtained after the compression processing to obtain the post-compression calculation accuracy corresponding to the value of the weight parameter of the compression scheme based on which the compression processing is performed on the model. Therefore, the compression effect of the compression processing using the compression weight coefficient of the initial value can be judged based on the post-compression calculation accuracy.
[0093] For example, the parameter adjustment module 42 adjusts the value of the compression parameter based on the comparison result of the two by comparing the calculation accuracy obtained after the compression with the original calculation accuracy of the target model obtained as described above before the compression. For example, after the compression process is performed using the compression parameter with the above-mentioned preset initial value, the model calculation accuracy obtained by the compressed target model by repeatedly performing the above-mentioned calculation does not decrease compared with the original calculation accuracy. Then the comparison result can not only indicate that the compression process using the initial value is successful to a certain extent, and the accuracy of the target model calculation is not degraded, that is, since the number of parameters of the compressed target model must have been reduced compared with the original model, and the repeated execution of the same calculation task as the calculation task performed to obtain the original calculation accuracy can obtain the same or similar calculation accuracy, then it can be said that the compressed target model is usable. On the other hand, the comparison result can also indicate that there may be further compression space when using the initial value to perform compression, because the calculation accuracy of the target model after compression is not degraded, or the parameters removed during the compression process have very little effect on the target model to perform the target calculation task. Then it is easy to think that there is a high probability that there are still parameters that can be removed in the compressed target model. Therefore, by determining the compression parameter according to the change of calculation accuracy before and after compression, a compression parameter value that can achieve a better compression effect can be obtained. Afterwards, the output module 43 outputs the value of the compression parameter adjusted by the parameter adjustment module 42.
[0094] Furthermore, in the embodiment of the present application, the parameter adjustment module 42 may perform the following iterative operations when performing parameter adjustment:
[0095] Compare the model accuracy value with the original accuracy value.
[0096] When the model accuracy value is greater than or equal to the original accuracy value, the value of the compression parameter is increased, the target model is compressed using the current value of the compression parameter, and the calculation accuracy of the compressed target model is obtained to update the model accuracy value.
[0097] When the model accuracy value is less than the original accuracy value, the value of the compression parameter is reduced and the iteration operation ends.
[0098] In the embodiment of the present application, when the parameter adjustment module 42 determines that the model accuracy value is greater than or equal to the original accuracy value, that is, the calculation accuracy of the target model is not lost, the value of the compression parameter can be increased, for example, the compression parameter can be preferably doubled. Then, the current value of the compression parameter, that is, the increased value, is used to compress the target model again, and the calculation accuracy of the target model at this time is obtained, and then the above-mentioned model accuracy value is updated with the calculation accuracy, and the above-mentioned accuracy value comparison operation is continued to be performed to further adjust the parameter value. In this iterative process, when the parameter adjustment module 42 detects that the current model accuracy value is less than the original accuracy value, that is, the target model has a loss of accuracy, it is marked that the value after the last adjustment is the target value, so the operation of reducing the value of the compression parameter can be performed, for example, the value of the compression parameter can be reduced by half, and then the iterative operation is terminated, and the output module 43 outputs the value of the compression parameter adjusted by the parameter adjustment module 42.
[0099] In addition, in an embodiment of the present application, when the ADMM method is used to reduce the number of parameters used by the target model to compress it, when the current network layer of the target model is compressed, the remaining parameter amount of the associated layer of the current network layer can be used as a new constraint of ADMM. The remaining parameter amount of the associated layer in the embodiment of the present application refers to the number of parameters remaining after the associated layer is compressed, wherein the associated layer of the current network layer may be the front layer and / or the back layer of the current layer.
[0100] Therefore, the data processing solution provided in the embodiment of the present application can adjust the value of the compression parameter by judging the change in the computational accuracy of the target model before and after compression, and quickly determine the value of the compression parameter suitable for the target model through an iterative method, thereby achieving a better compression effect while ensuring that the computational accuracy of the target model is not lost.
[0101] Embodiment 5
[0102] The internal functions and structure of the data processing device are described above. The device can be implemented as an electronic device. Figure 5 This is a schematic diagram of the structure of an electronic device embodiment provided by this application. Figure 5 As shown, the electronic device includes a memory 51 and a processor 52 .
[0103] The memory 51 is used to store programs. In addition to the above programs, the memory 51 can also be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, pictures, videos, etc.
[0104] The memory 51 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0105] The processor 51 is not limited to a central processing unit (CPU), but may also be a processing chip such as a graphics processing unit (GPU), a field programmable gate array (FPGA), an embedded neural network processor (NPU) or an artificial intelligence (AI) chip. The processor 52 is coupled to the memory 51 and executes the program stored in the memory 51. When the program is running, the data processing method of the above-mentioned embodiments 2 to 3 is executed.
[0106] Further, if Figure 5 As shown, the electronic device may also include: a communication component 53, a power component 54, an audio component 55, a display 56 and other components. Figure 5 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 5 Components shown.
[0107] The communication component 53 is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device can access a wireless network based on a communication standard, such as WiFi, 3G, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 53 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 53 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0108] The power supply component 54 provides power to various components of the electronic device. The power supply component 54 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device.
[0109] The audio component 55 is configured to output and / or input audio signals. For example, the audio component 55 includes a microphone (MIC), and when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 51 or sent via the communication component 53. In some embodiments, the audio component 55 also includes a speaker for outputting audio signals.
[0110] The display 56 includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0111] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data processing method for determining compression parameters in a compression algorithm, wherein the compression algorithm is used to compress a target model. include: Acquire an initial value of the compression parameter and a model accuracy value corresponding to the initial value, wherein the model accuracy value is a calculation accuracy of the target model after compression using the initial value of the compression parameter; Compare the model accuracy value with the original accuracy value, and adjust the value of the compression parameter according to the comparison result, wherein the original accuracy value is the calculation accuracy of the target model before compression; when the model accuracy value is greater than or equal to the original accuracy value, increase the value of the compression parameter, and use the current value of the compression parameter to compress the target model; using the current value of the compression parameter to compress the target model includes using an alternating direction multiplier method to reduce the number of parameters used by the target model according to the current value of the compression parameter; when compressing the current network layer of the target model, use the remaining parameter amount of the associated layer of the current network layer as a new constraint of the alternating direction multiplier method, wherein the remaining parameter amount of the associated layer is the number of parameters remaining after the associated layer is compressed; The adjusted value of the compression parameter is output.
2. The data processing method according to claim 1, in, The comparing the model precision value with the original precision value and adjusting the value of the compression parameter according to the comparison result includes looping and executing the following iterative operations: Comparing the model accuracy value with the original accuracy value; When the model precision value is greater than or equal to the original precision value, increase the value of the compression parameter, use the current value of the compression parameter to compress the target model, and obtain the calculation precision of the compressed target model to update the model precision value; When the model accuracy value is less than the original accuracy value, the value of the compression parameter is reduced and the iterative operation is terminated.
3. The data processing method according to claim 2, in, The increasing the value of the compression parameter includes: multiplying the value of the compression parameter; or The reducing the value of the compression parameter comprises: The value of the compression parameter is multiplied and reduced.
4. The data processing method according to claim 1, in, The obtaining the initial value of the compression parameter includes: Obtaining the type of the target model; Obtaining historical data of compression parameters corresponding to the type; An initial value of the compression parameter is determined according to the historical data.
5. The data processing method according to claim 4, in, After determining the initial value of the compression parameter according to the historical data, the data processing method further comprises: receiving user feedback input regarding the initial value determined based on the historical data; An initial value of the compression parameter is determined according to the feedback input and an initial value determined according to the historical data.
6. A data processing device for determining compression parameters in a compression algorithm, wherein the compression algorithm is used to compress a target model, wherein the device include: An acquisition module, used for the initial value of the compression parameter and the model accuracy value corresponding to the initial value, wherein the model accuracy value is the calculation accuracy of the target model after compression using the initial value of the compression parameter; A parameter adjustment module, used to compare the model accuracy value with the original accuracy value, and adjust the value of the compression parameter according to the comparison result, wherein the original accuracy value is the calculation accuracy of the target model before compression; when the model accuracy value is greater than or equal to the original accuracy value, increase the value of the compression parameter, and use the current value of the compression parameter to compress the target model; the use of the current value of the compression parameter to compress the target model includes using an alternating direction multiplier method to reduce the number of parameters used by the target model according to the current value of the compression parameter; when compressing the current network layer of the target model, use the remaining parameter amount of the associated layer of the current network layer as a new constraint of the alternating direction multiplier method, wherein the remaining parameter amount of the associated layer is the number of parameters remaining after the associated layer is compressed; The output module is used to output the adjusted value of the compression parameter.
7. An electronic device, in, include: Memory, used to store programs; A processor is used to run the program stored in the memory, and the program executes the data processing method according to any one of claims 1 to 5 when it is run.
8. A computer-readable storage medium having stored thereon a computer program executable by a processor, in, When the program is executed by a processor, the data processing method according to any one of claims 1 to 5 is implemented.
