Method, apparatus and device for model compression training based on deep learning

By using a mapping relationship to store files and obtain compressed parameters during the training of deep learning models, the problems of slow model training speed and high computational resource consumption are solved, achieving faster training speed and lower resource consumption.

CN116432737BActive Publication Date: 2026-03-20SHANGHAI CAMBRICON INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Deep learning models are slow to train and consume a lot of computing resources, mainly because compression parameters need to be calculated in each iteration, which puts a heavy burden on computing devices.

Method used

During the training of deep learning models, by introducing a mapping relationship storage file, the compression parameters of the target operator are obtained and the input data is compressed, reducing the number of times the compression parameters are repeatedly calculated.

Benefits of technology

By reusing the compression parameters, the time spent calculating the compression parameters in each iteration is reduced, thereby improving the model training speed and reducing the consumption of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116432737B_ABST
    Figure CN116432737B_ABST
Patent Text Reader

Abstract

The application provides a method, device and equipment for model compression training based on deep learning. The method comprises: in an iterative process of training a deep learning model, when a target operator is run, input data of the target operator is acquired, the target operator being an operator to be compressed by data; a compression parameter corresponding to the target operator is acquired from a mapping relationship storage file, wherein the mapping relationship storage file comprises a compression parameter corresponding to each target operator; the input data of the target operator is compressed based on the compression parameter corresponding to the target operator to obtain compressed data; and the deep learning model is trained according to the compressed data. The method of the application helps to accelerate the model training speed and reduce the consumption of computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of deep learning and artificial intelligence, and in particular, to a model compression training method and device based on deep learning. BACKGROUND

[0002] With the development of artificial intelligence technology, deep learning models are widely used in image processing, natural language processing and other fields. Deep learning requires a large number of neural networks and operation modules. Based on this requirement, there are currently many deep learning frameworks, such as PyTorch, Caffe, MXNet and TensorFlow. Deep learning frameworks are usually designed based on a computation graph, which can be divided into static and dynamic computation graphs. Static graphs refer to defining and running, and defining multiple times and running multiple times. Dynamic graphs are defined during running, and are constructed during running, and can be constructed and run multiple times. Based on such a functional design idea, operation modules correspond to a node in the graph, and the graph contains multiple operation nodes. Because the dynamic graph idea is intuitive and clear, it is more in line with human thinking, and more and more researches on using dynamic graphs to design deep learning models.

[0003] Deep learning model compression refers to using the redundancy of neural network parameters and the redundancy of network structure to simplify the model, so as to obtain a model with less parameters and more simplified structure without affecting the task completion degree. The compressed model requires less computing resources and memory, and can meet more extensive application requirements compared with the original uncompressed model.

[0004] Currently, in the process of model compression training based on deep learning, when running to an operator that can achieve data compression, the operator needs to calculate the compression parameters according to the input data, and then compress the input data by using the obtained compression parameters. After the data is compressed, the operator calculates to output the result.

[0005] In the iteration process of model training, the compression parameters need to be calculated once in each iteration process, which leads to slow model training speed. The model training process runs on a computing device, which in turn leads to the consumption of a large amount of computing resources of the computing device. SUMMARY

[0006] The present application provides a model compression training method, device and equipment based on deep learning to solve the problems of slow deep learning model training speed and large computing resource consumption.

[0007] In a first aspect, the present application provides a model compression training method based on deep learning, the deep learning model comprising a plurality of operators, the method comprising:

[0008] In an iterative process of training the deep learning model, when a target operator is run, input data of the target operator is obtained, the target operator being an operator whose data is to be compressed;

[0009] A compression parameter corresponding to the target operator is obtained from a mapping relationship storage file, wherein the mapping relationship storage file includes a compression parameter corresponding to each target operator;

[0010] The input data of the target operator is compressed based on the compression parameter corresponding to the target operator to obtain compressed data;

[0011] The deep learning model is trained according to the compressed data.

[0012] In a second aspect, the present application provides a device for model compression training based on deep learning, the deep learning model including a plurality of operators, and the device including:

[0013] An obtaining unit is configured to, in an iterative process of training the deep learning model, obtain input data of a target operator when the target operator is run, the target operator being an operator whose data is to be compressed;

[0014] A mapping unit is configured to obtain a compression parameter corresponding to the target operator from a mapping relationship storage file, wherein the mapping relationship storage file includes a compression parameter corresponding to each target operator;

[0015] A compression unit is configured to compress the input data of the target operator based on the compression parameter corresponding to the target operator to obtain compressed data;

[0016] A training unit is configured to train the deep learning model according to the compressed data.

[0017] In a third aspect, the present application provides a chip including the device for model compression training based on deep learning as described in the second aspect.

[0018] In a fourth aspect, the present application provides a computer device including a processor and a memory in communication connection with the processor, the memory storing computer execution instructions, and the processor executing the computer execution instructions stored in the memory to implement the method for model compression training based on deep learning as described in the first aspect.

[0019] In a fifth aspect, the present application provides a computer readable storage medium, the computer readable storage medium storing computer execution instructions, the computer execution instructions being executed by a processor to implement the method for model compression training based on deep learning as described in the first aspect.

[0020] In a sixth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method for deep learning based model compression training according to the first aspect.

[0021] The method, device and equipment for deep learning based model compression training provided by the present application, the deep learning model comprises a plurality of operators, in the iteration process of training the deep learning model, when running to a target operator, the input data of the target operator is acquired, the target operator is the operator to be compressed; the compression parameter corresponding to the target operator is acquired from the mapping relationship storage file, wherein the mapping relationship storage file comprises the compression parameter corresponding to each target operator; the input data of the target operator is compressed based on the compression parameter corresponding to the target operator to obtain compressed data; and the deep learning model is trained according to the compressed data. Accordingly, the mapping relationship storage file is introduced to store the compression parameter corresponding to the target operator used in the iteration process of training the deep learning model, so that the compression parameter calculated in the previous iteration process can be reused, the probability that the compression parameter of each target operator needs to be calculated once in each iteration process is reduced, and the time required for calculating the compression parameter is reduced, thereby helping to speed up the model training speed and reducing the consumption of computing resources. BRIEF DESCRIPTION OF DRAWINGS

[0022] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0023] Figure 1 A structural diagram of a board card is shown for an exemplary embodiment of the present disclosure;

[0024] Figure 2 A structural diagram of a combined processing device is shown for an exemplary embodiment of the present disclosure;

[0025] Figure 3 An internal structure schematic diagram of a computing device is shown for an exemplary embodiment of the present disclosure;

[0026] Figure 4 An internal structure schematic diagram of a processor core is shown for an exemplary embodiment of the present disclosure;

[0027] Figure 5 A data writing process schematic diagram between processor cores of different clusters is shown for an exemplary embodiment of the present disclosure;

[0028] Figure 6 A flowchart of a deep learning based model compression training method is shown for an exemplary embodiment of the present disclosure;

[0029] Figure 7A flowchart of a deep learning-based model compression training method shown for another exemplary embodiment of the present disclosure;

[0030] Figure 8 A flowchart of a deep learning-based model compression training method shown for another exemplary embodiment of the present disclosure;

[0031] Figure 9 A structural diagram of an apparatus for deep learning-based model compression training shown for an exemplary embodiment of the present disclosure;

[0032] Figure 10 A structural diagram of an apparatus for deep learning-based model compression training shown for another exemplary embodiment of the present disclosure;

[0033] Figure 11 A structural diagram of a computer device shown for an exemplary embodiment of the present disclosure;

[0034] Figure 12 A block diagram of a computer device shown for an exemplary embodiment of the present disclosure.

[0035] The specific embodiments of the present application have been shown through the above-described drawings, and will be described in more detail hereinafter. These drawings and written descriptions are not intended to limit the scope of the present application concept in any way, but to illustrate the present application concept to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0036] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The same or similar components are denoted by the same or similar reference numerals throughout the drawings and the following description, unless otherwise specified. The embodiments described in the following exemplary embodiments do not represent all the embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims. The following description first explains the professional terms related to the present application.

[0037] PyTorch is an open-source deep learning programming framework developed by Facebook, which is suitable for programming languages such as Python and C++, and is used to achieve efficient GPU parallel computing and deep learning network building, with the advantages of easy expansion, fast implementation, and strong production deployment stability.

[0038] The main feature of PyTorch is the tensor calculation similar to Numpy, and the interface design of the new neural network module or Tensor API in PyTorch is simple and has minimal abstraction. The operator module commonly used by PyTorch when building a neural network module includes torch.ops, torch.Tensor.ops, torch.nn.Modules, and torch.nn.functional.ops.

[0039] The operator module interface used by PyTorch to write a neural network module corresponds to a C++ implementation of the same function, and the Python interface defines multiple calling forms to facilitate the construction of a neural network module. However, a function is only a combination of statements that perform a task, and only contains the function name, parameters, function body, and return type. The function call execution mode is to perform a corresponding calculation once, and the return is executed according to the input passed in. The function of the PyTorch calculation module is also the same. In contrast to the implementation of a static graph, the operator in each calculation module is an instance of a class, and the class is object-oriented, allowing multiple functions to be encapsulated.

[0040] Compression of deep learning models refers to the use of redundancy in neural network parameters and network structure to simplify the model. Without affecting the task completion degree, a model with fewer parameters and a more streamlined structure is obtained. The compressed model requires less computing resources and memory, and can meet more extensive application requirements compared to the original uncompressed model.

[0041] Model quantization, as a way of model compression, is a technology that converts floating-point calculations to low-bit fixed-point calculations, which can effectively reduce model calculation intensity, parameter size, and memory consumption. Low bit width can also use high-performance vectorization operations on many hardware platforms. Compared with typical FP32 models, PyTorch supports INT8 quantization, which reduces model size by 4 times and memory bandwidth requirements by 4 times. The corresponding bit width of model quantization can be selected as INT8, INT16, or INT32. Model data quantization can be implemented according to different quantization rules. Generally, quantization parameters are needed to map FP32 data and quantization data, and corresponding quantization parameters can be used to convert FP32 data and quantization data.

[0042] The technical solutions of the present application and how the technical solutions of the present application solve the technical problems raised in the background art will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0043] Figure 1A structural schematic diagram of a board card 10 according to an embodiment of the present disclosure is shown. As shown in Figure 1 The board card 10 includes a chip 101, which is a system on chip (SoC) integrated with one or more combined processing devices, i.e., an artificial intelligence computing unit, to support various deep learning and machine learning algorithms and meet the intelligent processing requirements in complex scenarios in the fields of computer vision, speech, natural language processing, data mining, etc., such as training of deep learning models. In particular, deep learning technology is widely used in cloud intelligent applications, and a significant feature of cloud intelligent applications is a large amount of input data, which has high requirements for the storage and computing capabilities of the platform. The board card 10 of this embodiment is suitable for cloud intelligent applications and has a large amount of off-chip storage, on-chip storage, and a large amount of computing capability.

[0044] The chip 101 is connected to an external device 103 through an external interface device 102. The external device 103 is, for example, a server, a computer, a camera, a display, a mouse, a keyboard, a network card, or a wifi interface, etc. The data to be processed can be transmitted from the external device 103 to the chip 101 through the external interface device 102. The computing result of the chip 101 can be transmitted back to the external device 103 via the external interface device 102. According to different application scenarios, the external interface device 102 can have different interface forms, such as a PCIe interface, etc.

[0045] The board card 10 further includes a storage device 104 for storing data, which includes one or more storage units 105. The storage device 104 is connected and transmits data with the control device 106 and the chip 101 through a bus. The control device 106 in the board card 10 is configured to regulate the state of the chip 101. For this purpose, in one application scenario, the control device 106 can include a micro controller unit (MCU).

[0046] Figure 2 A structural diagram of the combined processing device in the chip 101 according to this embodiment is shown. As shown in Figure 2 The combined processing device 20 includes a computing device 201, an interface device 202, a processing device 203, and a DRAM 204.

[0047] The computing device 201 is configured to perform user-specified operations, mainly implemented as a single-core intelligent processor or a multi-core intelligent processor, to perform deep learning or machine learning calculations, which can interact with the processing device 203 through the interface device 202 to jointly complete the user-specified operations.

[0048] The interface device 202 is used to transmit data and control instructions between the computing device 201 and the processing device 203. For example, the computing device 201 can obtain input data from the processing device 203 via the interface device 202 and write the data into the storage device on the computing device 201. Further, the computing device 201 can obtain control instructions from the processing device 203 via the interface device 202 and write the control instructions into the control buffer on the computing device 201. Alternatively or additionally, the interface device 202 can also read data from the storage device of the computing device 201 and transmit the data to the processing device 203.

[0049] The processing device 203 is a general-purpose processing device, which performs basic control including but not limited to data transfer, starting and / or stopping of the computing device 201, etc. Depending on the implementation, the processing device 203 can be one or more types of processors, including but not limited to a central processing unit (CPU), a graphics processing unit (GPU), or other general-purpose and / or special-purpose processors, such as a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc., and the number thereof can be determined according to actual needs. As mentioned above, only in terms of the computing device 201 of the present disclosure, it can be considered as having a single-core structure or a homogeneous multi-core structure. However, when the computing device 201 and the processing device 203 are considered together, they are considered to form a heterogeneous multi-core structure.

[0050] The DRAM 204 is used to store data to be processed, is a DDR memory, and usually has a size of 16G or more, and is used to save data of the computing device 201 and / or the processing device 203.

[0051] Figure 3 The internal structure of the computing device 201 is shown. The computing device 201 is used to process input data such as computer vision, speech, natural language, data mining, etc. The computing device 201 in the figure adopts a multi-core hierarchical structure design. The computing device 201 is a system-on-a-chip, which includes multiple clusters, and each cluster includes multiple processor cores. In other words, the computing device 201 is composed of a system-on-a-chip-cluster-processor core hierarchy.

[0052] In terms of the system-on-a-chip hierarchy, as shown in the figure, Figure 3As shown, the computing device 201 includes an external storage controller 301, a peripheral communication module 302, an on-chip interconnect module 303, a synchronization module 304, and multiple clusters 305.

[0053] There can be multiple external storage controllers 301; two are shown as an example in the figure. These controllers are used to respond to access requests from the processor core to access external storage devices, such as… Figure 2 The DRAM 204 in the chip allows the computing device 201 to read data from external sources or write data to external sources. The peripheral communication module 302 receives control signals from the processing device 203 via the interface device 202, initiating the computing device 201 to execute tasks. The on-chip interconnect module 303 connects the external storage controller 301, the peripheral communication module 302, and multiple clusters 305 to transmit data and control signals between the modules. The synchronization module 304 is a global barrier controller (GBC) used to coordinate the working progress of each cluster and ensure information synchronization. The multiple clusters 305 are the computing core of the computing device 201. Four are shown exemplary in the figure; however, with hardware development, the computing device 201 disclosed herein may also include 8, 16, 64, or even more clusters 305. The clusters 305 are used to efficiently execute deep learning algorithms.

[0054] From the perspective of cluster hierarchy, such as Figure 3 As shown, each cluster 305 includes multiple processor cores (IPU cores) 306 and one memory core (MEM core) 307.

[0055] Four processor cores 306 are shown in the figure as an example; this disclosure does not limit the number of processor cores 306. Its internal architecture is as follows: Figure 4 As shown. Each processor core 306 includes three main modules: a control module 41, an arithmetic module 42, and a storage module 43.

[0056] The control module 41 coordinates and controls the operation of the computation module 42 and the storage module 43 to complete the deep learning task. It includes an instruction fetch unit (IFU) 411 and an instruction decode unit (IDU) 412. The instruction fetch unit 411 fetches instructions from the processing device 203, and the instruction decode unit 412 decodes the fetched instructions and sends the decoding result as control information to the computation module 42 and the storage module 43.

[0057] The computation module 42 includes a vector operation unit 421 and a matrix operation unit 422. The vector operation unit 421 is used to perform vector operations and can support complex operations such as vector multiplication, addition, and nonlinear transformations; the matrix operation unit 422 is responsible for the core computations of deep learning algorithms, namely matrix multiplication and convolution.

[0058] Storage module 43 is used to store or move related data, including neuron RAM (NRAM) 431, weight RAM (WRAM) 432, input / output direct memory access (IODMA) 433, and move direct memory access (MVDMA) 434. NRAM 431 is used to store input, output data and intermediate results for the processor core 306 to calculate; WRAM 432 is used to store the weights of the deep learning network; IODMA 433 controls the memory access of NRAM 431 / WRAM 432 and DRAM 204 through broadcast bus 309; MVDMA 434 controls the memory access of NRAM 431 / WRAM 432 and SRAM 308.

[0059] Back Figure 3 The storage core 307 is primarily used for storage and communication, namely storing shared data or intermediate results among processor cores 306, and performing communication between cluster 305 and DRAM 204, communication between clusters 305, and communication between processor cores 306. In other embodiments, the storage core 307 has scalar operation capabilities and is used to perform scalar operations.

[0060] Storage core 307 includes a shared memory unit (SRAM) 308, a broadcast bus 309, a cluster direct memory access (CDMA) module 310, and a global direct memory access (GDMA) module 311. SRAM 308 acts as a high-performance data relay station. Data multiplexed between different processor cores 306 within the same cluster 305 does not need to be obtained from DRAM 204 by each processor core 306 individually. Instead, it is relayed between processor cores 306 via SRAM 308. Storage core 307 only needs to quickly distribute the multiplexed data from SRAM 308 to multiple processor cores 306, thereby improving inter-core communication efficiency and significantly reducing on-chip and off-chip I / O access.

[0061] Broadcast bus 309, CDMA 310, and GDMA 311 are used to perform communication between processor cores 306, communication between clusters 305, and data transfer between cluster 305 and DRAM 204, respectively. These will be explained below.

[0062] The broadcast bus 309 is used to complete high-speed communication between the processor cores 306 within the cluster 305. In this embodiment, the broadcast bus 309 supports inter-core communication methods including unicast, multicast, and broadcast. Unicast refers to point-to-point (i.e., data transmission from one processor core to another) data transmission. Multicast is a communication method that transmits a piece of data from SRAM 308 to several specific processor cores 306. Broadcast is a communication method that transmits a piece of data from SRAM 308 to all processor cores 306, and is a special case of multicast.

[0063] CDMA 310 is used to control SRAM 308 access between different clusters 305 within the same computing device 201. Figure 5 This diagram illustrates the operation of CDMA310 when one processor core attempts to write data to another processor core in a different cluster. In this application scenario, the same computing device comprises multiple clusters. For simplicity, only clusters 0 and 1 are shown in the diagram. Both clusters 0 and 1 contain multiple processor cores; similarly, for ease of explanation, only processor core 0 is shown in cluster 0, and only processor core 1 is shown in cluster 1. Processor core 0 intends to write data to processor core 1.

[0064] First, processor core 0 sends a unicast write request to write data into its local SRAM 0. CDMA 0 acts as the master and CDMA 1 acts as the slave. The master pushes the write request to the slave, that is, the master sends the write address AW and the write data W to transmit the data to SRAM 1 of cluster 1. Then, the slave sends a write response B as a response. Finally, processor core 1 of cluster 1 sends a unicast read request to read the data from SRAM 1.

[0065] Back Figure 3The GDMA 311 cooperates with the external memory controller 301 to control the access of the SRAM 308 of the cluster 305 to the DRAM 204 or the reading of data from the DRAM 204 to the SRAM 308. As mentioned above, the communication between the DRAM 204 and the NRAM 431 or the WRAM 432 can be achieved through two channels. The first channel is to directly contact the DRAM 204 and the NRAM 431 or the WRAM 432 through the IODMA 433; the second channel is to first transfer data between the DRAM 204 and the SRAM 308 through the GDMA 311, and then transfer data between the SRAM 308 and the NRAM 431 or the WRAM 432 through the MVDMA 434. Although the second channel seems to involve more elements and the data flow is longer, in fact, in some embodiments, the bandwidth of the second channel is much larger than that of the first channel, so that the communication between the DRAM 204 and the NRAM 431 or the WRAM 432 through the second channel can be more efficient. The embodiments of the present disclosure can select the data transmission channel according to the hardware conditions.

[0066] In other embodiments, the functions of the GDMA 311 and the functions of the IODMA 433 can be integrated in the same component. For the convenience of description, the GDMA 311 and the IODMA 433 are regarded as different components in the present disclosure, and for those skilled in the art, as long as the functions achieved and the technical effects achieved are similar to the present disclosure, they belong to the protection scope of the present disclosure. Further, the functions of the GDMA 311, the functions of the IODMA 433, the functions of the CDMA 310, the functions of the MVDMA 434 can also be realized by the same component, similarly, as long as the functions achieved and the technical effects achieved are similar to the present disclosure, they all belong to the protection scope of the present disclosure.

[0067] Figure 6 A flowchart of a method for deep learning-based model compression training is shown for an exemplary embodiment of the present disclosure.

[0068] As shown in Figure 6 , the method for deep learning-based model compression training shown in the present disclosure includes:

[0069] S601, in the iterative process of training the deep learning model, when running to the target operator, the input data of the target operator is obtained, and the target operator is an operator to be compressed.

[0070] The scheme provided by the present disclosure can be executed by a chip or a computer device with computing capability, for example, the method is applied in the above-mentioned board card, device or processor.

[0071] The training of the deep learning model involves multiple iteration processes, and the model parameters are adjusted through multiple iteration training to realize model convergence. Optionally, the number of model iterations is set according to the training result, for example, the training is ended when the training parameters tend to be stable.

[0072] An operator is a calculation unit in a deep learning algorithm, and a deep learning model includes multiple operators, such as a convolution operator, a full connection operator, an activation operator, a normalization operator, and the like. The target operator is an operator to be compressed, which can be understood as the input data of the target operator needing to be compressed before calculation. The operator to be compressed generally refers to an operator with a large amount of calculation, such as a convolution operator, a full connection operator, and the like. By compressing and simplifying the redundant parameters in the operator with a large amount of calculation, the purpose of reducing calculation and improving training speed is achieved.

[0073] Optionally, the target operator can be determined according to the calculation amount of the operator, and a calculation amount threshold is set. If the calculation amount of the operator is greater than the threshold, the operator is determined as a target operator (an operator to be compressed), otherwise, the operator is not a target operator (an operator to be compressed). Optionally, the target operator can also be determined in advance. Specifically, the target operator is determined in advance among all operators of the deep learning model, and a compression identifier is added to the target operator. The compression identifier is used to represent that the input data of the operator carrying the compression identifier needs to be compressed before calculation. If it is monitored that the current operator carries the compression identifier, the operator is determined as a target operator, and then the input data of the target operator is obtained for subsequent compression.

[0074] S602, obtaining the compression parameter corresponding to the target operator from the mapping relationship storage file, wherein the mapping relationship storage file includes the compression parameter corresponding to each target operator.

[0075] In the quantization training process of the deep learning model, since the weights in the model are gradually changed and tend to be stable, most iterations in the iteration training process can reuse the quantization parameters of the last iteration. The present application records the quantization parameters of the model before the iteration process through the mapping relationship storage file.

[0076] The mapping relationship storage file is used to store the mapping relationship between the model attribute state and the model operator, and the model attribute state includes the compression parameter. After the target operator is determined, the compression parameter corresponding to the target operator can be obtained through the mapping relationship. Optionally, the model attribute state can also include device-related parameters, such as when the device for calculating the compression parameter and the device for data compression are different, the heterogeneous device parameters required for device conversion are needed. The compression parameter corresponding to the target operator in the mapping relationship storage file can be understood as the compression parameter corresponding to the target operator that is most recently used in the model training process. For example, if the current iteration process is the first iteration process, the compression parameter corresponding to the target operator obtained at this time can be the initial value set; if the current iteration process is the Nth iteration process (N is an integer greater than 1), the compression parameter corresponding to the target operator obtained at this time can be the compression parameter corresponding to the target operator used in the (N-1)th iteration process. S603, based on the compression parameter corresponding to the target operator, the input data of the target operator is compressed to obtain compressed data.

[0077] After obtaining the compression parameter corresponding to the target operator, the input data of the target operator can be compressed based on the existing data compression method to obtain compressed data. The compressed data is the compressed input data, and the data amount is smaller than the original input data, and the demand for computing resources and memory is smaller.

[0078] Optionally, in the model quantization, the compression parameter includes the bit width and the quantization coefficient, and the input data of the target operator can be quantized based on the bit width and the quantization coefficient through the existing quantization method to obtain quantized data. For example, the input data is floating-point data FP32, and the quantized data is integer data INT8. The demand for computing resources and memory of the quantized data relative to the input data can be reduced to 1 / 4 of the original.

[0079] Optionally, the compression parameter can also include weight sparsity parameters, operator parallel computing splitting parameters and other parameters that can realize model compression.

[0080] S604, the deep learning model is trained according to the compressed data.

[0081] In each iteration process, the model calculation is performed according to the compressed data to complete the training of the deep learning model, which helps to speed up the model training speed and reduce the consumption of computing resources.

[0082] In this embodiment, a mapping relationship storage file is introduced to store the compression parameters corresponding to the target operators used in the training iteration process of the deep learning model, so that the compression parameters calculated in the previous iteration process can be reused, the probability that the compression parameters of each target operator need to be calculated once in each iteration process is reduced, the time required for calculating the compression parameters is reduced, thereby helping to speed up the model training speed and reduce the consumption of computing resources.

[0083] Figure 7 A flowchart of a method for deep learning-based model compression training is shown for another exemplary embodiment of the present disclosure.

[0084] As shown in Figure 7 The method for deep learning-based model compression training shown in the present disclosure includes:

[0085] S701, in the iteration process of training the deep learning model, when running to the target operator, the input data of the target operator is obtained, and the target operator is an operator to be compressed.

[0086] The implementation of step S701 is similar to that of step S601, which will not be repeated here.

[0087] S702, mapping in the mapping relationship storage file with the operator identifier of the target operator as the key value, obtaining the compression parameter corresponding to the operator identifier of the target operator as the compression parameter corresponding to the target operator, wherein the mapping relationship storage file includes the compression parameter corresponding to each target operator.

[0088] The operator identifier is used to distinguish different operators, and each operator of the deep learning model has a unique operator identifier. Optionally, each operator corresponds to a specific type, parameter and name, and the operator name is unique in the model. The operator name can be used as the operator identifier of the operator.

[0089] Optionally, the attribute state recorded by each operator in the model training process corresponds to the operator identifier one by one. The mapping of the operator identifier and the attribute state is represented by ParamMap. ParamMap can correspond to a Map instance in a programming language or a custom relationship instance, including the creation, modification and query of the mapping relationship. The mapping relationship takes the operator identifier as the key value and the model attribute state Param as the mapping value. ParamMap is a global object of model training, which records the current model attribute state. The model attribute state can include but is not limited to the compression parameter.

[0090] After the mapping relationship is created, the mapping relationship is stored to obtain a mapping relationship storage file. In the mapping relationship storage file, the compression parameter of the target operator and the operator identifier are also in one-to-one correspondence. Therefore, the compression parameter corresponding to the operator identifier of the target operator can be obtained by mapping the operator identifier of the target operator in the mapping relationship storage file, that is, the compression parameter corresponding to the target operator is obtained. Accordingly, by storing and maintaining the mapping relationship between the compression parameter and the operator identifier, the model can load the stored compression parameter in the previous iteration training in the next iteration training, which facilitates the preservation analysis and processing of the compression parameter in the model training process.

[0091] Optionally, a mapping relationship between the operator identifier and the compression parameter is established by taking the operator identifier as a key value and taking the compression parameter as a mapping value. The mapping relationship is stored by serialization to obtain a mapping relationship storage file.

[0092] Serialization refers to a process of converting an object into a byte sequence. After the mapping relationship between the operator identifier and the compression parameter is established, the mapping relationship is stored by serialization, so that the mapping relationship can be converted into an ordered byte stream, which is beneficial to guarantee the integrity and transmissibility of data, so as to be saved in a local file or transmitted on a network.

[0093] Optionally, the compression parameter corresponding to the target operator is obtained from the mapping relationship storage file, including: the mapping relationship between the operator identifier and the compression parameter is obtained by reconstructing the mapping relationship storage file by deserialization; and the matching compression parameter is determined as the compression parameter corresponding to the target operator based on the matching of the operator identifier of the target operator in the mapping relationship.

[0094] Deserialization refers to a process of restoring a byte sequence into an object. The mapping relationship storage file is saved in the form of a byte stream. The object state and description information saved in the byte stream are reconstructed by deserialization to obtain the mapping relationship between the operator identifier and the compression parameter. Then, the matching compression parameter is determined as the compression parameter corresponding to the target operator based on the matching of the operator identifier of the target operator in the mapping relationship, that is, the compression parameter corresponding to the operator identifier of the target operator is queried in the mapping relationship.

[0095] S703, if it is determined based on the preset strategy that the compression parameter corresponding to the target operator does not need to be updated, the input data of the target operator is compressed according to the compression parameter corresponding to the target operator to obtain compressed data.

[0096] The preset strategy is used to determine whether the compression parameter corresponding to the target operator obtained from the mapping relationship storage file needs to be updated. If the obtained compression parameter can be applied to compress the input data of the target operator in the current iteration process, the compression parameter can not need to be updated; if the obtained compression parameter cannot be applied to compress the input data of the target operator in the current iteration process, the compression parameter needs to be updated.

[0097] Optionally, whether the compression parameter corresponding to the target operator needs to be updated is related to the input data of the target operator. For example, in the current iteration process, the compression parameter corresponding to the target operator obtained from the mapping relationship storage file is the compression parameter corresponding to the target operator used in the last iteration process. If the input data of the target operator in the current iteration process is relatively small compared with the input data of the target operator in the last iteration process, the compression parameter corresponding to the target operator can not need to be updated; if the input data of the target operator in the current iteration process is relatively large compared with the input data of the target operator in the last iteration process, the compression parameter corresponding to the target operator can need to be updated.

[0098] Optionally, the preset strategy is whether the data range of the input data of the target operator after being compressed by the compression parameter corresponding to the target operator is within a preset range.

[0099] The preset range refers to an expected range of the compressed data. The expected range of the compressed data is determined by the compression target. For example, if the compression target is 8-bit integer data, the corresponding preset range is -128-127.

[0100] Specifically, after obtaining the compression parameter corresponding to the target operator from the mapping relationship storage file, the input data of the target operator can be compressed based on the compression parameter by using an existing data compression method to obtain compressed data, and it is determined whether the data range of the compressed data is within a preset range.

[0101] Optionally, determining that the compression parameter corresponding to the target operator does not need to be updated based on the preset strategy includes: if the data range is within the preset range, determining that the compression parameter corresponding to the target operator does not need to be updated.

[0102] The data range being within the preset range indicates that the compression parameter corresponding to the target operator obtained from the mapping relationship storage file can be applied to compress the input data of the target operator in the current iteration process, so that the compression parameter corresponding to the target operator in the mapping relationship storage file does not need to be updated, and is directly reused, i.e., the compression parameter does not need to be recalculated, thereby reducing the time required for calculating the compression parameter, accelerating the model training speed, and reducing the consumption of computing resources.

[0103] S704, if it is determined that the compression parameter corresponding to the target operator needs to be updated based on the preset strategy, a new compression parameter is calculated according to the input data of the target operator, and the input data of the target operator is compressed according to the new compression parameter to obtain compressed data.

[0104] Optionally, the determining that the compression parameter corresponding to the target operator needs to be updated based on the preset strategy comprises: if the data range is not within the preset range, determining that the compression parameter corresponding to the target operator needs to be updated.

[0105] The data range not being within the preset range indicates that the compression parameter corresponding to the target operator obtained from the mapping relationship storage file is not suitable for compressing the input data of the target operator in the current iteration process, and thus the compression parameter corresponding to the target operator in the mapping relationship storage file needs to be updated, i.e., the compression parameter needs to be recalculated to ensure that the data obtained after compression meets the expected requirements.

[0106] Specifically, the new compression parameter corresponding to the target operator can be calculated according to the input data of the target operator in the current iteration process by using an existing compression parameter calculation method. After obtaining the new compression parameter, the input data of the target operator can be compressed based on the new compression parameter by using an existing data compression method to obtain compressed data.

[0107] Optionally, the compression parameter corresponding to the target operator in the mapping relationship storage file is updated to the new compression parameter.

[0108] After obtaining the new compression parameter corresponding to the target operator, the compression parameter corresponding to the target operator in the mapping relationship storage file is updated to the new compression parameter, which can specifically be that the new compression parameter replaces the original compression parameter. In this way, the update of the compression parameter in the mapping relationship storage file is realized, which facilitates subsequent iteration and reuse.

[0109] S705, training the deep learning model according to the compressed data.

[0110] The implementation manner of step S705 is similar to that of step S604, which will not be described here.

[0111] Figure 8 A flowchart of a method of deep learning-based model compression training according to another exemplary embodiment of the present disclosure.

[0112] As shown in Figure 8 the method of deep learning-based model compression training according to the present disclosure comprises:

[0113] S801, in the iteration process of training the deep learning model, when running to the target operator, obtaining the input data of the target operator, the target operator is the operator to be compressed.

[0114] The implementation manner of step S801 is similar to that of step S601, which will not be described here.

[0115] S802, mapping the operator identifier of the target operator as the key value in the mapping relationship storage file to obtain the compression parameter corresponding to the operator identifier of the target operator as the compression parameter corresponding to the target operator, wherein the mapping relationship storage file includes the compression parameter corresponding to each target operator.

[0116] The implementation manner of step S802 is similar to that of step S702, which will not be described here.

[0117] S803, when it is determined that the preset update interval number is reached, determining whether the compression parameter corresponding to the target operator needs to be updated based on the preset strategy.

[0118] The update interval number refers to the iteration number interval between adjacent two times of judging whether the compression parameter needs to be updated. For example, if the last time of judging whether the compression parameter needs to be updated is at the Nth iteration, the update interval number is K times, then the next time of judging whether the compression parameter needs to be updated is at the N+Kth iteration, and when it is determined that the current iteration number is N+K, it is determined that the preset update interval number is reached, and whether the compression parameter corresponding to the target operator needs to be updated is determined based on the preset strategy.

[0119] The preset update interval number can be set according to actual needs, which is not limited here. Optionally, the preset update interval number is 1 time, that is, the judgment of whether the compression parameter needs to be updated is performed every iteration to ensure that the data obtained after compression of the compression parameter meets the expected requirements.

[0120] Optionally, when it is determined that the compression parameter corresponding to the target operator does not need to be updated for a preset number of consecutive times based on the preset strategy, the preset update interval number is adjusted, and the adjusted update interval number is greater than the preset update interval number; when it is determined that the adjusted update interval number is reached, whether the compression parameter corresponding to the target operator needs to be updated is determined based on the preset strategy.

[0121] When it is determined that the compression parameter corresponding to the target operator does not need to be updated for a preset number of consecutive times based on the preset strategy, it means that the model training tends to be stable, and the compression parameter used in the previous iteration process can be directly reused in the subsequent iteration process with high probability. Therefore, the preset update interval number is adjusted to increase the update interval number, so as to reduce unnecessary judgment of whether the compression parameter needs to be updated. The preset number of consecutive times can be set according to actual conditions, which is not limited here.

[0122] After adjusting the update interval, the adjusted interval replaces the original preset interval and serves as the interval between two consecutive checks whether the compressed parameters need updating. This reduces the time spent on unnecessary parameter updates, thereby accelerating model training and reducing computational resource consumption.

[0123] S804 If it is determined based on a preset strategy that the compression parameters corresponding to the target operator do not need to be updated, then the input data of the target operator is compressed according to the compression parameters corresponding to the target operator to obtain compressed data.

[0124] The implementation of step S804 is similar to that of step S703, and will not be described in detail here.

[0125] S805, if it is determined based on a preset strategy that the compression parameters corresponding to the target operator need to be updated, then calculate the new compression parameters according to the input data of the target operator, and compress the input data of the target operator according to the new compression parameters to obtain compressed data.

[0126] The implementation of step S805 is similar to that of step S704, and will not be described in detail here.

[0127] S806 trains deep learning models based on compressed data.

[0128] The implementation of step S806 is similar to that of step S604, and will not be described in detail here.

[0129] It should be understood that the above examples can be used as independent embodiments, or at least some of them can be combined to obtain new embodiments, and this embodiment does not limit the specific combination of the embodiments.

[0130] Figure 9 This is a schematic diagram of a device for compressed training of a deep learning-based model, which is an exemplary embodiment of the present disclosure. The device may be a software module or a hardware module, or a combination of both, as part of a computer device.

[0131] like Figure 9 As shown, the apparatus 900 for compressed training of deep learning-based models disclosed herein includes:

[0132] The acquisition unit 910 is used to acquire the input data of the target operator when the training process of the deep learning model reaches the target operator during the iteration process. The target operator is the operator whose data is to be compressed.

[0133] The mapping unit 920 is used to obtain the compression parameters corresponding to the target operator from the mapping relationship storage file, wherein the mapping relationship storage file includes the compression parameters corresponding to each target operator;

[0134] Compression unit 930 is used to compress the input data of the target operator based on the compression parameters corresponding to the target operator to obtain compressed data;

[0135] Training unit 940 is used to train deep learning models based on compressed data.

[0136] Figure 10 This is a schematic diagram of the structure of an apparatus for compressed training of a deep learning-based model, as shown in another exemplary embodiment of this disclosure.

[0137] like Figure 10 As shown, the apparatus 1000 for compressed training of deep learning-based models disclosed in this disclosure, in Figure 9 Based on the embodiment shown, the mapping unit 920 is specifically used to: map the target operator's operator identifier in the mapping relationship storage file using the target operator's operator identifier as the key value, and obtain the compression parameter corresponding to the target operator's operator identifier, which is then used as the compression parameter corresponding to the target operator.

[0138] Optionally, the compression unit 930 includes:

[0139] The first compression module 931 is used to compress the input data of the target operator according to the compression parameters corresponding to the target operator if it is determined based on a preset strategy that the compression parameters corresponding to the target operator do not need to be updated, so as to obtain compressed data.

[0140] The second compression module 932 is used to calculate new compression parameters based on the input data of the target operator if it is determined based on a preset strategy that the compression parameters corresponding to the target operator need to be updated, and to compress the input data of the target operator based on the new compression parameters to obtain compressed data.

[0141] Optionally, the compression unit 930 further includes:

[0142] The update module 933 is used to update the compression parameters corresponding to the target operator in the mapping relationship storage file to the new compression parameters after calculating the new compression parameters based on the input data of the target operator.

[0143] Optionally, the preset strategy is whether the range of data obtained after compression of the input data of the target operator by the compression parameters corresponding to the target operator is within a preset range; the compression unit 930 further includes:

[0144] The first determining module 934 is used to determine that if the data range is within a preset range, the compression parameters corresponding to the target operator do not need to be updated.

[0145] The second determining module 935 is configured to determine that the compression parameter corresponding to the target operator needs to be updated if the data range is not within the preset range.

[0146] Optionally, the compression unit 930 further includes:

[0147] The determining module 936 is configured to determine whether the compression parameter corresponding to the target operator needs to be updated based on a preset strategy when it is determined that the preset number of update intervals is reached.

[0148] Optionally, the compression unit 930 further includes:

[0149] The adjusting module 937 is configured to adjust the preset number of update intervals when it is determined based on the preset strategy that the compression parameter corresponding to the target operator does not need to be updated for a preset number of times in succession, the adjusted number of update intervals being greater than the preset number of update intervals.

[0150] Optionally, the apparatus 1000 further includes:

[0151] The storage unit 950 is configured to establish a mapping relationship between the operator identifier and the compression parameter by taking the operator identifier as a key value and taking the compression parameter as a mapping value, and store the mapping relationship by serialization to obtain a mapping relationship storage file.

[0152] Optionally, the mapping unit 920 is specifically configured to reconstruct the mapping relationship by deserialization on the mapping relationship storage file to obtain the mapping relationship between the operator identifier and the compression parameter, and determine the matched compression parameter as the compression parameter corresponding to the target operator based on the matching of the operator identifier of the target operator in the mapping relationship.

[0153] The specific limitations of the apparatus for deep learning-based model compression training can be referred to the limitations of the method for deep learning-based model compression training in the foregoing, which will not be repeated here. Each unit and module in the apparatus for deep learning-based model compression training can be realized by software, hardware, and combinations thereof, in whole or in part. Each unit and module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each unit and module.

[0154] Figure 11 FIG. 1 shows a structural schematic diagram of a computer device according to an example embodiment of the present disclosure.

[0155] As shown in FIG. 1, the computer device includes a processor 910, a memory 920, a communication interface 930, and a communication bus 940. Figure 11As shown, the computer device disclosed herein includes: a processor 1101 and a memory 1102 communicatively connected to the processor 1101; the memory 1102 stores computer execution instructions; the processor 1101 executes the computer execution instructions stored in the memory 1102 to implement the method provided in the above embodiments.

[0156] The computer device also includes a receiver 1103 and a transmitter 1104. The receiver 1103 is used to receive instructions and data sent by external devices, and the transmitter 1104 is used to send instructions and data to external devices.

[0157] Figure 12 This is a block diagram illustrating an exemplary embodiment of the present disclosure, which may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.

[0158] The device 1200 may include one or more of the following components: a processing component 1202, a memory 1204, a power supply component 1206, a multimedia component 1208, an audio component 1210, an input / output (I / O) interface 1212, a sensor component 1214, and a communication component 1216.

[0159] Processing component 1202 typically controls the overall operation of device 1200, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1202 may include one or more processors 1220 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1202 may include one or more modules to facilitate interaction between processing component 1202 and other components. For example, processing component 1202 may include a multimedia module to facilitate interaction between multimedia component 1208 and processing component 1202.

[0160] Memory 1204 is configured to store various types of data to support the operation of device 1200. Examples of such data include instructions for any application or method operating on device 1200, contact data, phonebook data, messages, pictures, videos, etc. Memory 1204 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 storage, flash memory, magnetic disk, or optical disk.

[0161] Power component 1206 provides power to various components of device 1200. Power component 1206 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 1200.

[0162] Multimedia component 1208 includes a screen providing an output interface between device 1200 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, multimedia component 1208 includes a front camera and / or a rear camera. When device 1200 is in an operation mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0163] Audio component 1210 is configured to output and / or input audio signals. For example, audio component 1210 includes a microphone (MIC) configured to receive external audio signals when device 1200 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in memory 1204 or transmitted via communication component 1216. In some embodiments, audio component 1210 also includes a speaker for outputting audio signals.

[0164] I / O interface 1212 provides an interface between processing component 1202 and peripheral interface modules, which can be a keyboard, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0165] The sensor component 1214 includes one or more sensors for providing status assessments for various aspects of the device 1200. For example, the sensor component 1214 can detect an open / closed position of the device 1200, relative positioning of components, such as a display and keypad of the device 1200, a change in position of the device 1200 or a component of the device 1200, presence or absence of user contact with the device 1200, orientation or acceleration / deceleration of the device 1200, and temperature changes of the device 1200. The sensor component 1214 can include proximity sensor(s) configured to detect presence of an object in proximity thereto without any physical contact. The sensor component 1214 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 1214 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0166] The communication component 1216 is configured to facilitate wired or wireless communication between the device 1200 and another device. The device 1200 can access a wireless network based on a corresponding communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1216 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 1216 further 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.

[0167] In an exemplary embodiment, the device 1200 can be implemented using one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, or other electronic units to perform the above-described methods.

[0168] In an exemplary embodiment, a non-transitory computer readable storage medium including instructions, such as the memory 1204 including instructions, is also provided, which can be executed by the processor 1220 of the device 1200 to perform the above-described methods. For example, the non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.

[0169] The embodiment of the present disclosure further provides a non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a computer device, the computer device can execute the method provided by any of the above embodiments.

[0170] The embodiment of the present disclosure further provides a computer program product, the computer program product comprises: a computer program, the computer program is stored in a readable storage medium, at least one processor of a computer device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the computer device executes the method provided by any of the above embodiments.

[0171] It should be understood that the terms "first", "second" and the like in the above embodiments are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality of" is at least two.

[0172] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The application is intended to cover any variations, uses or adaptations of the application following the general principles thereof and including such departures from the present disclosure as come within known or customary practice in the art to which the application pertains. The specification and examples are to be regarded as illustrative only, and the true scope and spirit of the application are indicated by the following claims.

[0173] It should be understood that the present application is not limited to the precise structures described above and shown in the drawings and that various modifications and changes can be made without departing from the scope thereof. The scope of the present application is limited only by the claims appended hereto.

Claims

1. A method for compressed training of a deep learning-based model, the method being applied to a chip or computer device with computing power, the method being applied to image processing or natural language processing, characterized in that, The deep learning model includes multiple operators, and the method includes: During the iterative training of a deep learning model, when the process reaches the target operator, the input data of the target operator is obtained, where the target operator is the operator whose data is to be compressed. Obtain the compression parameters corresponding to the target operator from the mapping relationship storage file, wherein the mapping relationship storage file includes compression parameters corresponding to each target operator; If it is determined based on a preset strategy that the compression parameters corresponding to the target operator do not need to be updated, then the input data of the target operator is compressed according to the compression parameters corresponding to the target operator to obtain compressed data; the preset strategy is whether the range of data obtained after the input data of the target operator is compressed by the compression parameters corresponding to the target operator is within a preset range; If it is determined based on a preset strategy that the compression parameters corresponding to the target operator need to be updated, then the new compression parameters are calculated based on the input data of the target operator, and the input data of the target operator is compressed based on the new compression parameters to obtain compressed data. The deep learning model is trained based on the compressed data.

2. The method according to claim 1, characterized in that, Obtain the compression parameters corresponding to the target operator from the mapping relationship storage file, including: The operator identifier of the target operator is used as the key to perform mapping in the mapping relationship storage file to obtain the compression parameter corresponding to the operator identifier of the target operator, which is then used as the compression parameter corresponding to the target operator.

3. The method according to claim 2, characterized in that, After calculating the new compression parameters based on the input data of the target operator, the process further includes: The compression parameters corresponding to the target operator in the mapping relationship storage file are updated to the new compression parameters.

4. The method according to claim 1, characterized in that, Determining that the compression parameters corresponding to the target operator do not need to be updated based on a preset strategy includes: if the data range is within the preset range, then determining that the compression parameters corresponding to the target operator do not need to be updated; Determining that the compression parameters corresponding to the target operator need to be updated based on a preset strategy includes: if the data range is not within the preset range, then determining that the compression parameters corresponding to the target operator need to be updated.

5. The method according to claim 1, characterized in that, Before determining, based on a preset strategy, that the compression parameters corresponding to the target operator do not need to be updated, the process further includes: When the preset update interval number is reached, a preset strategy is used to determine whether the compression parameters corresponding to the target operator need to be updated.

6. The method according to claim 5, characterized in that, Also includes: When it is determined based on a preset strategy that the compression parameter corresponding to the target operator does not need to be updated for a preset number of consecutive times, the preset update interval number is adjusted, and the adjusted update interval number is greater than the preset update interval number. When the adjusted update interval number is reached, a preset strategy is used to determine whether the compression parameters corresponding to the target operator need to be updated.

7. The method according to any one of claims 1-6, characterized in that, Also includes: Establish a mapping relationship between operator identifiers and compression parameters, using operator identifiers as keys and compression parameters as mapping values; The mapping relationship is stored by serialization to obtain a mapping relationship storage file.

8. The method according to claim 7, characterized in that, Obtain the compression parameters corresponding to the target operator from the mapping relationship storage file, including: The mapping relationship storage file is reconstructed by deserialization to obtain the mapping relationship between operator identifiers and compression parameters; The operator identifier of the target operator is matched in the mapping relationship, and the matched compression parameter is determined as the compression parameter corresponding to the target operator.

9. A device for compressed training of a deep learning-based model, the device being applied to a chip or computer device with computing power, the device being applied to image processing or natural language processing, characterized in that, The deep learning model includes multiple operators, and the device includes: The acquisition unit is used to acquire the input data of the target operator when the training process of the deep learning model reaches the target operator during the iteration process. The target operator is the operator whose data is to be compressed. A mapping unit is used to obtain compression parameters corresponding to the target operator from a mapping relationship storage file, wherein the mapping relationship storage file includes compression parameters corresponding to each target operator; Compression unit, the compression unit comprising: The first compression module is used to compress the input data of the target operator according to the compression parameters corresponding to the target operator if it is determined based on a preset strategy that the compression parameters corresponding to the target operator do not need to be updated, so as to obtain compressed data; the preset strategy is whether the range of data obtained after the input data of the target operator is compressed by the compression parameters corresponding to the target operator is within a preset range. The second compression module is used to calculate new compression parameters based on the input data of the target operator if it is determined based on a preset strategy that the compression parameters corresponding to the target operator need to be updated, and to compress the input data of the target operator based on the new compression parameters to obtain compressed data. The training unit is used to train the deep learning model based on the compressed data.

10. A chip, characterized in that, The chip includes the apparatus for compressed training of deep learning-based models as described in claim 9.

11. A computer device, characterized in that, include: A processor and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-8.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.

13. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Quantification processing method and device of neural network model, equipment and storage medium

    CN113255877A

  • Data processing method, device, computer equipment and storage medium

    US20210117768A1