Model deployment method and device of storage and calculation integrated equipment, electronic equipment and medium
By optimizing the import and pruning of model weight parameters in an integrated storage and computing device, combined with weight accuracy compensation, the problem of storage capacity matching and accuracy defects in model deployment is solved, and computing efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202311469016.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-07
- Publication Date
- 2024-10-18
AI Technical Summary
When using an integrated storage and computing device to calculate the weight parameters of a neural network model based on a multi-head attention mechanism, there is a lack of matching between the overall model scale and the storage capacity of the integrated storage and computing device, resulting in difficulty in optimizing during the deployment process and the problem of compensation for accuracy defects. .
By obtaining the model to be deployed, according to the storage capacity of the storage and computing unit array, the import and pruning process of the weight parameters is optimized to ensure that the weight parameters of each network layer are suitable for storage in one or more storage and processing unit arrays, and passed Weight accuracy compensation is adjusted until a predetermined accuracy threshold is met.
It achieves a match between the overall model scale and the storage capacity of the integrated storage and computing device during the model deployment process, effectively compensates for the accuracy defects caused by the inherent non-ideal characteristics of the equipment and the model scale, and improves computing efficiency and accuracy.
Smart Images

Figure CN118798295A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a model deployment method, apparatus, electronic device and medium for a storage-computing integrated device. Background Art
[0002] The storage-computation technology is a technology that uses a memory cross array to realize matrix-vector multiplication. By presetting weight parameters to the memory array, in-situ calculations can be realized in the storage unit to obtain the required calculation results. The storage-computation device based on memristors mainly uses the non-volatile resistance of the device to encode the data matrix into the resistance value of the device. By using Ohm's law, a voltage is applied to one side of the device and the current is read on the other side, completing a multiplication operation between voltage and conductance. The device can be prepared in a cross-shaped manner to realize multiplication operations in multiple dimensions. In this matrix multiplication and addition operation, only one voltage application operation is required, and then the output current signal of each column is collected to obtain the result of a matrix-vector multiplication operation. Since the entire operation process does not need to repeatedly read a large number of model parameters from the memory, the bottleneck of the von Neumann architecture is bypassed, so the energy efficiency ratio is significantly improved, which has obvious advantages in memory-intensive computing scenarios such as artificial intelligence computing, image retrieval, and communication encoding and decoding.
[0003] At present, in the use of storage and computing integrated devices to implement weight parameter calculations of neural network models such as those based on multi-head attention mechanisms, there is a lack of effective matching methods between the overall model scale and the storage capacity of the storage and computing integrated devices. During the deployment of weight parameters to the storage and computing integrated devices, it is difficult to optimize the deployment according to the model characteristics, and there is a lack of effective compensation for the accuracy defects caused by the intrinsic non-ideal characteristics of the storage and computing integrated devices. Summary of the invention
[0004] The present disclosure is proposed in view of the above problems. The present disclosure provides a model deployment method, device, electronic device and medium for a storage-computing integrated device.
[0005] According to one aspect of the present disclosure, a model deployment method for a storage-computing integrated device is provided, comprising: obtaining a model to be deployed for the storage-computing integrated device, wherein the storage-computing integrated device comprises a plurality of storage-computing processing unit arrays, and the model to be deployed comprises a plurality of cascaded network layers, the plurality of network layers comprising an input layer, an output layer, and an intermediate layer between the input layer and the output layer; and importing weight parameters of the plurality of network layers into the storage-computing integrated device based at least on the storage capacity of the plurality of storage-computing processing unit arrays, wherein the weight parameters of each network layer are imported in order from the input layer to the output layer.
[0006] In addition, according to one aspect of the present disclosure, a model deployment method for a storage-computing integrated device is provided, wherein, based at least on the storage capacity of multiple storage-computing processing unit arrays, the weight parameters of multiple network layers are imported into the storage-computing integrated device, including: when the storage capacity required for the weight parameters of one network layer among the multiple network layers is not greater than the storage capacity of one storage-computing processing unit array among the multiple storage-computing processing unit arrays, the weight parameters of one network layer are imported into one storage-computing processing unit array; and when the storage capacity required for the weight parameters of one network layer among the multiple network layers is greater than the storage capacity of one storage-computing processing unit array among the multiple storage-computing processing unit arrays, the weight parameters of one network layer are imported into two or more storage-computing processing unit arrays among the multiple storage-computing processing unit arrays, and information communication is enabled between the two or more storage-computing processing unit arrays.
[0007] In addition, according to one aspect of the present disclosure, a model deployment method for a storage-computing integrated device, wherein obtaining a model to be deployed for the storage-computing integrated device, includes: obtaining an initial model for the storage-computing integrated device, and determining the storage capacity required for weight parameters of the initial model; when the storage capacity required for the weight parameters of the initial model is greater than the storage capacity of an array of multiple storage-computing processing units, performing pruning on the initial model; determining the initial model after pruning as the model to be deployed, wherein the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of an array of multiple storage-computing processing units.
[0008] In addition, according to one aspect of the present disclosure, a model deployment method for a storage-computing integrated device is provided, in which pruning processing is performed on the initial model, including: determining the granularity parameters of the pruning processing based on the storage capacity required for the weight parameters of the initial model and the storage capacity of multiple storage-computing processing unit arrays; and performing pruning processing in order from the output layer to the input layer until the storage capacity required for the weight parameters of the model to be deployed is no greater than the storage capacity of multiple storage-computing processing unit arrays.
[0009] In addition, according to one aspect of the present disclosure, the model deployment method for a storage and computing integrated device also includes: determining the accuracy of the model to be deployed; when the accuracy of the model to be deployed is lower than a predetermined threshold, fixing the weight parameters stored in the array of multiple storage and computing processing units, and adjusting the weight accuracy compensation parameters until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameters is not lower than the predetermined threshold.
[0010] According to another aspect of the present disclosure, a model deployment apparatus for a storage-computing integrated device is provided, comprising: a model acquisition unit, configured to acquire a model to be deployed for the storage-computing integrated device, wherein the storage-computing integrated device comprises a plurality of storage-computing processing unit arrays, and the model to be deployed comprises a plurality of cascaded network layers, the plurality of network layers comprising an input layer, an output layer, and an intermediate layer between the input layer and the output layer; and a model deployment unit, configured to import weight parameters of a plurality of network layers into the storage-computing integrated device based at least on the storage capacity of the plurality of storage-computing processing unit arrays, wherein the weight parameters of each network layer are imported in order from the input layer to the output layer.
[0011] In addition, according to another aspect of the present disclosure, a model deployment device for a storage and computing integrated device, wherein the model deployment unit is further configured to: when the storage capacity required for the weight parameters of one network layer among multiple network layers is not greater than the storage capacity of one storage and computing processing unit array among multiple storage and computing processing unit arrays, import the weight parameters of one network layer into one storage and computing processing unit array; and when the storage capacity required for the weight parameters of one network layer among multiple network layers is greater than the storage capacity of one storage and computing processing unit array among multiple storage and computing processing unit arrays, import the weight parameters of one network layer into two or more storage and computing processing unit arrays among multiple storage and computing processing unit arrays, and information communication can be enabled between the two or more storage and computing processing unit arrays.
[0012] In addition, according to another aspect of the present disclosure, a model deployment device for a storage-computing integrated device is provided, wherein the model acquisition unit is further configured to: obtain an initial model for the storage-computing integrated device, and determine the storage capacity required for the weight parameters of the initial model; when the storage capacity required for the weight parameters of the initial model is greater than the storage capacity of an array of multiple storage-computing processing units, perform pruning on the initial model; determine the initial model after pruning as the model to be deployed, wherein the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of an array of multiple storage-computing processing units.
[0013] In addition, according to another aspect of the present disclosure, a model deployment device for a storage and computing integrated device is provided, wherein the model acquisition unit is further configured to: determine the granularity parameters of the pruning process based on the storage capacity required for the weight parameters of the initial model and the storage capacity of multiple storage and computing processing unit arrays; perform the pruning process in order from the output layer to the input layer until the storage capacity required for the weight parameters of the model to be deployed is no greater than the storage capacity of multiple storage and computing processing unit arrays.
[0014] In addition, according to another aspect of the present disclosure, a model deployment device for a storage and computing integrated device also includes an accuracy compensation unit, which is configured to: determine the accuracy of the model to be deployed; when the accuracy of the model to be deployed is lower than a predetermined threshold, fix the weight parameters stored in the array of multiple storage and computing processing units, and adjust the weight accuracy compensation parameters until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameters is not lower than the predetermined threshold.
[0015] According to another aspect of the present disclosure, there is provided an electronic device, comprising: a memory for storing computer-readable instructions; and a processor for executing the computer-readable instructions so that the electronic device executes the model deployment method for a storage-computing integrated device as described above.
[0016] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium is provided for storing computer-readable instructions. When the computer-readable instructions are executed by a processor, the processor executes the model deployment method for the storage-computing integrated device as described above.
[0017] As will be described in detail below, according to the model deployment method, apparatus, electronic device and medium for the storage-computing integrated device according to the embodiments of the present disclosure, the weight parameters of the model are optimized and deployed in the storage-computing integrated device according to the model characteristics, and the overall model scale is effectively matched with the storage capacity of the storage-computing integrated device. In addition, weight precision compensation is introduced to effectively compensate for the intrinsic non-ideal characteristics of the storage-computing integrated device and the precision defects caused by model scale control.
[0018] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0020] Figure 1 It is a schematic diagram of a storage-computing integrated device that illustrates the application of the model deployment method according to an embodiment of the present disclosure.
[0021] Figure 2 and Figure 3 Schematic diagram of a neural network architecture that illustrates the application of the model deployment method according to an embodiment of the present disclosure.
[0022] Figure 4 It is a flowchart illustrating a model deployment method for a storage-computing integrated device.
[0023] Figure 5 It is a schematic diagram showing the model deployment of a storage-computing integrated device.
[0024] Figure 6 and Figure 7 It is a flowchart and a schematic diagram that further illustrate the pruning process of the model deployment method according to an embodiment of the present disclosure.
[0025] Figure 8 and Fig. 9 It is a flowchart and a schematic diagram that further illustrate the accuracy compensation processing of the model deployment method according to an embodiment of the present disclosure.
[0026] Fig.10 is a block diagram illustrating a model deployment apparatus according to an embodiment of the present disclosure.
[0027] Fig.11 is a hardware block diagram illustrating an electronic device according to an embodiment of the present disclosure.
[0028] Fig.12 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present disclosure more obvious, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.
[0030] First, refer to Figure 1 Describe a storage and computing integrated device that applies the model deployment method according to an embodiment of the present disclosure.
[0031] like Figure 1 As shown, the storage-computing integrated device 10 to which the model deployment method according to the embodiment of the present disclosure is applied includes a global processing unit 101, a regular processing unit 102, a storage-computing processing unit 103, and a cache unit 104. The storage-computing integrated device 10 can be, for example, a storage-computing integrated chip or any electronic device equipped with a storage-computing integrated chip.
[0032] The global processing unit 101 is used to schedule task pipelines to the conventional processing unit 102 and the storage and computing processing unit 103 as needed. The conventional processing unit 102 can be, for example, a central processing unit (CPU) or a graphics processing unit (GPU). The storage and computing processing unit 103 is implemented based on a memristor (RRAM, Resistive Random Access Memory) array, which is used to perform multiplication and addition operations of matrices and vectors in a neural network model. The conventional processing unit 102 can process the remaining conventional operators (for example, linear rectification function ReLU, normalized exponential function Softmax, normalization function Normalization) in the neural network model. In addition, the cache unit 104 is required to store intermediate parameters to complete the neural network model operation.
[0033] More specifically, the storage and calculation processing unit 103 includes a storage and calculation control unit 1031, a storage and calculation cache unit 1032, an operator processing unit 1033, and a plurality of memristor processing unit arrays PE ( Figure 1 A memristor processing unit array PE can be equivalently regarded as a superposition of an adder, a multiplier and a memory. In the matrix multiplication and addition operation, only one voltage application operation is required, and then the output current signal of each column of PE is collected to obtain the result of a matrix-vector multiplication operation.
[0034] Figure 2 The diagram shows a neural network architecture for applying the model deployment method according to an embodiment of the present disclosure. In an exemplary embodiment of the present disclosure, the neural network architecture for applying the model deployment method according to an embodiment of the present disclosure is a Transformer network architecture. The neural network architecture schematically includes 3 encoders and 3 decoders, wherein a large number of matrix multiplication and addition operations in the multi-head attention mechanism and matrix multiplication and addition operations in the full connection can be completed using the storage and computing processing unit 103 of the storage and computing integrated device 10, and other nonlinear operations (for example: Softmax operation and LayerNorm operation) need to be transferred to the conventional processing unit 102 (for example: CPU or GPU) to complete. Therefore, it is necessary to store the calculated values of the intermediate process of the matrix multiplication and addition operation in the cache so that subsequent nonlinear operations can read them. At the same time, the global processing unit and the storage and computing control unit need to be coordinated and scheduled to ensure the smooth completion of the intermediate operations.
[0035] Figure 3 The diagram shows Figure 2 The matrix multiplication process in the neural network architecture shown. The input word vector and weight matrix W in step 1 i K , W i Q , W i V(i represents the number of attention heads) The multiplication and addition operation can be completed using the storage and processing unit 103. The Softmax operation converts the matrix into a probability matrix. Since the storage and processing unit 103 cannot complete the nonlinear matrix multiplication and addition operation, the data stream needs to be imported into the conventional processing unit 102 (CPU, GPU) to complete it. In summary, the W of the Transformer network architecture i K , W i Q , W i V It needs to be stored in the storage and calculation processing unit 103 array in advance.
[0036] Figure 4 is a flowchart illustrating a model deployment method for a storage-computing-in-one device. In an example embodiment of the present disclosure, Figure 4 The model deployment method shown is used to deploy the Transformer network architecture W i K , W i Q , W i V Deployed to the storage and computing processing unit 103 array of the storage and computing integrated device 10.
[0037] In step S401, a model to be deployed for a storage-computing-in-one device is obtained.
[0038] As described above, the storage-computing integrated device includes multiple storage-computing processing unit arrays, and the model to be deployed includes multiple cascaded network layers. The multiple network layers include an input layer, an output layer, and an intermediate layer between the input layer and the output layer. For example, the attention layer of the first encoder of the Transformer network architecture can be considered as the input layer, the fully connected layer of the last decoder of the Transformer network architecture can be considered as the output layer, and the other network layers in the encoder and decoder can be considered as intermediate layers.
[0039] The following will refer to Figure 6 and Figure 7 As described in detail, the model to be deployed may be a pre-trained network model. When the scale of the pre-trained network model does not match the storage capacity of the storage-computing integrated device, or the computing delay caused by an overly complex network model cannot meet the standard of the real-time task, the pre-trained network model may be subjected to model pruning to obtain a more suitable model to be deployed.
[0040] In step S402, based at least on the storage capacity of multiple storage and computing processing unit arrays, weight parameters of multiple network layers are imported into the storage and computing integrated device.
[0041] In the exemplary embodiment of the present disclosure, the weight parameters of each network layer are imported in the order from the input layer to the output layer. That is, the weight parameter import adopts a model mapping scheme from front to back, because the more the network layer is at the front, the less information redundancy there is.
[0042] In an example embodiment of the present disclosure, when the storage capacity required for the weight parameters of one network layer among multiple network layers is not greater than the storage capacity of one storage and computing processing unit array among multiple storage and computing processing unit arrays, the weight parameters of one network layer are imported into one storage and computing processing unit array. When the storage capacity required for the weight parameters of one network layer among multiple network layers is greater than the storage capacity of one storage and computing processing unit array among multiple storage and computing processing unit arrays, the weight parameters of one network layer are imported into two or more storage and computing processing unit arrays among multiple storage and computing processing unit arrays, and information communication can be achieved between the two or more storage and computing processing unit arrays. In other words, weight parameters belonging to the same network layer are preferentially deployed on the same array to avoid information interaction between PEs.
[0043] like Figure 5 As shown, the weight parameters of the attention layer of L1 are preferentially deployed in the storage and computing processing unit array PE1. If the storage capacity of the storage and computing processing unit array PE1 is sufficient, the weight parameters of the fully connected layer of L1 are also deployed in the storage and computing processing unit array PE1, thereby avoiding a large amount of information from interacting across the storage and computing processing unit array PE. If the storage capacity of the storage and computing processing unit array PE1 is insufficient, the weight parameters of the fully connected layer of L1 are deployed in the storage and computing processing unit array PE2. And so on, until all weight parameters are deployed on the PE array. If the weight parameters of the same network layer are deployed in two or more storage and computing processing unit arrays PE, a storage and computing control unit is required to realize information interaction between the storage and computing processing unit arrays PE.
[0044] That is to say, the model deployment method according to the embodiment of the present disclosure realizes the optimized deployment of the model's weight parameters in the storage and computing integrated device according to the model characteristics, and effectively matches the overall model scale with the storage capacity of the storage and computing integrated device.
[0045] In step S403, the weight accuracy compensation parameter is adjusted until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameter is not lower than a predetermined threshold.
[0046] The following will refer to Figure 8 and Fig. 9 As described in detail, after the model to be deployed is deployed, weight accuracy compensation can be further introduced to effectively compensate for the intrinsic non-ideal characteristics of the storage and computing integrated device and the accuracy defects caused by model scale control.
[0047] Above, refer to Figure 4 and Figure 5 The model deployment method according to the embodiment of the present disclosure is described in detail. Figure 6 and Figure 7 The pruning process of the model deployment method according to the embodiment of the present disclosure is further described.
[0048] In step S601, an initial model for the storage-computing integrated device is obtained, and the storage capacity required for the weight parameters of the initial model is determined.
[0049] In the example embodiment of the present disclosure, the initial model used for the storage-computing integrated device is a pre-trained model that has been trained. The total weight parameter scale can be calculated based on the number of pre-trained model layers, and the weights are quantized based on the storage capacity of the storage-computing processing unit array of the storage-computing integrated device to determine the storage capacity required for the weight parameters of the initial model.
[0050] In step S602, it is determined whether the storage capacity required for the weight parameters of the initial model is greater than the storage capacity of the plurality of storage and computing processing unit arrays.
[0051] If a negative result is obtained in step S602, that is, the storage capacity required for the weight parameters of the initial model is not greater than the storage capacity of the plurality of storage and computing processing unit arrays, the process directly proceeds to step S606. In step S606, the initial model is used as the model to be deployed.
[0052] If a positive result is obtained in step S602, that is, the storage capacity required for the weight parameters of the initial model is greater than the storage capacity of the multiple storage and computing processing unit arrays, the processing proceeds to step S603.
[0053] In step S603, based on the storage capacity required for the weight parameters of the initial model and the storage capacity of the plurality of storage and computing processing unit arrays, the granularity parameter of the pruning process is determined. The pruning process is used to reduce the number of weight parameters, thereby reducing the storage capacity required for the weight parameters.
[0054] In step S604, pruning processing is performed in order from the output layer to the input layer.
[0055] As mentioned above, the output layer is, for example, a fully connected layer, and the input layer is, for example, an attention layer. The fully connected layer itself has the largest redundancy in weight parameters, so pruning starts from the fully connected layer. The pruning sensitivity of the multi-head attention layer is greater than that of the fully connected layer, and the earlier the layer, the more sensitive it is. Therefore, a back-to-front, layer-by-layer pruning method is adopted.
[0056] like Figure 7The vector structured pruning diagram of the Transformer network architecture shown in the figure shows that the entire row and column vectors are structured and pruned to keep the network structure unchanged. Structured pruning usually takes filters or entire network layers as basic units for pruning. When a filter is pruned, its previous feature map and the next feature map will change accordingly, but the structure of the model is not destroyed and can still be accelerated by GPU or other hardware.
[0057] In step S605, determine whether the pruning granularity requirements are met after the pruning process in step S604. After obtaining the pruning granularity parameters, pruning is performed starting from the last layer of the neural network Layer(N) (N represents the number of network layers of the neural network model). For Layer(N), structured pruning is preferentially used to perform row pruning on its fully connected layer to ensure that the matrix obtained after the operation is still a regular matrix, and then prune its attention layer. After the pruning process is completed, the number of pruning is returned to determine whether the pruning granularity requirements are met. If not, the process returns to step S604 and continues to prune the penultimate layer Layer(N-1) until the pruning granularity requirements are met. If satisfied, the process proceeds to step S606, and the network model after pruning is used as the model to be deployed.
[0058] By reference Figure 6 and Figure 7 The pruning process described above is implemented according to the model deployment method of the embodiment of the present disclosure to effectively match the overall model scale with the storage capacity of the storage and computing integrated device.
[0059] Figure 8 and Fig. 9 It is a flowchart and a schematic diagram that further illustrate the accuracy compensation processing of the model deployment method according to an embodiment of the present disclosure.
[0060] As described above, the intrinsic non-ideal characteristics of the storage and computing integrated device (e.g., poor device stability, IR-DROP voltage fading, low ADC accuracy) and model scale control (e.g., pruning) can lead to accuracy defects. The model deployment method according to the embodiment of the present disclosure further performs accuracy compensation processing for such accuracy defects.
[0061] In step S801, the accuracy of the model to be deployed is determined.
[0062] In the example embodiment of the present disclosure, the weight parameters may be input in small batches to perform mapping and obtain the model inference accuracy of the storage and computing processing unit array at this time.
[0063] In step S802, it is determined whether the accuracy of the model to be deployed is less than a threshold accuracy.
[0064] If a negative result is obtained in step S802, that is, the accuracy of the model to be deployed is not less than the threshold accuracy, the accuracy compensation process is completed, and a storage and computing integrated device after accuracy compensation is obtained.
[0065] If a positive result is obtained in step S802, that is, the accuracy of the model to be deployed is less than the threshold accuracy, the process proceeds to step S803.
[0066] In step S803, the weight parameters stored in the plurality of storage and calculation processing unit arrays are fixed, and the weight precision compensation parameters are adjusted.
[0067] As mentioned above, the instability of the model pruning process and the storage-computing integrated device will cause a certain loss of accuracy in the model, resulting in a decrease in reasoning accuracy. Therefore, the reasoning accuracy loss of the model is mainly composed of two parts, analog device error and model pruning error. Analog device error includes device error, circuit error, and array error, etc. It is an error caused by device instability and analog calculation, and cannot be compensated by frequent parameter adjustment. Model pruning error is a loss caused by compressing the number of model parameters, which can be compensated by model fine-tuning and other methods.
[0068] Fig. 9 The diagram shows an accuracy compensation scheme of the model deployment method according to an embodiment of the present disclosure. Due to the device instability of the storage and computing processing unit array, it is necessary to perform model reasoning based on the storage and computing processing unit devices without frequently modifying their weights to implement model training. In the example embodiment of the present disclosure, a weight accuracy compensation parameter is introduced, and this part of small-scale fine-tuning of weights can be performed in the GPU. After the weight accuracy compensation parameter is introduced, the weight parameter variable is W=W0+ΔW, which compensates for the low accuracy of the storage and computing processing unit array and achieves model reasoning accuracy.
[0069] Fig.10 It is a block diagram illustrating a model deployment apparatus for a storage-computing integrated device according to an embodiment of the present disclosure.
[0070] like Fig.10 As shown, the model deployment device 1000 for storage-computing integrated device according to the embodiment of the present disclosure includes a model acquisition unit 1001, a model deployment unit 1002 and an accuracy compensation unit 1003. It is easy for those skilled in the art to understand that these unit modules can be implemented in various ways by hardware alone, software alone or by a combination thereof, and the present disclosure is not limited to any of them.
[0071] Specifically, the model acquisition unit 1001 is configured to acquire a model to be deployed for a storage-computing integrated device, wherein the storage-computing integrated device includes a plurality of storage-computing processing unit arrays, and the model to be deployed includes a plurality of cascaded network layers, the plurality of network layers including an input layer, an output layer, and an intermediate layer between the input layer and the output layer.
[0072] The model deployment unit 1002 is configured to import the weight parameters of multiple network layers into the storage and computing integrated device based at least on the storage capacity of multiple storage and computing processing unit arrays. Specifically, the model deployment unit 1002 imports the weight parameters of each network layer in the order from the input layer to the output layer. When the storage capacity required for the weight parameters of one network layer in the multiple network layers is not greater than the storage capacity of one processing unit array in the multiple processing unit arrays, the weight parameters of one network layer are imported into one processing unit array; and when the storage capacity required for the weight parameters of one network layer in the multiple network layers is greater than the storage capacity of one processing unit array in the multiple processing unit arrays, the weight parameters of one network layer are imported into two or more processing unit arrays in the multiple processing unit arrays, and information communication can be achieved between the two or more processing unit arrays.
[0073] More specifically, the model acquisition unit 1001 is further configured to acquire an initial model for the storage-computing integrated device, and determine the storage capacity required for the weight parameters of the initial model; when the storage capacity required for the weight parameters of the initial model is greater than the storage capacity of multiple storage-computing processing unit arrays, perform pruning on the initial model; determine the initial model after pruning as the model to be deployed, wherein the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of multiple storage-computing processing unit arrays. The model acquisition unit 1001 is further configured to: determine the granularity parameters of the pruning based on the storage capacity required for the weight parameters of the initial model and the storage capacity of multiple storage-computing processing unit arrays; perform pruning in order from the output layer to the input layer until the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of multiple storage-computing processing unit arrays.
[0074] The accuracy compensation unit 1003 is configured to determine the accuracy of the model to be deployed. When the accuracy of the model to be deployed is lower than a predetermined threshold, the weight parameters stored in the array of multiple storage and computing processing units are fixed, and the weight accuracy compensation parameters are adjusted until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameters is not lower than the predetermined threshold.
[0075] Fig.11 is a hardware block diagram of an electronic device 700 according to an embodiment of the present disclosure. The electronic device according to an embodiment of the present disclosure includes at least a processor; and a memory for storing computer-readable instructions. When the computer-readable instructions are loaded and executed by the processor, the processor executes the model deployment method for the storage-computing integrated device as described above.
[0076] Fig.11The electronic device 700 shown specifically includes: a central processing unit (CPU) 701, a graphics processing unit (GPU) 702 and a main memory 703. These units are connected to each other via a bus 704. The central processing unit (CPU) 701 and / or the graphics processing unit (GPU) 702 can be used as the above-mentioned processor, and the main memory 703 can be used as the above-mentioned memory for storing computer-readable instructions. In addition, the electronic device 700 may also include a communication unit 705, a storage unit 706, an output unit 707, an input unit 708 and an external device 709, which are also connected to the bus 704.
[0077] Fig.12 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. Fig.12 As shown, according to an embodiment of the present disclosure, a computer-readable storage medium 800 has computer-readable instructions 801 stored thereon. When the computer-readable instructions 801 are executed by a processor, the model deployment method for a storage-computing integrated device described with reference to the above figures is executed. The computer-readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may, for example, include a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may, for example, include a read-only memory (ROM), a hard disk, a flash memory, an optical disk, a magnetic disk, etc.
[0078] The model deployment method, apparatus, electronic device and medium for storage-computing integrated devices according to the embodiments of the present disclosure are described above with reference to the accompanying drawings. The model deployment method for storage-computing integrated devices according to the embodiments of the present disclosure optimizes the weight parameters of the model in the storage-computing integrated devices according to the model characteristics, and effectively matches the overall model scale with the storage capacity of the storage-computing integrated devices. In addition, weight accuracy compensation is introduced to effectively compensate for the intrinsic non-ideal characteristics of the storage-computing integrated devices and the accuracy defects caused by model scale control.
[0079] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0080] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0081] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0082] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0083] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0084] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0085] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0086] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A model deployment method for a storage-computing integrated device, characterized in that: include: Obtaining a model to be deployed for the storage-computing integrated device, wherein the storage-computing integrated device includes a plurality of storage-computing processing unit arrays, and the model to be deployed includes a plurality of cascaded network layers, the plurality of network layers including an input layer, an output layer, and an intermediate layer between the input layer and the output layer; and Based at least on the storage capacity of the plurality of storage and computing processing unit arrays, the weight parameters of the plurality of network layers are imported into the storage and computing integrated device, The weight parameters of each network layer are imported in the order from the input layer to the output layer.
2. The model deployment method for a storage-computing integrated device according to claim 1, characterized in that: The step of importing the weight parameters of the plurality of network layers into the storage-computing integrated device based at least on the storage capacity of the plurality of storage-computing processing unit arrays comprises: When the storage capacity required for the weight parameters of one of the multiple network layers is not greater than the storage capacity of one of the multiple storage and computing processing unit arrays, importing the weight parameters of the one network layer into the one storage and computing processing unit array; and When the storage capacity required for the weight parameters of one network layer among the multiple network layers is greater than the storage capacity of one storage and computing processing unit array among the multiple storage and computing processing unit arrays, the weight parameters of the one network layer are imported into two or more storage and computing processing unit arrays among the multiple storage and computing processing unit arrays, and information communication can be enabled between the two or more storage and computing processing unit arrays.
3. The model deployment method for a storage-computing integrated device according to claim 1, characterized in that: The acquiring a to-be-deployed model for the storage-computing-in-one device includes: Acquire an initial model for the storage-computing integrated device, and determine the storage capacity required for the weight parameters of the initial model; When the storage capacity required by the weight parameters of the initial model is greater than the storage capacity of the plurality of storage and computing processing unit arrays, performing pruning processing on the initial model; Determine the initial model after the pruning process as the model to be deployed, Among them, the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of the array of multiple storage and computing processing units.
4. The model deployment method for a storage-computing integrated device according to claim 3, characterized in that: The performing pruning processing on the initial model includes: Determining a granularity parameter of the pruning process based on a storage capacity required for the weight parameters of the initial model and a storage capacity of the plurality of storage and computing processing unit arrays; The pruning process is performed in order from the output layer to the input layer until the storage capacity required for the weight parameters of the model to be deployed is no greater than the storage capacity of the plurality of storage and computing processing unit arrays.
5. The model deployment method for a storage-computing-in-one device according to claim 1, characterized in that: The method further comprises: Determining the accuracy of the model to be deployed; When the accuracy of the model to be deployed is lower than a predetermined threshold, the weight parameters stored in the array of multiple storage and computing processing units are fixed, and the weight accuracy compensation parameters are adjusted until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameters is not lower than the predetermined threshold.
6. A model deployment device for a storage and computing integrated device, characterized in that: include: a model acquisition unit configured to acquire a model to be deployed for the storage-computing-in-one device, wherein the storage-computing-in-one device comprises a plurality of storage-computing processing unit arrays, and the model to be deployed comprises a plurality of cascaded network layers, wherein the plurality of network layers comprises an input layer, an output layer, and an intermediate layer between the input layer and the output layer; and A model deployment unit is configured to import the weight parameters of the plurality of network layers into the storage-computing integrated device based at least on the storage capacity of the plurality of storage-computing processing unit arrays, The weight parameters of each network layer are imported in the order from the input layer to the output layer.
7. The model deployment device for storage and computing integrated device according to claim 6, characterized in that: The model deployment unit is further configured to: When the storage capacity required for the weight parameters of one network layer among the multiple network layers is not greater than the storage capacity of one storage and computing processing unit array among the multiple storage and computing processing unit arrays, importing the weight parameters of the one network layer into the one storage and computing processing unit array; as well as When the storage capacity required for the weight parameters of one network layer among the multiple network layers is greater than the storage capacity of one storage and computing processing unit array among the multiple storage and computing processing unit arrays, the weight parameters of the one network layer are imported into two or more storage and computing processing unit arrays among the multiple storage and computing processing unit arrays, and information communication can be enabled between the two or more storage and computing processing unit arrays.
8. The model deployment device for storage and computing integrated device according to claim 6, characterized in that: The model acquisition unit is further configured to: Acquire an initial model for the storage-computing integrated device, and determine the storage capacity required for the weight parameters of the initial model; When the storage capacity required by the weight parameters of the initial model is greater than the storage capacity of the plurality of storage and computing processing unit arrays, performing pruning processing on the initial model; Determining the initial model after the pruning process as the model to be deployed, Among them, the storage capacity required for the weight parameters of the model to be deployed is not greater than the storage capacity of the array of multiple storage and computing processing units.
9. The model deployment device for storage and computing integrated device according to claim 8, characterized in that: The model acquisition unit is further configured to: Determining a granularity parameter of the pruning process based on a storage capacity required for the weight parameters of the initial model and a storage capacity of the plurality of storage and computing processing unit arrays; The pruning process is performed in order from the output layer to the input layer until the storage capacity required for the weight parameters of the model to be deployed is no greater than the storage capacity of the plurality of storage and computing processing unit arrays.
10. The model deployment device for storage and computing integrated device according to claim 6, characterized in that: It also includes an accuracy compensation unit configured to: Determining the accuracy of the model to be deployed; When the accuracy of the model to be deployed is lower than a predetermined threshold, the weight parameters stored in the array of multiple storage and computing processing units are fixed, and the weight accuracy compensation parameters are adjusted until the overall accuracy determined based on the accuracy of the model to be deployed and the weight accuracy compensation parameters is not lower than the predetermined threshold.
11. An electronic device, characterized in that: include: a memory for storing computer readable instructions; as well as A processor is used to run the computer-readable instructions so that the electronic device executes the model deployment method for a storage-computing integrated device as described in any one of claims 1 to 5.
12. A non-transitory computer-readable storage medium for storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by a processor, the processor executes the model deployment method for a storage-computing integrated device as described in any one of claims 1 to 5.
