Model processing method and system

By extracting and storing the non-zero weights and position information of the machine learning model, sparse convolution calculations are implemented, which solves the problem of increasing model inference speed after unstructured clipping, and improves data storage and computing efficiency.

WO2024222484A1PCT designated stage expired Publication Date: 2024-10-31ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
PCT/CN2024/087476
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-23
Filing Date
2024-04-12
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

After unstructured pruning in the existing technology, useless parameters in the model cannot be directly deleted and still occupy computing resources, resulting in an insignificant improvement in inference speed. It is especially difficult to accelerate sparse matrix operations on core processors.

Method used

By extracting the non-zero value weights and their position information of the machine learning model, only the non-zero value weights are stored and calculated to achieve sparse convolution calculations and reduce data storage and inference time.

Benefits of technology

It improves data storage efficiency, saves storage space, and significantly reduces model inference time while maintaining calculation accuracy. It is suitable for sparse matrix operations on core processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024087476_31102024_PF_FP_ABST
    Figure CN2024087476_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present description provide a model processing method and system. The model processing system comprises a client and a server. The client is configured to send a model processing request to the server, wherein the model processing request carries data to be processed. The server is configured to: acquire a non-zero weight of a machine learning model from a weight information storage unit; acquire, from a position information storage unit corresponding to the weight information storage unit, position information of the non-zero weight in a weight matrix of the machine learning model; and perform convolution calculation on said data according to the non-zero weight and the position information of the non-zero weight in the weight matrix. The weight information storage unit only needs to store the non-zero weight, thereby improving the data storage efficiency and saving the data storage space. Moreover, during the convolution calculation of the model, it is only necessary to perform convolution calculation on said data according to the non-zero weight, thereby reducing the model inference time while maintaining the calculation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Model processing method and system

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 23, 2023, with application number 202310454325.6 and application name “Model Processing Method and System”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The embodiments of this specification relate to the field of computer technology, and more particularly to a model processing system method. One or more embodiments of this specification also relate to a model processing method, a model processing apparatus, a computing device, a computer-readable storage medium, and a computer program. Background Art

[0003] With the development of computer technology, the application of deep learning in fields such as computer vision, speech recognition, and natural language processing has continued to expand, and the demand for high-performance computing capabilities in the field of artificial intelligence has also increased accordingly. Improving the performance of deep learning models has gradually become a research focus.

[0004] Currently, unstructured pruning can be used to optimize model performance and accelerate model inference. This approach involves pruning unimportant parameters from the model, reducing the model size and the number of operations required to perform inference tasks, thereby improving computational performance. However, the pruned parameters during unstructured pruning cannot be directly deleted and remain in the model weights, consuming computational resources during model inference through ineffective computation. Therefore, an efficient model processing solution is urgently needed.

[0005] Summary of the Invention

[0006] In view of this, embodiments of this specification provide a model processing system. One or more embodiments of this specification also relate to a model processing method, a model processing apparatus, a computing device, a computer-readable storage medium, and a computer program to address technical deficiencies in the prior art.

[0007] According to a first aspect of an embodiment of this specification, a model processing system is provided, including a client and a server; the client is configured to send a model processing request to the server, wherein the model processing request carries data to be processed; the server is configured to obtain non-zero weights of a machine learning model from a weight information storage unit; obtain position information of the non-zero weights in a weight matrix of the machine learning model from a position information storage unit corresponding to the weight information storage unit; and perform convolution calculation on the data to be processed using the non-zero weights and the position information of the non-zero weights in the weight matrix.

[0008] According to a second aspect of an embodiment of this specification, a model processing method is provided, including: determining a weight matrix of a machine learning model, wherein the weight matrix includes non-zero value weights and zero value weights; obtaining the non-zero value weights in the weight matrix and the position information of the non-zero value weights in the weight matrix; storing the non-zero value weights in a weight information storage unit, and storing the position information of the non-zero value weights in a corresponding position information storage unit.

[0009] According to the third aspect of the embodiments of this specification, a model processing method is provided, including: obtaining the non-zero value weights of a machine learning model and the position information of the non-zero value weights in the weight matrix of the machine learning model; using the non-zero value weights and the position information of the non-zero value weights in the weight matrix to perform convolution calculations on the data to be processed input into the machine learning model.

[0010] According to a fourth aspect of the embodiments of this specification, a model processing device is provided, including: a determination module, configured to determine a weight matrix of a machine learning model, wherein the weight matrix includes non-zero value weights and zero value weights; a first acquisition module, configured to obtain the non-zero value weights in the weight matrix and the position information of the non-zero value weights in the weight matrix; a storage module, configured to store the non-zero value weights in a weight information storage unit, and store the position information of the non-zero value weights in a corresponding position information storage unit.

[0011] According to the fifth aspect of the embodiments of this specification, a model processing device is provided, including: a second acquisition module, configured to obtain the non-zero value weights of the machine learning model and the position information of the non-zero value weights in the weight matrix of the machine learning model; a calculation module, configured to use the non-zero value weights and the position information of the non-zero value weights in the weight matrix to perform convolution calculation on the data to be processed input into the machine learning model.

[0012] According to the sixth aspect of the embodiments of this specification, a computing device is provided, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method provided in the second or third aspect above.

[0013] According to a seventh aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions. When the instructions are executed by a processor, the steps of the method provided in the second or third aspect above are implemented.

[0014] According to an eighth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the method provided in the second aspect or the third aspect above.

[0015] The model processing system provided by one embodiment of the present specification includes a client and a server; the client is configured to send a model processing request to the server, wherein the model processing request carries data to be processed; the server is configured to obtain the non-zero weights of the machine learning model from a weight information storage unit; obtain the position information of the non-zero weights in the weight matrix of the machine learning model from a position information storage unit corresponding to the weight information storage unit; and perform convolution calculations on the data to be processed using the non-zero weights and the position information of the non-zero weights in the weight matrix. Since the weight information storage unit does not need to store the zero weights in the machine learning model, only the non-zero weights need to be stored, thereby improving data storage efficiency and saving data storage space. In addition, during convolution calculations, only the non-zero weights need to be used to perform convolution calculations on the data to be processed, thereby reducing model inference time while maintaining calculation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] FIG1 is an architecture diagram of a model processing system provided by one embodiment of this specification;

[0017] FIG2 is an architecture diagram of another model processing system provided by one embodiment of this specification;

[0018] FIG3 is a flow chart of a model processing method provided by one embodiment of this specification;

[0019] FIG4 is a schematic diagram of a processing process of a model processing method provided by an embodiment of this specification;

[0020] FIG5 is a flow chart of another model processing method provided by one embodiment of this specification;

[0021] FIG6 is a schematic diagram of the processing process of another model processing method provided by one embodiment of this specification;

[0022] FIG7 is a flowchart of a processing process of a model processing method provided by one embodiment of this specification;

[0023] FIG8 is a schematic diagram of a processing effect of a model processing method provided by an embodiment of this specification;

[0024] FIG9 is a schematic structural diagram of a model processing device provided by one embodiment of this specification;

[0025] FIG10 is a schematic structural diagram of another model processing device provided by one embodiment of this specification;

[0026] FIG11 is a structural block diagram of a computing device provided in one embodiment of this specification. DETAILED DESCRIPTION

[0027] The following description sets forth many specific details to facilitate a thorough understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0028] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a," "the," and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0029] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0030] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0031] First, the terms involved in one or more embodiments of this specification are explained.

[0032] Sparse matrix: A sparse matrix refers to a matrix in which the vast majority of elements are 0. If the number of non-zero elements in a matrix is ​​much less than a certain proportion (such as 1%) of the total number of elements in the matrix, then the matrix can be considered a sparse matrix. Sparse matrices are widely used in many fields, such as image processing, network analysis, data mining, and scientific computing. Since most of its elements are 0, the method provided in the embodiments of this specification provides a solution for storing and processing sparse matrices, thereby optimizing its sparsity, improving efficiency, and reducing storage costs.

[0033] Convolution: Convolution, also known as convolution operation or convolutional computation, is a common neural network layer used in deep learning to extract features from input data. A convolutional layer typically consists of a series of convolution kernels, each of which is a small weight matrix. Convolution can be thought of as a weighted operation (matrix element-wise multiplication and accumulation) between the input data and the kernels. This weighted operation can be understood as the process of extracting features from the input data.

[0034] Convolution kernel: In deep learning, a convolution kernel, also known as a filter, is a set of learnable parameters in a convolutional layer that extracts features from the input data. A convolution kernel is a small weight matrix, typically square or rectangular, though its size and shape can be customized.

[0035] ResNet: Deep residual network, mainly composed of convolutional layers, pooling layers, residual blocks and fully connected layers, is commonly used in visual classification tasks.

[0036] Model compression is an important technical approach for optimizing performance and accelerating model inference. Simply put, model compression reduces the model size and the number of operations required to perform inference tasks by pruning unimportant parameters while maintaining model accuracy to the greatest extent possible, thereby improving computing performance. Common pruning methods include structured pruning and unstructured pruning.

[0037] Structured pruning follows a regular pruning pattern, making it easy for backend frameworks and hardware to adapt to the pruned model, directly translating parameter reduction into performance improvements. However, because structured pruning operates on a coarse granularity, this approach often results in significant precision loss, making it difficult to achieve a satisfactory balance between acceleration and accuracy.

[0038] Unstructured pruning uses convolution kernel slices (also called convolution slices) or even single parameters in deep learning models as the smallest object for pruning. The fine-grained sparsification (also called pruning) capability enables unstructured pruning to achieve better accuracy than structured pruning with similar pruning amounts. However, because traditional data structures in backend frameworks do not support storing convolution weights in a highly irregular form, the large number of useless parameters pruned by unstructured methods, while redundant, cannot be directly deleted and can only exist in the model weights as "0", occupying computing resources during model inference as ineffective calculations. As a result, the theoretical parameter reduction brought about by unstructured pruning cannot be directly converted into an improvement in model inference performance.

[0039] Currently, common model compression solutions are mainly targeted at graphics processing units (GPUs). GPU-targeted solutions have strict requirements for the sparsity pattern of sparse matrices, requiring that exactly two out of every four consecutive matrix elements be zero. These solutions cannot generally support the highly irregular sparse matrix multiplication operations in actual convolutions, making them difficult to accelerate. Other solutions also require that the input data have a relatively regular sparse pattern, placing more stringent requirements on the sparsity pattern. Therefore, these solutions are currently unsuitable for sparse matrix operations on the CPU (Central Processing Unit).

[0040] In order to solve the pain point that unstructured cropping has good theoretical accuracy but is difficult to convert into an advantage in inference speed, the embodiments of this specification provide a model processing solution to improve the performance of models with unstructured sparse weight convolution operators. From the two dimensions of weight storage and convolution calculation, it provides good adaptation to the sparse convolution calculation in the model after unstructured cropping on the core processor, and realizes the efficient conversion of unstructured cropping to model performance improvement.

[0041] In this specification, a model processing system is provided. This specification also involves a model processing method, a model processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0042] Referring to FIG1 , FIG1 shows an architecture diagram of a model processing system provided by an embodiment of this specification. The model processing system may include a client 100 and a server 200;

[0043] The client 100 is configured to send a model processing request to the server 200, wherein the model processing request carries data to be processed;

[0044] The server 200 is used to obtain the non-zero weights of the machine learning model from the weight information storage unit 202; obtain the position information of the non-zero weights in the weight matrix of the machine learning model from the position information storage unit 204; and perform convolution calculations on the data to be processed using the non-zero weights and the position information of the non-zero weights in the weight matrix.

[0045] By applying the solution of the embodiments of this specification, since the weight information storage unit does not need to store the zero-value weights in the machine learning model, but only needs to store the non-zero-value weights, this improves data storage efficiency and saves data storage space. Moreover, during convolution calculation, it is only necessary to perform convolution calculation on the processed data based on the non-zero-value weights, thereby reducing the model inference time while maintaining the calculation accuracy.

[0046] Referring to FIG. 2 , FIG. 2 shows an architecture diagram of another model processing system provided in one embodiment of the present specification. The model processing system may include multiple clients 100 and a server 200. Multiple clients 100 may establish communication connections through the server 200. In a model processing scenario, the server 200 is used to provide model processing services between multiple clients 100. Multiple clients 100 may act as senders or receivers, respectively, and communicate through the server 200.

[0047] Users can interact with the server 200 through the client 100 to receive data sent by other clients 100, or send data to other clients 100. In the model processing scenario, users can publish data streams to the server 200 through the client 100. The server 200 performs model processing based on the data stream and pushes the processing results to other clients with which communication has been established.

[0048] The client 100 and the server 200 are connected via a network. The network provides a medium for the communication link between the client 100 and the server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, or other processing before being released to the server 200.

[0049] The client 100 can be a browser, an APP (Application), or a web application such as an H5 (HyperText Markup Language 5, Hypertext Markup Language 5) application, a light application (also known as a mini-program, a lightweight application), or a cloud application. The client 100 can be based on the software development kit (SDK) of the corresponding service provided by the server 200, such as developed based on the real-time communication (RTC) SDK. The client 100 can be deployed in an electronic device and needs to rely on the device to run or certain APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0050] The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers that provide background training to support models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server that is integrated with a blockchain. The server can also be a cloud server for basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0051] It is worth noting that the model processing methods provided in the embodiments of this specification are generally executed by the server. However, in other embodiments of this specification, the client may also have similar functions to the server and thus execute the model processing methods provided in the embodiments of this specification. In other embodiments, the model processing methods provided in the embodiments of this specification may also be executed jointly by the client and the server.

[0052] Referring to FIG3 , FIG3 shows a flow chart of a model processing method provided by an embodiment of this specification, which specifically includes the following steps:

[0053] Step 302: Determine a weight matrix of the machine learning model, wherein the weight matrix includes non-zero weights and zero weights.

[0054] In one or more embodiments of this specification, the weight matrix of the machine learning model can be determined, and the non-zero weights and zero weights included in the weight matrix can be processed to optimize the model and improve the inference speed of the model.

[0055] Specifically, machine learning models can be understood as trained programs that can discover patterns in new data and make predictions. These models are represented as mathematical functions that receive input data, make predictions about that input data, and then provide outputs in response. The weight matrix of a machine learning model is called a sparse matrix. The weight matrix contains both non-zero and zero-valued weights. Zero-valued weights can be considered redundant and useless parameters, while non-zero-valued weights can be considered valid parameters.

[0056] In practical applications, there are many ways to determine the weight matrix of a machine learning model, and the specific method to be selected depends on the actual situation. The embodiments of this specification do not impose any restrictions on this.

[0057] In an optional embodiment of the present specification, the weight matrix obtained in advance by unstructured pruning processing can be read from other data acquisition devices or databases.

[0058] In another possible implementation of this specification, unstructured pruning may be performed on multiple weights of the machine learning model to obtain a weight matrix of the machine learning model. That is, determining the weight matrix of the machine learning model may include the following steps:

[0059] Get multiple weights of a machine learning model;

[0060] Perform unstructured pruning on multiple weights to obtain the weight matrix of the machine learning model.

[0061] Specifically, the strength of the connections between neurons in a deep learning network is represented by weights, with the size of the weights representing the likelihood. In deep learning, updating the model weights through backpropagation can yield a model with strong generalization capabilities. The trained weights, combined with various neural network operators, can achieve detection, classification, and recognition tasks. Unstructured pruning, also known as unstructured clipping or neuron pruning, is used to trim the neuron nodes in the initial weight matrix of a machine learning model.

[0062] There are many ways to obtain multiple weights of a machine learning model, and the specific method is selected according to the actual situation. This specification does not limit this in any way. In one possible implementation of this specification, the multiple weights of the machine learning model can be read from other data acquisition devices or databases. In another possible implementation of this specification, the multiple weights of the machine learning model sent by the user can be received.

[0063] It should be noted that when performing structured pruning on multiple weights of a machine learning model, the pruned useless parameters cannot be directly deleted and exist in the weight matrix as "0".

[0064] By applying the solution of the embodiment of this specification, multiple weights of the machine learning model are obtained; unstructured pruning is performed on the multiple weights to obtain the weight matrix of the machine learning model, thereby accurately obtaining a sparse matrix and preparing for subsequent machine processing.

[0065] In practical applications, there are many ways to perform unstructured pruning on multiple weights to obtain the weight matrix of the machine learning model. The specific selection is based on the actual situation, and the embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, a set of weights below a preset threshold can be replaced with zero (gradient magnitude pruning). In another possible implementation of this specification, a global scoring scheme can be used to prune a set of weights by iterative pruning (synaptic flow pruning) until the global score drops below the scoring threshold.

[0066] In an optional embodiment of the present specification, the above-mentioned unstructured pruning of multiple weights to obtain a weight matrix of the machine learning model may include the following steps:

[0067] Construct an initial weight matrix based on multiple weights of the machine learning model;

[0068] The weights in the initial weight matrix that belong to the same row and column as the weights to be deleted are adjusted to zero-value weights to obtain the weight matrix of the machine learning model.

[0069] Specifically, the initial weight matrix refers to the weight matrix before unstructured pruning. The initial weight matrix includes multiple weight parameters. The weights to be pruned refer to the useless parameters in the initial weight matrix.

[0070] In practical applications, when constructing an initial weight matrix based on the multiple weights of a machine learning model, the initial weight matrix can be constructed based on the input layer, weights, and output layer of the machine learning model. The input layer can be called factors, the weights can be called influencing factors, and the output layer can be called results. Each row of the initial weight matrix corresponds to a factor. The values ​​in each row represent all the weights acting on a factor. Each column of the weight matrix corresponds to a result, and the numbers in each column represent all the weights that influence that result.

[0071] It should be noted that before performing non-structural pruning, the weights to be deleted in the initial weight matrix can be determined. There are many ways to determine the weights to be deleted, and the specific selection is based on the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, a preset threshold can be obtained, and the weights less than the preset threshold can be used as weights to be deleted. In another possible implementation of this specification, the weights to be deleted can be determined based on the importance of the neuron nodes. Specifically, the root of the sum of the squares of the weights of the rows and columns corresponding to the neurons is calculated, the neuron nodes are sorted according to the calculated values, the sorting results are obtained, and the weights to be deleted are determined based on the sorting results.

[0072] It should be noted that during the unstructured pruning process, when a neuron node in the initial weight matrix is ​​removed, the synapses connected to the neuron must also be removed, which is equivalent to removing a row and column in the weight matrix at the same time. That is, the weights in the initial weight matrix that belong to the same row and column as the weight to be deleted are formatted and adjusted to zero-valued weights.

[0073] Apply the solution of the embodiments of this specification to construct an initial weight matrix based on multiple weights of the machine learning model; adjust the weights in the initial weight matrix that belong to the same row and column as the weights to be deleted to zero-value weights to obtain the weight matrix of the machine learning model and ensure the accuracy of the weight matrix.

[0074] Step 304: Obtain the non-zero weights in the weight matrix and the position information of the non-zero weights in the weight matrix.

[0075] In one or more embodiments of the present specification, after determining the weight matrix of the machine learning model, further, the non-zero weights in the weight matrix and the position information of each non-zero weight in the weight matrix can be obtained.

[0076] Specifically, the position information of the non-zero weight in the weight matrix includes the offset of the convolution slice corresponding to the non-zero weight, the position rearrangement information of the convolution slice corresponding to the non-zero weight, the input channel identifier corresponding to the convolution slice corresponding to the non-zero weight, and the number of slices of the convolution slice corresponding to the non-zero weight.

[0077] In practical applications, there are many ways to obtain the non-zero weights in the weight matrix and the position information of the non-zero weights in the weight matrix, which can be selected according to the actual situation. The embodiments of this specification do not impose any restrictions on this. In one possible implementation of this specification, the position information of the non-zero weights in the weight matrix can be directly read from a data acquisition device or database that reads the machine learning model weight matrix. In another possible implementation of this specification, the unstructured pruning process can be analyzed to determine the position information of the non-zero weights in the weight matrix.

[0078] In an optional embodiment of the present specification, the obtaining of the non-zero weights in the weight matrix and the position information of the non-zero weights in the weight matrix may include the following steps:

[0079] Identify each weight in the weight matrix and determine the non-zero weights in the weight matrix;

[0080] For any non-zero weight, the offset of the convolution slice corresponding to the non-zero weight, the input channel identifier, the position rearrangement information and the number of slices are used as the position information of the non-zero weight in the weight matrix.

[0081] It should be noted that when obtaining non-zero weights in the weight matrix, the weight matrix can be traversed to filter non-zero weights other than zero weights. Convolution slices are the pruning units of unstructured pruning and can be n*n matrices. The input channel identifier can be the number of input channels, the number of input channels, and so on. The calculated output can be accumulated to the correct output channel by rearranging the position information of the convolution slice. The number of input channels depends on the data type. Taking the input data as an image as an example, if the image is of RGB (Red Green Blue) type, the number of input channels is 3; if the image is gray, the number of input channels is 1. After the convolution is completed, the number of output channels depends on the number of filters.

[0082] By applying the solution of the embodiments of this specification, each weight in the weight matrix is ​​identified, and the non-zero weights in the weight matrix are determined; for any non-zero weight, the offset of the convolution slice corresponding to the non-zero weight, the input channel identifier, the position rearrangement information and the number of slices are used as the position information of the non-zero weight in the weight matrix, accurately expressing the position information of each non-zero weight, and ensuring the accuracy of the weight information while reducing the amount of data storage.

[0083] Step 306: Store the non-zero weights in a weight information storage unit, and store the position information of the non-zero weights in a corresponding position information storage unit.

[0084] In one or more embodiments of the present specification, after determining the weight matrix of the machine learning model and obtaining the non-zero value weights in the weight matrix and the position information of the non-zero value weights in the weight matrix, the non-zero value weights can be further stored in a weight information storage unit, and the position information of the non-zero value weights can be stored in a corresponding position information storage unit.

[0085] It should be noted that when storing non-zero weighted location information in a corresponding location information storage unit, if the number of location information storage units is one, the location information can be directly stored, and each location information carries a corresponding non-zero weight tag. If there are multiple location information storage units, the location information can be stored in categories based on the number of location information storage units.

[0086] Specifically, the weight information storage unit is an array element in a one-dimensional weight array, the position information storage unit is an array element in a one-dimensional position array, and the stored information has a corresponding relationship between array elements belonging to the same non-zero weight.

[0087] For example, assuming that the one-dimensional weight array is [ABCD], the one-dimensional position array is [abcd], array element a is the position information of array element A, array element b is the position information of array element B, array element c is the position information of array element C, and array element d is the position information of array element D, then there is a corresponding relationship between array element a and array element A, there is a corresponding relationship between array element b and array element B, there is a corresponding relationship between array element c and array element C, and there is a corresponding relationship between array element d and array element D.

[0088] In an optional embodiment of the present specification, the position information storage unit includes at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit;

[0089] An offset information storage unit, used to store the offset of the convolution slice corresponding to the non-zero weight;

[0090] A rearrangement information storage unit, used to store position rearrangement information of convolution slices corresponding to non-zero weights;

[0091] A channel information storage unit, used to store the input channel identifier corresponding to the convolution slice corresponding to the non-zero weight;

[0092] The stride information storage unit is used to store the number of slices of the convolution slice corresponding to the non-zero weight.

[0093] Referring to Figure 4, Figure 4 shows a schematic diagram of the processing process of a model processing method provided by an embodiment of this specification. Based on the unstructured pruning function and the alternating direction multiplier method (ADMM) in the model compression framework, most of the weight information in the machine learning model can be concentrated as much as possible to the 4 elements of each 3*3 weight matrix convolution slice through iterative training. After multiple rounds of training, the smaller 5 weight elements in each kernel are set to 0, and pruned kernels are obtained. However, the weights to be pruned are not actually deleted at this time, but the corresponding positions are replaced with 0. Furthermore, after the sparse convolution storage format is converted, these 0s can be truly deleted, and only valid non-zero weights are stored.

[0094] Specifically, by converting the above-mentioned cropping process into a sparse convolution storage format, the weight information storage unit (Weight array) of the weight level (Weight level) provided by this solution and the position storage unit obtained by dividing according to different division levels can be determined. Specifically, the position storage unit includes a position information storage unit of the convolution kernel level (Filter level) and a position information storage unit of the kernel level (Kernel level). The position information storage unit of the convolution kernel level includes an offset information storage unit (Offset array) and a reorder information storage unit (Reorder array), and the position information storage unit of the kernel level includes a channel information storage unit (Index array) and a stride information storage unit (Stride array).

[0095] As shown in Figure 4, assuming the offset information storage unit is [0 2 4 6 9], it means that the offset of convolution slice 0 is 0, the offset of convolution slice 1 is 2, the offset of convolution slice 3 is 4, the offset of convolution slice 4 is 6, and the offset of convolution slice 5 is 9. Assuming the reordering information storage unit is [0 1 3 2 9], it means that convolution slices 2 and 3 have been swapped, and the calculation results of convolution slices 2 and 3 are also mapped to the corresponding output channels. Assuming the channel information storage unit is [3 1 2 0 1 3 1 2 3], it means that convolution slice 1 corresponds to input channel 3, convolution slice 2 corresponds to input channel 1, and so on. Assuming that the stride information storage unit is [0 1 2 0 1 2 0 0 2 0 0 3], the stride information of convolution slice No. 0 is 0, 1, 2, indicating that convolution slice No. 0 has 1 slice of mode 1 (1=1-0) and 1 slice of mode 2 (1=2-1).

[0096] Taking the ResNet-34 model as an example, after replacing all convolutional layer weights in the unstructured pruned model with the unstructured convolutional weight sparse storage format, the number of model parameters can be reduced to 3.4MB, greatly reducing the storage overhead of the model and achieving cost reduction in storage space.

[0097] By applying the solution of the embodiments of this specification, since the weight information storage unit does not need to store the zero-value weights in the machine learning model, but only needs to store the non-zero-value weights, this improves data storage efficiency and saves data storage space. Moreover, during convolution calculation, it is only necessary to perform convolution calculation on the processed data based on the non-zero-value weights, thereby reducing the model inference time while maintaining the calculation accuracy.

[0098] In the embodiments of this specification, the above-described model processing method can efficiently process the data to be input into the machine learning model. Specifically, the model processing method can be applied to various tasks, including but not limited to data classification, data recognition, information extraction, and other tasks. It can also be applied to various scenarios, including but not limited to e-commerce scenarios, remote sensing image processing scenarios, and financial scenarios. The specific selection should be based on the actual situation, and the embodiments of this specification do not impose any restrictions on this.

[0099] 5 , which shows a flow chart of another model processing method provided by an embodiment of this specification, specifically comprising the following steps:

[0100] Step 502: Obtain the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model.

[0101] In one or more embodiments of this specification, in order to reduce the number of floating-point calculations of the model and thus achieve the effect of speeding up the calculation, the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model can be obtained to process the data to be processed input into the machine learning model.

[0102] In actual applications, there are many ways to obtain the non-zero weights of a machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model. The specific method to be selected depends on the actual situation. The embodiments of this specification do not impose any restrictions on this.

[0103] In one possible implementation of the present specification, multiple weights of a machine learning model can be obtained; unstructured pruning is performed on the multiple weights to obtain a weight matrix of the machine learning model. Each weight in the weight matrix is ​​identified, and non-zero weights in the weight matrix are determined; for any non-zero weight, the offset, input channel identifier, position reordering information, and number of slices of the convolution slice corresponding to the non-zero weight are used as position information of the non-zero weight in the weight matrix.

[0104] It should be noted that the specific implementation of the above method is the same as the implementation of the model processing method provided in FIG3 , and will not be described in detail in the embodiments of this specification.

[0105] In another possible implementation of the present specification, the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model can be obtained directly from a weight information storage unit that pre-stores the non-zero weights of the machine learning model and a position information storage unit that pre-stores the position information of the non-zero weights in the weight matrix of the machine learning model. That is, the above-mentioned acquisition of the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model can include the following steps:

[0106] Obtain non-zero weights of the machine learning model from the weight information storage unit;

[0107] The position information of the non-zero value weight in the weight matrix of the machine learning model is obtained from the position information storage unit corresponding to the weight information storage unit.

[0108] It should be noted that the non-zero weights stored in the weight information storage unit and the position information of the non-zero weights stored in the position information storage unit can be stored through the model processing method provided in Figure 3 above, and will not be repeated in the embodiments of this specification.

[0109] In practical applications, the weight information storage unit and the position information storage unit can store the non-zero weights and the position information of the non-zero weights of a machine learning model, and can also store the position information of the non-zero weights and the non-zero weights of multiple machine learning models. In the case where the position information of the non-zero weights and the non-zero weights of multiple machine learning models is stored in the weight information storage unit, the position information of the non-zero weights and the non-zero weights corresponding to the model identifier can be obtained from the weight information storage unit and the position information storage unit according to the model identifier of the machine learning model.

[0110] It is worth noting that the position information storage unit includes at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit; the above-mentioned obtaining the position information of the non-zero value weight in the weight matrix of the machine learning model from the position information storage unit corresponding to the weight information storage unit includes at least one of the following methods:

[0111] Obtain the offset of the convolution slice corresponding to the non-zero weight from the offset information storage unit;

[0112] Obtaining position rearrangement information of convolution slices corresponding to non-zero weights from the rearrangement information storage unit;

[0113] Obtain the input channel corresponding to the convolution slice corresponding to the non-zero weight from the channel information storage unit;

[0114] The number of convolution slices corresponding to the non-zero weights is obtained from the stride information storage unit.

[0115] By applying the solution of the embodiments of this specification, the non-zero weights of the machine learning model are obtained from the weight information storage unit; the position information of the non-zero weights in the weight matrix of the machine learning model is obtained from the position information storage unit corresponding to the weight information storage unit, thereby improving the efficiency of obtaining the non-zero weights and the position information of the non-zero weights.

[0116] Step 504: Using the non-zero weights and the position information of the non-zero weights in the weight matrix, perform convolution calculation on the data to be processed input into the machine learning model.

[0117] In one or more embodiments of the present specification, after obtaining the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model, the non-zero weights and the position information of the non-zero weights in the weight matrix can be further used to perform convolution calculations on the data to be processed input into the machine learning model.

[0118] Specifically, the data to be processed can be in various forms, including but not limited to text, images, and audio. The data to be processed can also be data from different scenarios, including but not limited to remote sensing images and text describing emotions. The selection is based on actual circumstances and is not limited in this specification.

[0119] By applying the solution of the embodiments of this specification, the non-zero weights of the machine learning model and their positional information within the weight matrix of the machine learning model are obtained; and the positional information of the non-zero weights within the weight matrix is ​​used to perform convolution calculations on the unprocessed data input into the machine learning model. Because the stored model parameters are significantly reduced, the storage space occupied by the parameters is reduced, greatly alleviating the storage overhead of the model and achieving a cost reduction in storage space.

[0120] In practical applications, there are many ways to perform convolution calculations on the data to be processed input into the machine learning model using non-zero weights and the position information of the non-zero weights in the weight matrix. The specific method to be selected depends on the actual situation, and the embodiments of this specification do not impose any restrictions on this.

[0121] In one possible implementation of this specification, non-zero weights and their position information in the weight matrix can be used to construct a target weight matrix, and the target weight matrix can be used to perform convolution calculations on the data to be processed that is input into the machine learning model.

[0122] In another possible implementation of the present specification, the convolution multiplication corresponding to the zero-valued weight can be skipped, and only the related operations of the non-zero-valued weight can be performed. That is, the above-mentioned convolution calculation of the data to be processed input into the machine learning model using the non-zero-valued weight and the position information of the non-zero-valued weight in the weight matrix can include the following steps:

[0123] According to the position information of the non-zero weights in the weight matrix, the data position corresponding to each non-zero weight is determined from the data to be processed;

[0124] According to each non-zero weight and the data position corresponding to each non-zero weight, convolution calculation is performed on the data to be processed input into the machine learning model.

[0125] It should be noted that, based on the position information of the non-zero weights in the weight matrix, when determining the data location corresponding to each non-zero weight in the processed data, the offset of the convolution slice corresponding to the non-zero weight, the position reordering information of the convolution slice, the input channel corresponding to the convolution slice, and the number of convolution slices can be combined. For each non-zero weight value, the data location of the element in the processed data to be multiplied with it and the output location of the product of the non-zero weight value and the element in the processed data can be determined in the standard convolution calculation.

[0126] Furthermore, according to each non-zero weight and the data position corresponding to each non-zero weight, when performing convolution calculation on the data to be processed input into the machine learning model, each non-zero weight value can be multiplied and accumulated with the corresponding data to be processed, and then placed in a position equivalent to the standard convolution calculation to complete the convolution calculation.

[0127] By applying the solution of the embodiments of this specification, during convolution calculation, it is only necessary to perform convolution calculation on the processed data based on the non-zero weights, thereby skipping the "0 multiplication" and only performing operations on valid non-zero weights. This can significantly reduce the number of floating-point calculations of the model, thereby achieving the effect of speeding up the calculation.

[0128] Referring to FIG6 , FIG6 shows a schematic diagram of the processing process of another model processing method provided by an embodiment of the present specification. The data to be processed is a 6*6*3 01 matrix as shown in FIG6 , and the output matrix is ​​a 4*4 matrix as shown in FIG6 . Taking the determination of the value of position A in the output matrix as an example, the non-zero weight stored in the weight information storage unit is obtained as "1 1 1 1". According to the position information of the non-zero weight in the weight matrix, the data position corresponding to each non-zero weight is determined from the data to be processed as shown in FIG6 . Therefore, according to each non-zero weight and the data position corresponding to each non-zero weight, A=1*1+1*1+1*1+1*1 is calculated. It can be seen that in this scheme, when determining the value of position A, only 4 multiplications are required, thereby skipping the "0 multiplication" and only performing operations on valid non-zero weights. This can significantly reduce the number of floating-point calculations of the model, thereby achieving the effect of speeding up the calculation.

[0129] In actual applications, completing the reasoning task of a complete model often involves tens of thousands or even hundreds of thousands of operation units corresponding to position A mentioned above. Cumulatively, applying the solution of the embodiment of this specification can save a considerable number of multiplication and accumulation operations, greatly reducing the time required for model reasoning.

[0130] 7 , which shows a flow chart of a model processing method according to an embodiment of the present disclosure, specifically comprising the following steps:

[0131] Step 702: Determine a weight matrix of the machine learning model, wherein the weight matrix includes non-zero weights and zero weights.

[0132] Step 704: Identify each weight in the weight matrix and determine the non-zero weights in the weight matrix.

[0133] Step 706: For any non-zero weight, the offset of the convolution slice corresponding to the non-zero weight, the input channel identifier, the position rearrangement information and the number of slices are used as the position information of the non-zero weight in the weight matrix.

[0134] Step 708: Store the non-zero value weight to a weight information storage unit, and store the position information of the non-zero value weight to a corresponding position information storage unit, wherein the position information storage unit includes at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit.

[0135] Step 710: Obtain the non-zero weights of the machine learning model from the weight information storage unit, and obtain the position information of the non-zero weights in the weight matrix of the machine learning model from the position information storage unit corresponding to the weight information storage unit.

[0136] Step 712: According to the position information of the non-zero weights in the weight matrix, determine the data position corresponding to each non-zero weight from the data to be processed.

[0137] Step 714: Perform convolution calculation on the data to be processed input into the machine learning model according to each non-zero weight and the data position corresponding to each non-zero weight.

[0138] It should be noted that the specific implementation of steps 702 to 714 is the same as the model processing method provided in FIG. 3 and FIG. 4 , and will not be described in detail in this embodiment of the specification.

[0139] Applying the solution of the embodiments of this specification, the model processing solution provided by the embodiments of this specification reconstructs the calculation method of the traditional convolution operator from the two dimensions of data structure and calculation method, and provides good adaptation to the sparse convolution calculation in the unstructured pruned model on the core processor. On the basis of maintaining the accuracy of the model, it improves the reasoning speed of the model in practical applications (such as edge servers and terminal device deployment scenarios with relatively limited hardware resources), and realizes the efficient implementation of the theoretical advantages of unstructured pruned to the actual performance improvement of the model. Among them, the edge server and terminal device refer to the side closest to the data source or application scenario, such as sensors, Internet of Things devices, mobile devices and other platforms. On this type of platform, there are often low-power and relatively small-scale processors (such as core processors), and lightweight models and algorithms are usually used to perform efficient calculations on resource-constrained devices.

[0140] In one or more embodiments of this specification, from the dimension of data format, a more efficient and space-saving unstructured convolution weight sparse storage format (pat_weight) is proposed for unstructured sparse matrices. From the dimension of executing operations, on the basis that the unstructured convolution weight sparse storage format can skip the pruned and redundant calculations, an unstructured sparse convolution high-performance operator (pat_conv) that can better adapt to the unstructured sparse matrix is ​​proposed. While maintaining consistency with the original convolution calculation results, the operation steps are greatly simplified. By combining the above-mentioned data storage format and operation execution method, while maintaining the accuracy of the model, the model volume is greatly reduced, and the terminal model inference performance benefits brought by the unstructured pruning method are more fully released. The unstructured convolution weight sparse storage format and the unstructured sparse convolution high-performance operator are described in detail one by one in the following embodiments.

[0141] Unstructured convolution weight sparse storage format:

[0142] To address the sparse weight matrix characteristics after unstructured pruning, the embodiments of this specification replace the weight storage mode from the traditional multi-dimensional regular matrix to five one-dimensional arrays. Among these five one-dimensional arrays, one is used to store and only store the non-zero weights after pruning, deleting and discarding the zero-value weights that are useless for calculation; the other four one-dimensional arrays are combined to efficiently store the original position of each non-zero weight in the weight matrix, so that when subsequent operations are performed, the standard convolution calculation can be reconstructed losslessly.

[0143] Unstructured sparse convolution high-performance operator:

[0144] Based on the sparse storage format of unstructured convolution weights, the embodiments of this specification propose an unstructured sparse convolution high-performance operator. Leveraging the compact storage format of the unstructured convolution weight sparse storage format, the unstructured sparse convolution high-performance operator can simply skip multiplications related to zeros. After skipping the "0 multiplications", only effective value calculations are performed, which can significantly reduce the number of floating-point calculations in the model, thereby achieving the effect of speeding up the calculation.

[0145] It should be noted that the model processing solution provided in the embodiments of this specification can be highly customized based on internal usage scenarios and process needs, and cooperate with the model clipping algorithm on the upstream software side. It has significantly better adaptability to models in actual project scenarios. It can not only maintain better model accuracy, but also maximize the conversion of parameter clipping in the front-end model compression process into actual reasoning performance improvement, maintaining a good balance between model accuracy and reasoning speed.

[0146] See Figure 8, which shows a schematic diagram of the processing effect of a model processing method provided by an embodiment of this specification. Taking a single-threaded scenario with limited hardware resources as an example, the use of the unstructured sparse convolution high-performance operator proposed in the embodiment of this specification can greatly improve the inference performance of machine learning models with relatively intensive convolution calculations. Take the ResNet-34 model as an example:

[0147] As shown in the histogram on the left side of Figure 8, on a server-level core processor, in a single-threaded scenario (the number of threads is 1), the unstructured sparse convolution operator reduces the single inference time of the ResNet-34 model to 73.1ms, achieving very considerable performance benefits without causing a secondary impact on the model accuracy.

[0148] As shown in the histogram on the right side of Figure 8, even in a multi-threaded scenario (with 24 threads) where hardware resources are relatively sufficient and the parallel capability of traditional convolution operators is dominant, the unstructured sparse convolution operator reduces the single inference time of the ResNet-34 model to 27.9ms.

[0149] The model processing solution proposed in the embodiments of this specification fills the gap in the high-performance implementation of highly irregular unstructured sparse matrix operations on computing hardware that is more common in artificial intelligence implementation scenarios in edge servers such as core processors. From a data perspective, the solution proposed in the embodiments of this specification can not only losslessly adapt to the model optimized by the unstructured tailoring method, but also significantly improve the speed in actual application scenarios, especially in edge servers and terminal device deployment scenarios with relatively limited hardware resources. While verifying the feasibility of the implementation of customized tailoring solutions for machine learning models, it lays an important technical foundation for further building a research and development bridge for software and hardware collaboration in the field of model performance optimization and building the ability to accelerate hardware-specific features.

[0150] Corresponding to the above method embodiment, this specification also provides an embodiment of a model processing device. FIG9 shows a schematic diagram of the structure of a model processing device provided in one embodiment of this specification. As shown in FIG9 , the device includes:

[0151] A determination module 902 is configured to determine a weight matrix of a machine learning model, wherein the weight matrix includes non-zero valued weights and zero valued weights;

[0152] A first acquisition module 904 is configured to acquire non-zero weights in the weight matrix and position information of the non-zero weights in the weight matrix;

[0153] The storage module 906 is configured to store the non-zero weights in the weight information storage unit, and store the position information of the non-zero weights in the corresponding position information storage unit.

[0154] Optionally, the first acquisition module 904 is further configured to identify each weight in the weight matrix and determine the non-zero weights in the weight matrix; for any non-zero weight, the offset of the convolution slice corresponding to the non-zero weight, the input channel identifier, position rearrangement information and number of slices are used as the position information of the non-zero weight in the weight matrix.

[0155] Optionally, the position information storage unit includes at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit; the offset information storage unit is used to store the offset of the convolution slice corresponding to the non-zero weight; the rearrangement information storage unit is used to store the position rearrangement information of the convolution slice corresponding to the non-zero weight; the channel information storage unit is used to store the input channel identifier corresponding to the convolution slice corresponding to the non-zero weight; and the stride information storage unit is used to store the number of slices of the convolution slice corresponding to the non-zero weight.

[0156] Optionally, the determination module 902 is further configured to obtain multiple weights of the machine learning model; perform unstructured pruning on the multiple weights to obtain a weight matrix of the machine learning model.

[0157] Optionally, the weight information storage unit is an array element in a one-dimensional weight array, the position information storage unit is an array element in a one-dimensional position array, and the stored information has a corresponding relationship between array elements belonging to the same non-zero weight.

[0158] Applying the solutions of the embodiments of this specification, a weight matrix of a machine learning model is determined, wherein the weight matrix includes non-zero-valued weights and zero-valued weights; obtaining the non-zero-valued weights in the weight matrix and the position information of the non-zero-valued weights in the weight matrix; storing the non-zero-valued weights in a weight information storage unit, and storing the position information of the non-zero-valued weights in a corresponding position information storage unit. Because the weight information storage unit does not need to store the zero-valued weights in the machine learning model, only the non-zero-valued weights need to be stored, data storage efficiency is improved and data storage space is saved.

[0159] The above is a schematic diagram of a model processing device according to this embodiment. It should be noted that the technical solution of the model processing device and the technical solution of the model processing method shown in FIG3 above are based on the same concept. For details not described in detail in the technical solution of the model processing device, please refer to the description of the technical solution of the model processing method above.

[0160] Corresponding to the above method embodiment, this specification also provides an embodiment of a model processing device. FIG10 shows a schematic diagram of the structure of another model processing device provided in one embodiment of this specification. As shown in FIG10 , the device includes:

[0161] A second acquisition module 1002 is configured to obtain non-zero weights of the machine learning model and position information of the non-zero weights in the weight matrix of the machine learning model;

[0162] The computing module 1004 is configured to perform convolution calculation on the data to be processed input into the machine learning model using the non-zero weights and the position information of the non-zero weights in the weight matrix.

[0163] Optionally, the computing module 1004 is further configured to determine the data position corresponding to each non-zero weight from the data to be processed based on the position information of the non-zero weight in the weight matrix; and perform convolution calculation on the data to be processed input into the machine learning model based on each non-zero weight and the data position corresponding to each non-zero weight.

[0164] Optionally, the second acquisition module 1002 is further configured to obtain the non-zero value weights of the machine learning model from the weight information storage unit; and obtain the position information of the non-zero value weights in the weight matrix of the machine learning model from the position information storage unit corresponding to the weight information storage unit.

[0165] Optionally, the position information storage unit includes at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit; the second acquisition module 1002 is further configured to implement at least one of the following methods: obtaining the offset of the convolution slice corresponding to the non-zero weight from the offset information storage unit; obtaining the position rearrangement information of the convolution slice corresponding to the non-zero weight from the rearrangement information storage unit; obtaining the input channel corresponding to the convolution slice corresponding to the non-zero weight from the channel information storage unit; obtaining the number of slices of the convolution slice corresponding to the non-zero weight from the stride information storage unit.

[0166] By applying the solutions of the embodiments of this specification, the non-zero weights of a machine learning model and their positional information within the weight matrix of the machine learning model are obtained. The positional information of the non-zero weights within the weight matrix is ​​then used to perform a convolution calculation on the data to be processed that is input into the machine learning model. During the convolution calculation, only the non-zero weights need to be convolved for the data to be processed, thereby reducing model inference time while maintaining computational accuracy.

[0167] The above is a schematic diagram of a model processing device according to this embodiment. It should be noted that the technical solution of the model processing device and the technical solution of the model processing method shown in FIG4 above are based on the same concept. For details not described in detail in the technical solution of the model processing device, please refer to the description of the technical solution of the model processing method above.

[0168] Figure 11 shows a block diagram of a computing device according to one embodiment of this specification. Components of the computing device 1100 include, but are not limited to, a memory 1110 and a processor 1120. The processor 1120 is connected to the memory 1110 via a bus 1130, and a database 1150 is used to store data.

[0169] The computing device 1100 also includes an access device 1140 that enables the computing device 1100 to communicate via one or more networks 1160. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0170] In one embodiment of the present specification, the aforementioned components of the computing device 1100 and other components not shown in FIG11 may also be connected to each other, for example, via a bus. It should be understood that the computing device structure block diagram shown in FIG11 is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art may add or replace other components as needed.

[0171] Computing device 1100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 1100 may also be a mobile or stationary server.

[0172] The processor 1120 is configured to execute the following computer-executable instructions, which implement the steps of the above-mentioned model processing method when executed by the processor.

[0173] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned model processing method are of the same concept. For details not described in detail in the technical scheme of the computing device, please refer to the description of the technical scheme of the above-mentioned model processing method.

[0174] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which implement the steps of the above-mentioned model processing method when executed by a processor.

[0175] The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the aforementioned model processing method are based on the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the aforementioned model processing method.

[0176] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned model processing method.

[0177] The above is an illustrative solution of a computer program of this embodiment. It should be noted that the technical solution of the computer program and the technical solution of the above-mentioned model processing method are based on the same concept. For details not described in detail in the technical solution of the computer program, please refer to the description of the technical solution of the above-mentioned model processing method.

[0178] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0179] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium.

[0180] It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0181] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0182] The preferred embodiments disclosed above are intended only to help illustrate this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that those skilled in the art can better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A model processing system, including a client and a server; The client is configured to send a model processing request to the server, wherein the model processing request carries data to be processed; The server is configured to obtain the non-zero weights of the machine learning model from a weight information storage unit; obtain the position information of the non-zero weights in the weight matrix of the machine learning model from a position information storage unit corresponding to the weight information storage unit; and perform convolution calculation on the data to be processed using the non-zero weights and the position information of the non-zero weights in the weight matrix.

2. A model processing method, comprising: Determining a weight matrix of the machine learning model, wherein the weight matrix includes non-zero value weights and zero value weights; Acquire non-zero value weights in the weight matrix and position information of the non-zero value weights in the weight matrix; The non-zero value weight is stored in a weight information storage unit, and the position information of the non-zero value weight is stored in a corresponding position information storage unit.

3. The method according to claim 2, wherein the step of obtaining the non-zero weights in the weight matrix and the position information of the non-zero weights in the weight matrix comprises: Identifying each weight in the weight matrix and determining non-zero valued weights in the weight matrix; For any non-zero valued weight, the offset of the convolution slice corresponding to the non-zero valued weight, the input channel identifier, the position rearrangement information and the number of slices are used as the position information of the non-zero valued weight in the weight matrix.

4. The method according to claim 2, wherein the position information storage unit comprises at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit; The offset information storage unit is used to store the offset of the convolution slice corresponding to the non-zero weight; The rearrangement information storage unit is used to store the position rearrangement information of the convolution slices corresponding to the non-zero weights; The channel information storage unit is used to store the input channel identifier corresponding to the convolution slice corresponding to the non-zero weight; The stride information storage unit is used to store the number of slices of the convolution slice corresponding to the non-zero weight.

5. The method according to claim 2, wherein determining a weight matrix of a machine learning model comprises: Get multiple weights of a machine learning model; Perform unstructured pruning on the multiple weights to obtain a weight matrix of the machine learning model.

6. According to the method described in claim 2, the weight information storage unit is an array element in a one-dimensional weight array, and the position information storage unit is an array element in a one-dimensional position array, and the stored information has a corresponding relationship between array elements belonging to the same non-zero value weight.

7. A model processing method, comprising: Obtaining non-zero value weights of a machine learning model and position information of the non-zero value weights in a weight matrix of the machine learning model; The non-zero value weights and the position information of the non-zero value weights in the weight matrix are used to perform convolution calculations on the data to be processed that is input into the machine learning model.

8. The method according to claim 7, wherein the non-zero weight and the position information of the non-zero weight in the weight matrix are used to perform convolution calculation on the data to be processed input into the machine learning model, comprising: Determining data positions corresponding to each non-zero value weight from the data to be processed according to position information of the non-zero value weight in the weight matrix; According to the non-zero weights and the data positions corresponding to the non-zero weights, convolution calculation is performed on the data to be processed input into the machine learning model.

9. The method according to claim 7, wherein the step of obtaining the non-zero weights of the machine learning model and the position information of the non-zero weights in the weight matrix of the machine learning model comprises: Obtain non-zero value weights of the machine learning model from the weight information storage unit; The position information of the non-zero value weight in the weight matrix of the machine learning model is obtained from the position information storage unit corresponding to the weight information storage unit.

10. The method according to claim 9, wherein the position information storage unit comprises at least one of an offset information storage unit, a rearrangement information storage unit, a channel information storage unit, and a stride information storage unit; The obtaining, from the position information storage unit corresponding to the weight information storage unit, the position information of the non-zero value weight in the weight matrix of the machine learning model includes at least one of the following methods: Obtaining the offset of the convolution slice corresponding to the non-zero value weight from the offset information storage unit; Acquire position rearrangement information of convolution slices corresponding to non-zero weights from the rearrangement information storage unit; Obtaining from the channel information storage unit an input channel corresponding to a convolution slice corresponding to a non-zero value weight; The number of slices of the convolution slice corresponding to the non-zero value weight is obtained from the stride information storage unit.

11. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method described in any one of claims 2 to 6 or any one of claims 7 to 10 are implemented.

12. A computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the method described in any one of claims 2 to 6 or any one of claims 7 to 10.

Citation Information

Patent Citations

  • Image processing acceleration method, image processing model storage method and corresponding devices

    CN111831254A

  • Data processing method and device, equipment and storage medium

    CN114648112A

  • Convolution operation circuit and method, neural network accelerator and electronic equipment

    CN115759212A

  • Model processing method and system

    CN116629375A

  • System and method for compact and efficient sparse neural networks

    US20190108436A1

Cited By

  • Model processing method and system

    CN116629375A