A model pruning method, device and medium based on memory computing power perception
By dynamically adjusting the pruning ratio of artificial intelligence models through a method based on memory computing power awareness, the problem of deploying multiple models on limited hardware resources is solved, achieving efficient resource utilization and satisfying model accuracy.
Patent Information
- Application Number
- CN202410874867.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-02
AI Technical Summary
Existing technology makes it difficult to effectively deploy multiple artificial intelligence models on limited hardware resources, and it is difficult to determine the appropriate model pruning ratio to meet model accuracy requirements.
Through a method based on memory computing power awareness, the hardware resource parameters of the target device and the hardware configuration parameters and model accuracy requirement parameters of multiple artificial intelligence models are determined, and multi-model pruning is performed to ensure that the hardware resources do not exceed the device limits and meet the model accuracy. According to requirements, the pruning ratio is dynamically adjusted to adapt to resource changes.
It achieves effective processing of deploying multiple artificial intelligence models on limited hardware resources, saves computing power and memory resources, and ensures that the model accuracy meets application requirements.
Smart Images

Figure CN118409872B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model pruning method, device and medium based on memory computing power perception. Background Art
[0002] Artificial Intelligence (AI) models consume a lot of computing power and memory resources. In order to deploy AI models on limited hardware resources, AI models need to be pruned and compressed. However, setting the pruning ratio of AI models has always been a difficult problem in model pruning.
[0003] How to determine the appropriate model pruning ratio to perform model pruning on the artificial intelligence model is a technical problem that technicians in this field need to solve. Summary of the invention
[0004] The purpose of the present invention is to provide a model pruning method, device and medium based on memory computing power perception, which is used to realize multi-task artificial intelligence model pruning processing based on device hardware resources, so as to make full use of device hardware resources and meet the application requirements of multiple artificial intelligence model reasoning tasks.
[0005] In order to solve the above technical problems, the present invention provides a model pruning method based on memory computing power perception, comprising:
[0006] Determine the hardware resource parameters of the target device for deploying the artificial intelligence model inference task; the types of the hardware resource parameters include the upper limit of device computing power and the upper limit of device memory;
[0007] Determine the hardware configuration parameters and model accuracy requirement parameters of the plurality of artificial intelligence model reasoning tasks; the types of the hardware configuration parameters include computing power requirement parameters and memory requirement parameters;
[0008] The first constraint condition is that the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device, and the second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters. After multi-model model pruning processing is performed on the artificial intelligence model adopted by the artificial intelligence model reasoning task to be deployed on the target device, the artificial intelligence model reasoning task is deployed.
[0009] On the one hand, the computing power constraint in the first constraint is expressed by the following formula:
[0010] ;
[0011] in,C is the upper limit of the computing power of the target device. For the i The computing power requirement parameters of the artificial intelligence model reasoning task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
[0012] On the other hand, the upper limit of the computing power of the target device is the maximum value of the number of floating-point operations per second of the target device;
[0013] The computing power requirement parameter of the artificial intelligence model reasoning task is the minimum number of floating-point operations performed per second by the artificial intelligence model reasoning task to meet the computing time requirement of the artificial intelligence model reasoning task.
[0014] On the other hand, the memory constraint in the first constraint is expressed by the following formula:
[0015] ;
[0016] in, M is the upper limit of the device memory of the target device, For the i The memory requirement parameters of the AI model inference task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
[0017] On the other hand, the second constraint is expressed by the following formula:
[0018] ;
[0019] in, For the i The actual model accuracy parameters of the artificial intelligence model reasoning task, For the i The model accuracy requirement parameters of the artificial intelligence model reasoning task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
[0020] On the other hand, a multi-model model pruning process is performed on the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device, including:
[0021] If at least one of the conditions of the change in the number of the artificial intelligence model inference tasks and the change in the hardware resource parameters of the target device is met, multi-model model pruning processing is performed on the artificial intelligence model adopted by the artificial intelligence model inference tasks to be deployed on the target device.
[0022] On the other hand, the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as a first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter as a second constraint condition, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including:
[0023] Determine the initial model pruning ratio of each artificial intelligence model reasoning task based on the average distribution of the hardware resource parameters of the target device to the artificial intelligence model reasoning tasks to be deployed on the target device;
[0024] After performing model pruning processing on each of the artificial intelligence model reasoning tasks according to the initial model pruning ratio, a model accuracy test is performed on the artificial intelligence model of each of the artificial intelligence model reasoning tasks, and the model pruning ratio of the artificial intelligence model of each of the artificial intelligence model reasoning tasks is adjusted according to the accuracy test results.
[0025] On the other hand, performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task according to the accuracy test result, including:
[0026] Performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task to obtain a third target task whose actual model accuracy meets the corresponding model accuracy requirement parameters and a fourth target task whose actual model accuracy does not meet the corresponding model accuracy requirement parameters;
[0027] Increase the model pruning ratio of the third target task, reduce the model pruning ratio of the fourth target task, and return to perform model accuracy testing on the artificial intelligence models of each artificial intelligence model reasoning task until the fourth target task does not exist.
[0028] On the other hand, performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task according to the accuracy test result, further comprising:
[0029] If the third target task does not exist, then after reducing the number of the artificial intelligence model reasoning tasks to be deployed on the target device, return to perform model accuracy testing on the artificial intelligence model of each artificial intelligence model reasoning task until the fourth target task does not exist.
[0030] On the other hand, the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as a first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter as a second constraint condition, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including:
[0031] Determine the artificial intelligence model reasoning task whose actual model accuracy meets the corresponding model accuracy requirement parameter and whose difference meets the first preset condition as the first target task, and the remaining artificial intelligence model reasoning tasks as the second target task;
[0032] Deducting the hardware resources occupied by the first target task that has been eliminated from the hardware resource parameters of the target device to obtain updated hardware resource parameters of the remaining hardware resources;
[0033] The first constraint condition is that the hardware resources required for the second target task deployed on the remaining hardware resources do not exceed the updated hardware resource parameters, and the second constraint condition is that the model accuracy of each second target task satisfies the corresponding model accuracy parameters, and multi-model model pruning processing is performed on the artificial intelligence model adopted by the second target task.
[0034] On the other hand, the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as a first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter as a second constraint condition, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including:
[0035] According to the order of the difference between the actual model accuracy and the corresponding model accuracy requirement parameter from large to small, model pruning is performed on each of the artificial intelligence model reasoning tasks in turn until the artificial intelligence model reasoning task deployed on the target device meets the first constraint condition and the second constraint condition.
[0036] On the other hand, the artificial intelligence model of the artificial intelligence model reasoning task is subjected to model pruning, including:
[0037] Calculate the number of neurons to be pruned based on the calculated model pruning ratio for the artificial intelligence model reasoning task and the number of neurons in the artificial intelligence model of the artificial intelligence model reasoning task;
[0038] Calculate the L1 norm corresponding to each weight in the artificial intelligence model of the artificial intelligence model reasoning task;
[0039] The calculated L1 norms are arranged from small to large, and the L1 norms are selected in sequence starting from the first L1 norm until the number of selected L1 norms reaches the number of neurons to be pruned, and the neurons corresponding to the weights corresponding to the selected L1 norms in the artificial intelligence model of the artificial intelligence model reasoning task are pruned.
[0040] In order to solve the above technical problems, the present invention also provides a model pruning device based on memory computing power perception, including:
[0041] Memory for storing computer programs;
[0042] A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the model pruning method based on memory computing power perception as described in any one of the above items are implemented.
[0043] In order to solve the above technical problems, the present invention also provides a non-volatile storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the model pruning method based on memory computing power perception as described in any one of the above items are implemented.
[0044] In order to solve the above technical problems, the present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the model pruning method based on memory computing power perception as described in any one of the above items.
[0045] The model pruning method based on memory computing power perception provided by the present invention has the beneficial effect of, after determining the hardware resource parameters of the target device including the device computing power upper limit and the device memory upper limit, as well as the hardware configuration parameters and model accuracy requirement parameters of multiple artificial intelligence model reasoning tasks, taking the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device not exceeding the hardware resource parameters of the target device as the first constraint condition, and taking the model accuracy of each artificial intelligence model reasoning task satisfying the corresponding model accuracy requirement parameters as the second constraint condition, performing multi-model model pruning processing on the artificial intelligence models adopted by the artificial intelligence model reasoning tasks to be deployed on the target device, realizing model pruning processing based on device hardware resources, and further realizing multi-task model pruning processing, thereby deploying multiple artificial intelligence model reasoning tasks on limited hardware resources and ensuring the application requirements of each task, while saving the computing power resources and memory resources of the device when processing various artificial intelligence tasks.
[0046] The present invention also provides a model pruning device, a non-volatile storage medium and a computer program product based on memory computing power perception, which have the above-mentioned beneficial effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 A framework diagram of a model pruning system based on memory computing power awareness provided by an embodiment of the present invention;
[0049] Figure 2 A flowchart of a model pruning method based on memory computing power perception provided by an embodiment of the present invention;
[0050] Figure 3 A schematic diagram of the structure of a model pruning device based on memory computing power awareness provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The core of the present invention is to provide a model pruning method, device and medium based on memory computing power perception, which is used to realize multi-task artificial intelligence model pruning processing based on device hardware resources, so as to make full use of device hardware resources and meet the application requirements of multiple artificial intelligence model reasoning tasks.
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] Nowadays, in the deployment of artificial intelligence models, as the number of artificial intelligence model reasoning tasks increases, it is often difficult to provide sufficient hardware resources to support multiple artificial intelligence model reasoning tasks. At this time, there is an application demand to deploy multiple artificial intelligence model reasoning tasks under limited device hardware resources. When facing new artificial intelligence model reasoning tasks, it is also necessary to allocate appropriate memory and computing power to support the task and minimize the impact on deployed tasks.
[0054] To solve this problem, an embodiment of the present invention provides a model pruning solution based on memory and computing power perception. By perceiving the real-time status of hardware resources such as computing power and memory of the device, for multiple artificial intelligence model reasoning tasks that need to be deployed, and in scenarios where the number of artificial intelligence model reasoning tasks that need to be deployed increases, reasonable memory and computing power resources are allocated to each artificial intelligence model reasoning task, ensuring the normal operation of multiple tasks under limited hardware resources while ensuring the execution effect of each artificial intelligence model reasoning task.
[0055] It should be noted that the target device in each embodiment of the present invention may refer to a single device or a distributed cluster including multiple devices, and the hardware resources it can provide are used to allocate to multiple artificial intelligence model reasoning tasks. The types of artificial intelligence model reasoning tasks in each embodiment of the present invention may include but are not limited to artificial intelligence question-answering tasks, graphics processing tasks, video processing tasks, and artificial intelligence generation tasks. Depending on the different model configuration parameters used, the number of each type of artificial intelligence model reasoning tasks may be more than one.
[0056] Figure 1 A framework diagram of a model pruning system based on memory computing power awareness provided in an embodiment of the present invention.
[0057] like Figure 1As shown, the model pruning system based on memory computing power perception provided by an embodiment of the present invention may include one or more target devices, which are used to provide hardware resources for performing artificial intelligence model reasoning tasks, and the types of hardware resources mainly include memory and computing power. Among them, the memory can be represented by the size of the storage space, and the computing power can be represented by the number of floating point operations per second (FLOPS), or other representation methods can be used. In order to perform more artificial intelligence model reasoning tasks on these limited hardware resources, it is necessary to perform model pruning processing on the artificial intelligence models used in one or more artificial intelligence model reasoning tasks. In order to ensure that the model calculation results of the artificial intelligence model after pruning and compression can still achieve the model accuracy acceptable to the user, it is necessary to adjust the pruning ratio of the artificial intelligence model based on the memory perception and computing power perception of the target device, so that when multiple artificial intelligence model reasoning tasks need to be deployed on limited hardware resources, these artificial intelligence model reasoning tasks can be pruned and compressed using a reasonable pruning ratio and then deployed on the target device, so as to fully utilize the hardware resources of the target device while completing the deployment of all artificial intelligence model reasoning tasks. When new AI model reasoning tasks need to be deployed, it is also necessary to adjust the pruning ratio of the AI models of the new AI model reasoning tasks and the already deployed AI model reasoning tasks in an attempt to deploy the new AI model reasoning tasks on the target device. When the number of deployed AI model reasoning tasks decreases, the pruning ratio of the AI models of the remaining deployed AI model reasoning tasks can also be adaptively adjusted to fully utilize the hardware resources of the target device and improve the model accuracy of the deployed AI model reasoning tasks.
[0058] In order to receive requests and configuration parameters input by the user, the model pruning system based on memory computing power awareness provided by the embodiment of the present invention may also include a user terminal, which is deployed with an application program interface of the computing power system provided by the target device.
[0059] like Figure 1 As shown, to execute the specific steps of the model pruning method based on memory computing power perception provided by an embodiment of the present invention, an embodiment of the present invention also provides a model pruning device based on memory computing power perception, which may include: a hardware resource perception module 101, used to determine the hardware resource parameters of the target device for deploying artificial intelligence model reasoning tasks; the types of hardware resource parameters include the device computing power upper limit and the device memory upper limit.
[0060] The task perception module 102 is used to determine the hardware configuration parameters and model accuracy requirement parameters of multiple artificial intelligence model reasoning tasks; the types of hardware configuration parameters include computing power requirement parameters and memory requirement parameters.
[0061] The model pruning calculation module 103 is used to perform multi-model model pruning calculations on the artificial intelligence models used in the artificial intelligence model reasoning tasks to be deployed on the target device, with the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device not exceeding the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task satisfying the corresponding model accuracy requirement parameters as the second constraint condition, to obtain the pruning ratio of the artificial intelligence models used in each artificial intelligence model reasoning task.
[0062] The model pruning processing module 104 is used to perform pruning processing of the artificial intelligence model according to the pruning ratio of the artificial intelligence model adopted for each artificial intelligence model reasoning task, so as to deploy the artificial intelligence model reasoning task after the pruning processing.
[0063] The hardware resource sensing module 101, the model pruning calculation module 103 and the model pruning processing module 104 can be deployed on the target device or another device connected to the target device in communication. The task sensing module 102 can be deployed on the user terminal or another device connected to the user terminal in communication.
[0064] After the model pruning device based on memory computing power perception provided by the embodiment of the present invention completes the model pruning processing of the artificial intelligence model reasoning task, each artificial intelligence model reasoning task is deployed on the target device to perform the model reasoning calculation on the target device and return the model calculation result to the user terminal.
[0065] Based on the above architecture, the model pruning method based on memory computing power awareness provided by an embodiment of the present invention is described below in conjunction with the accompanying drawings.
[0066] Figure 2 A flowchart of a model pruning method based on memory computing power awareness provided in an embodiment of the present invention.
[0067] like Figure 2 As shown, the model pruning method based on memory computing power perception provided by an embodiment of the present invention includes: S201: determining the hardware resource parameters of the target device used to deploy the artificial intelligence model reasoning task; the types of hardware resource parameters include the device computing power upper limit and the device memory upper limit.
[0068] S202: Determine the hardware configuration parameters and model accuracy requirement parameters of multiple artificial intelligence model reasoning tasks; the types of hardware configuration parameters include computing power requirement parameters and memory requirement parameters.
[0069] S203: The first constraint condition is that the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device do not exceed the hardware resource parameters of the target device, and the second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters. After multi-model model pruning processing is performed on the artificial intelligence model used in the artificial intelligence model reasoning tasks to be deployed on the target device, the artificial intelligence model reasoning tasks are deployed.
[0070] In a specific implementation, the model pruning method based on memory computing power awareness provided by an embodiment of the present invention can be implemented based on a target device or another device.
[0071] For S201, the hardware configuration parameters of the target device are obtained by deploying the hardware resource perception module 101. The memory can be represented by the size of the storage space, the computing power can be represented by the number of floating-point operations, or other representation methods can be used.
[0072] For S202, in response to the reasoning task increase or decrease request sent by the user, the model pruning task of the artificial intelligence model reasoning task is triggered.
[0073] For the artificial intelligence model reasoning task that needs to be deployed on the target device, obtain the currently required hardware configuration parameters and model accuracy requirement parameters, where the hardware configuration parameters are determined by the artificial intelligence model adopted by the artificial intelligence model reasoning task, and the model accuracy requirement parameters can be the model calculation accuracy requirement input by the user of the artificial intelligence model reasoning task.
[0074] For S203, in some optional implementations of the embodiments of the present invention, the relationship between the computing power of the multi-artificial intelligence model reasoning task and the upper limit of the computing power of the device can be expressed in a summation manner, and the computing power constraint in the first constraint can be expressed by the following formula:
[0075] . (1)
[0076] in, C The upper limit of the target device’s computing power. For the i The computing power requirement parameters of an AI model inference task, n The number of AI model inference tasks deployed on the target device.
[0077] At this time, the target device's computing power limit C The computing power requirement parameter of the AI model inference task can be expressed by the maximum number of floating-point operations per second of the target device. It can be expressed by the minimum number of floating-point operations per second performed by the AI model reasoning task that meets the computing time requirements of the AI model reasoning task.i The AI model inference task is executed once for a total of 3000 floating point operations (FLOPs). The longest computing time that the user can tolerate is 10 seconds. The target device needs to allocate at least 300 FLOPS of computing power for the AI model inference task to meet the user's computing time requirements for the AI model inference task. i AI model reasoning tasks, and their computing power requirements It can be recorded as 300, the upper limit of the target device's computing power C =3000.
[0078] The relationship between the memory required for multi-AI model reasoning tasks and the upper limit of device memory can also be expressed in a summation manner. The memory constraint in the first constraint can be expressed by the following formula:
[0079] . (2)
[0080] in, M is the upper limit of the device memory of the target device, For the i The memory requirement parameters of an AI model inference task, n The number of AI model inference tasks deployed on the target device.
[0081] The second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters, which can be expressed by the following formula:
[0082] . (3)
[0083] in, For the i The actual model accuracy parameters of the AI model reasoning task, For the i The model accuracy requirement parameters of an artificial intelligence model reasoning task, n The number of AI model inference tasks deployed on the target device.
[0084] The actual model accuracy parameters and model accuracy requirement parameters can be expressed as mean average precision (MAP). If the model accuracy parameters representing the error rate are used, the second constraint condition is that the actual model accuracy parameters of each artificial intelligence model reasoning task are less than or equal to the corresponding model accuracy requirement parameters.
[0085] The above constraints can also be represented in other ways so that the multiple artificial intelligence model reasoning tasks to be deployed can fully utilize the hardware resources that the target device can provide.
[0086] The model pruning method based on memory computing power awareness provided by an embodiment of the present invention can be applied to the initial deployment of artificial intelligence model reasoning tasks on a target device, and can also be applied to dynamic model pruning to adaptively adjust model parameters when the environment or task changes.
[0087] The multi-model model pruning processing of the artificial intelligence model adopted by the artificial intelligence model reasoning task to be deployed on the target device in S203 may include: if at least one of the conditions of the change in the number of artificial intelligence model reasoning tasks and the change in the hardware resource parameters of the target device is met, the multi-model model pruning processing of the artificial intelligence model adopted by the artificial intelligence model reasoning task to be deployed on the target device is performed.
[0088] It should be noted that, in the embodiment of the present invention, the pruning ratio refers to the ratio of pruning the artificial intelligence model.
[0089] When the user increases or decreases artificial intelligence model reasoning tasks or changes the parameters of artificial intelligence model reasoning tasks, and the hardware resources of the target device change, such as the number of artificial intelligence model reasoning tasks increases or the hardware resources of the target device decreases, it is necessary to increase the pruning ratio of the deployed artificial intelligence model reasoning tasks; if the number of artificial intelligence model reasoning tasks decreases or the hardware resources of the target device increase, it is optional to reduce the pruning ratio of the deployed artificial intelligence model reasoning tasks to improve the model calculation accuracy and make full use of the resources of the target device. Of course, at this time, the pruning ratio of the deployed artificial intelligence model reasoning tasks can also be unchanged to reserve hardware resources for future artificial intelligence model reasoning tasks.
[0090] In practical applications, when the system is initialized, the initial multiple artificial intelligence model reasoning tasks need to be deployed on the target device. At this time, the model pruning method based on memory computing power perception provided by the embodiment of the present invention is used to calculate the appropriate pruning ratio of each artificial intelligence model reasoning task, and then the artificial intelligence model reasoning tasks are deployed. Of course, even if the model accuracy of each artificial intelligence model reasoning task is close to the boundary of the model accuracy requirement parameter after model pruning for each artificial intelligence model reasoning task, and the hardware resources that the target device can provide are still insufficient to support the deployment of all artificial intelligence model reasoning tasks, it is necessary to reduce the number of artificial intelligence model reasoning tasks or increase the hardware resources of the target device.
[0091] During system operation, if the above-mentioned conditions for triggering the model pruning task of the artificial intelligence model reasoning task are met, the appropriate pruning ratio is calculated for the new artificial intelligence model reasoning task (if any) and the deployed artificial intelligence model reasoning task, thereby realizing dynamic pruning of multiple artificial intelligence model reasoning tasks based on the computing power and memory of the device.
[0092] During system operation, when it is necessary to adjust the pruning ratio of a deployed artificial intelligence model reasoning task, the artificial intelligence model reasoning task may be in a running state, that is, it is executing model reasoning calculations. At this time, it is impossible to immediately stop the artificial intelligence model reasoning task and perform model pruning.
[0093] In this regard, in some optional implementations of the embodiments of the present invention, a device with the same hardware configuration as the target device that is running the artificial intelligence model reasoning task A can be used to deploy the same artificial intelligence model reasoning task A' and perform model pruning processing on the artificial intelligence model reasoning task A', and after the calculation of the running artificial intelligence model reasoning task A is completed, it is replaced with the artificial intelligence model reasoning task A' that has been pruned on another device.
[0094] In some other optional implementations of the embodiments of the present invention, master-slave tasks may also be deployed, that is, when artificial intelligence model reasoning task A is running, model pruning is performed on the standby artificial intelligence model reasoning task A', and after the calculation of the artificial intelligence model reasoning task A is completed, the artificial intelligence model reasoning task A is switched to the pruned artificial intelligence model reasoning task A' in the application interface configuration provided to the user, so that the two tasks serve as master and standby to each other, and the next time the artificial intelligence model reasoning task needs to be pruned, the above operation is repeated and then switched back to the artificial intelligence model reasoning task A, and so on.
[0095] In an embodiment of the present invention, model pruning processing is performed on the artificial intelligence model of the artificial intelligence model reasoning task in S203, which may include: calculating the number of neurons to be pruned based on the calculated model pruning ratio of the artificial intelligence model reasoning task and the number of neurons in the artificial intelligence model of the artificial intelligence model reasoning task; calculating the L1 norm corresponding to each weight in the artificial intelligence model of the artificial intelligence model reasoning task; arranging the calculated L1 norms from small to large, and selecting L1 norms in sequence from the first L1 norm until the number of selected L1 norms reaches the number of neurons to be pruned, and pruning the neurons corresponding to the weights corresponding to the selected L1 norm in the artificial intelligence model of the artificial intelligence model reasoning task.
[0096] In practical applications, for example, in a computing system, assuming that there are 500TFLOPS (TeraFLOPS, trillion floating-point operations per second) of computing power and 120GB (Gigabyte, 1GB equals 1,073,741,824 bytes) of memory, three AI model inference tasks for target detection have been run, and they have occupied 450TFLOPS of computing power and 100G of memory. A new AI model inference task for generating video subtitles has arrived. This AI model inference task requires 200TFLOPS of computing power and 50G of memory when the model is not compressed. At this time, if these four AI model inference tasks are run on the target device without model pruning, the computing time of one or more of the AI model inference tasks will not meet the user's demand for task execution time. At the same time, the memory resources that the target device can provide cannot accommodate all the model parameters of the AI models used by these four AI model inference tasks. At this time, it is necessary to reallocate the hardware resources of the deployed artificial intelligence model reasoning tasks in the target device, in order to allocate computing power and memory resources for the operation of the artificial intelligence model reasoning tasks used to generate video subtitles. The model pruning method based on memory computing power perception provided by the embodiment of the present invention is used to dynamically prune and compress the artificial intelligence models used in the above four artificial intelligence model reasoning tasks. For example, under the condition of meeting the model accuracy requirement parameters provided by the user, the compressed three artificial intelligence model reasoning tasks for target detection only require 320TFLOPS of computing power and 90G of memory, and the new artificial intelligence model reasoning task for generating video subtitles only requires 160TFLOPS of computing power and 30G of memory, so that the total computing power and memory requirements are less than or equal to the device computing power upper limit and device memory upper limit of the target device. Through the model pruning method based on memory computing power perception provided by the embodiment of the present invention, the dynamic reallocation of hardware resources under the newly added tasks is completed, and the newly arrived artificial intelligence model reasoning tasks are successfully deployed under limited hardware resources, while meeting the model accuracy requirements defined by the user.
[0097] When an artificial intelligence model reasoning task in the target device needs to be de-deployed, the model pruning method based on memory computing power awareness provided by the embodiment of the present invention can also be used to search for the pruning ratio, and finally obtain the pruning ratio of the artificial intelligence model reasoning task, and then deploy and adjust it.
[0098] The model pruning method based on memory computing power perception provided by an embodiment of the present invention has the beneficial effect of determining the hardware resource parameters of the target device including the device computing power upper limit and the device memory upper limit, as well as the hardware configuration parameters and model accuracy requirement parameters of multiple artificial intelligence model reasoning tasks. The first constraint condition is that the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device do not exceed the hardware resource parameters of the target device, and the second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters. Multi-model model pruning processing is performed on the artificial intelligence models used in the artificial intelligence model reasoning tasks to be deployed on the target device, thereby realizing model pruning processing based on device hardware resources, and further realizing multi-task model pruning processing, thereby deploying multiple artificial intelligence model reasoning tasks on limited hardware resources and ensuring the application requirements of each task, while saving the computing power resources and memory resources of the device when processing various artificial intelligence tasks.
[0099] On the basis of the above embodiments, in some optional implementations of the embodiments of the present invention, in S203, the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters as the second constraint condition, and multi-model model pruning processing is performed on the artificial intelligence models used in the artificial intelligence model reasoning tasks to be deployed on the target device, which may include: determining the initial model pruning ratio of each artificial intelligence model reasoning task based on the average distribution of the hardware resource parameters of the target device to the artificial intelligence model reasoning tasks to be deployed on the target device; after performing model pruning processing on each artificial intelligence model reasoning task according to the initial model pruning ratio, performing model accuracy testing on the artificial intelligence model of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task according to the accuracy test results.
[0100] Among them, performing model accuracy testing on the artificial intelligence models of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence models of each artificial intelligence model reasoning task according to the accuracy test results can include: performing model accuracy testing on the artificial intelligence models of each artificial intelligence model reasoning task to obtain a third target task whose actual model accuracy meets the corresponding model accuracy requirement parameters and a fourth target task whose actual model accuracy does not meet the corresponding model accuracy requirement parameters; increasing the model pruning ratio of the third target task, reducing the model pruning ratio of the fourth target task, and returning to performing model accuracy testing on the artificial intelligence models of each artificial intelligence model reasoning task until the fourth target task does not exist.
[0101] Furthermore, the model accuracy test is performed on the artificial intelligence model of each artificial intelligence model reasoning task, and the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task is adjusted according to the accuracy test result. It can also include: if there is no third target task, then the number of artificial intelligence model reasoning tasks to be deployed on the target device is reduced, and then the model accuracy test of the artificial intelligence model of each artificial intelligence model reasoning task is returned until there is no fourth target task.
[0102] In some other optional implementations of the embodiments of the present invention, in S203, the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters as the second constraint condition, and the artificial intelligence model used by the artificial intelligence model reasoning tasks to be deployed on the target device is subjected to multi-model model pruning processing, which may include: determining the initial model pruning ratio of each artificial intelligence model reasoning task based on the average distribution of the hardware resource parameters of the target device to the artificial intelligence model reasoning tasks to be deployed on the target device; after performing model pruning processing on each artificial intelligence model reasoning task according to the initial model pruning ratio, performing model accuracy testing on the artificial intelligence model of each artificial intelligence model reasoning task to determine a third target task whose actual model accuracy meets the corresponding model accuracy requirement parameters and a fourth target task whose actual model accuracy does not meet the corresponding model accuracy requirement parameters; selecting a third target task and a fourth target task, respectively using the first preset adjustment step to increase the model pruning ratio of the third target task and using the second preset adjustment step to reduce the model pruning ratio of the fourth target task, and then testing the adjusted third target task and the adjusted fourth target task. The third objective task and the fourth objective task are both marked as the third objective task if they both meet the corresponding model accuracy requirement parameters. If the third objective task does not meet the corresponding model accuracy requirement parameters, and there is an unadjusted third objective task, the model pruning ratio of the adjusted third objective task is rolled back, and another third objective task is selected, and then a third objective task and a fourth objective task are selected, and the model pruning ratio of the third objective task is increased by the first preset adjustment step size, and the model pruning ratio of the third objective task is decreased by the second preset adjustment step size. The method further comprises the steps of increasing the model pruning ratio of the third target task to reduce the model pruning ratio of the fourth target task; if the adjusted third target task does not meet the corresponding model accuracy requirement parameters, and there is no third target task that has not been adjusted, outputting information that the number of artificial intelligence model reasoning tasks exceeds the limit; if the adjusted fourth target task does not meet the corresponding model accuracy requirement parameters, returning the steps of increasing the model pruning ratio of the third target task by the first preset adjustment step and decreasing the model pruning ratio of the fourth target task by the second preset adjustment step to the adjusted third target task and the adjusted fourth target task respectively; if there is no fourth target task, determining that the model pruning processing of multiple models has been completed.
[0103] Corresponding to the above method, the embodiment of the present invention provides the following implementation method: Step 1: Assume that after adding a new artificial intelligence model reasoning task, the artificial intelligence model reasoning task being run is nThe computing power requirement parameters required for the operation of the artificial intelligence model before pruning for each artificial intelligence model reasoning task are [ , ,……, ], the memory requirement parameter is [ , ,……, ], the lower limit requirement of the model accuracy requirement parameters for each artificial intelligence model reasoning task is [ , ,……, ], the upper limit of the total computing power that all target devices can provide is C , the total device memory limit is M All of this information can be obtained from the information collected by the hardware resource perception module 101 and the task perception module 102 .
[0104] Step 2: Establish computing power constraints, memory constraints, and model accuracy constraints based on formulas (1), (2), and (3).
[0105] Step 3: The determined initial model pruning ratio can be expressed as , that is, firstly adopt the uniform pruning method, the proportion of each artificial intelligence model reasoning task being pruned is the same, and the larger value of pruning based on computing power or pruning based on memory is taken to ensure that each artificial intelligence model reasoning task can adapt to the hardware resources provided by the target device after model pruning; then, the pruning ratio of each model can be defined as A=[ , ,……, ], each value in this list is the initial model pruning ratio a .
[0106] Step 4: Prune according to the initial model ratio a Perform model homogenization pruning, and the pruning standard can be the L1 norm of the weight, that is, give priority to pruning and removing neurons corresponding to weights with smaller values, and retain neurons corresponding to weights with larger values. That is to say, according to the calculated model pruning ratio for the artificial intelligence model reasoning task and the number of neurons in the artificial intelligence model of the artificial intelligence model reasoning task, calculate the number of neurons to be pruned; calculate the L1 norm corresponding to each weight in the artificial intelligence model of the artificial intelligence model reasoning task; arrange the calculated L1 norms from small to large, and select L1 norms in sequence from the first L1 norm until the number of selected L1 norms reaches the number of neurons to be pruned, and prune the neurons corresponding to the weights corresponding to the selected L1 norm from the artificial intelligence model of the artificial intelligence model reasoning task.
[0107] Step 5: Obtain all AI models after dynamic pruning. According to the pruned AI models, use the test set to obtain the prediction accuracy of each model. Then divide the AI models into two categories, including models that meet the accuracy X=[ , ,……, ] and the model Y=[ , ,……, ].
[0108] Step 6: If Y is empty, exit the model pruning task and return to the current [ , ,……, ] is the final pruning ratio. Otherwise, go to step 7.
[0109] Step 7: Select the first AI model from Y , and select the first AI model in X .
[0110] Step 8: For the same , constantly trying to improve The pruning ratio is reduced The pruning ratio can be adjusted with a fixed step size each time. For example, the fixed adjustment step size is The pruning ratio is 5%, and then it can be estimated The proportion of each adjustment decrease is The principle of calculation is to ensure that the computing power and memory do not exceed the upper limit, and then After the pruning ratio is increased by 5%, the saved hardware resources are allocated to the artificial intelligence model as much as possible. .
[0111] Step 9: Use the test set to obtain the adjusted , The following judgment is performed: If the accuracy of both models meets the lower limit of the model accuracy requirement parameter, then the adjusted pruning ratios of the two models are recorded in A and step 10 is performed; if If the lower limit of the model accuracy requirement parameter is not met, go to step 11; if If the lower limit of the model accuracy requirement parameter is not met, proceed directly to step 8.
[0112] Step 10: If there are no more y If it is operable, it means that the pruning ratio is adjusted, and the final output is the pruning ratio A. Otherwise, select the next one in Y y As , select the first model in X as , reset the adjusted pruning ratio and execute step 8.
[0113] Step 11: If there are no more x If it is operable, it means that it is impossible to add a new AI model reasoning task while meeting the model accuracy required by the user, and finally outputs the message that the number of AI model reasoning tasks exceeds the limit. Otherwise, select the next one in X x As , reset the adjusted pruning ratio and execute step 8.
[0114] On the basis of the above embodiments, in other optional implementations of the embodiments of the present invention, in S203, the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters as the second constraint condition, and the artificial intelligence model adopted by the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, which may include: determining the artificial intelligence model reasoning task whose actual model accuracy meets the corresponding model accuracy requirement parameters and whose difference meets the first preset condition as the first target task, and the remaining artificial intelligence model reasoning tasks as the second target task; deducting the hardware resources occupied by the eliminated first target task from the hardware resource parameters of the target device to obtain updated hardware resource parameters of the remaining hardware resources; taking the hardware resources required for the second target task deployed on the remaining hardware resources not exceeding the updated hardware resource parameters as the first constraint condition, and taking the model accuracy of each second target task satisfying the corresponding model accuracy parameters as the second constraint condition, and performing multi-model model pruning processing on the artificial intelligence model adopted by the second target task.
[0115] That is to say, when performing model pruning on multiple models, we can first eliminate the artificial intelligence model reasoning tasks that are close to the model accuracy requirements, and only perform model pruning on the remaining artificial intelligence model reasoning tasks, thereby reducing the complexity of the model pruning tasks.
[0116] On the basis of the above embodiments, in other optional implementations of the embodiments of the present invention, in S203, the hardware resources required for the artificial intelligence model reasoning tasks deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameters as the second constraint condition, and multi-model model pruning processing is performed on the artificial intelligence model adopted by the artificial intelligence model reasoning tasks to be deployed on the target device, which may include: performing model pruning processing on each artificial intelligence model reasoning task in turn according to the order of the difference between the actual model accuracy and the corresponding model accuracy requirement parameters from large to small, until the artificial intelligence model reasoning task deployed on the target device meets the first constraint condition and the second constraint condition.
[0117] That is to say, the pruning order can be determined from large to small based on the difference between the model calculation accuracy of the current artificial intelligence model of each artificial intelligence model reasoning task and the model accuracy requirement parameters, and pruning can be performed sequentially or in batches, thereby reducing the complexity of the model pruning task.
[0118] It should be noted that in the embodiments of the model pruning method based on memory computing power perception of the present invention, some of the steps or features can be ignored or not executed. The hardware or software functional modules divided for the convenience of explanation are not the only implementation form of the model pruning method based on memory computing power perception provided by the embodiments of the present invention.
[0119] The above details the various embodiments corresponding to the model pruning method based on memory computing power perception. On this basis, the present invention also discloses a model pruning device based on memory computing power perception, a non-volatile storage medium and a computer program product corresponding to the above method.
[0120] Figure 3 A schematic diagram of the structure of a model pruning device based on memory computing power awareness provided in an embodiment of the present invention.
[0121] like Figure 3 As shown, the model pruning device based on memory computing power awareness provided by an embodiment of the present invention includes: a memory 310 for storing a computer program 311.
[0122] The processor 320 is used to execute the computer program 311, which, when executed by the processor 320, implements the steps of the model pruning method based on memory computing power awareness as provided in any of the above embodiments.
[0123] Among them, the processor 320 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 320 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 320 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 320 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 320 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0124] The memory 310 may include one or more non-volatile storage media, which may be non-transitory. The memory 310 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 310 is at least used to store the following computer program 311, wherein the computer program 311, after being loaded and executed by the processor 320, can implement the relevant steps in the model pruning method based on memory computing power perception disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 310 may also include an operating system 312 and data 313, etc., and the storage method may be short-term storage or permanent storage. Among them, the operating system 312 may be Windows or other types of operating systems. Data 313 may include, but is not limited to, the data involved in the above method.
[0125] In some embodiments, the model pruning device based on memory computing power perception may also include a display screen 330, a power supply 340, a communication interface 350, an input and output interface 360, a sensor 370 and a communication bus 380.
[0126] Those skilled in the art will understand that Figure 3 The structure shown in does not constitute a limitation on the memory computing power-aware model pruning device and may include more or fewer components than shown in the figure.
[0127] The model pruning device based on memory computing power awareness provided in an embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the steps of the model pruning method based on memory computing power awareness provided in the above embodiment, and the effect is the same as above.
[0128] An embodiment of the present invention provides a non-volatile storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the model pruning method based on memory computing power awareness provided in any one of the above embodiments can be implemented.
[0129] The non-volatile storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0130] For an introduction to the non-volatile storage medium provided in an embodiment of the present invention, please refer to the above-mentioned method embodiment, and the effect thereof is the same as the model pruning method based on memory computing power perception provided in an embodiment of the present invention, and the present invention will not elaborate on it here.
[0131] An embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of a model pruning method based on memory computing power awareness as provided in any one of the above embodiments.
[0132] For an introduction to the computer program product provided in an embodiment of the present invention, please refer to the above-mentioned method embodiment. The effect thereof is the same as the model pruning method based on memory computing power perception provided in an embodiment of the present invention, and the present invention will not elaborate on it here.
[0133] The above is a detailed introduction to a model pruning method, device and medium based on memory computing power perception provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the devices, non-volatile storage media and computer program products disclosed in the embodiments, since they correspond to the methods and systems disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method and system description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in several ways, and these improvements and modifications also fall within the scope of protection of the present invention.
[0134] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A model pruning method based on memory computing power perception, characterized in that: include: Determine the hardware resource parameters of the target device for deploying AI model inference tasks; The types of the hardware resource parameters include the upper limit of device computing power and the upper limit of device memory; Determine the hardware configuration parameters and model accuracy requirement parameters of the plurality of artificial intelligence model reasoning tasks; the types of the hardware configuration parameters include computing power requirement parameters and memory requirement parameters; The hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter as the second constraint condition. After multi-model model pruning processing is performed on the artificial intelligence model adopted by the artificial intelligence model reasoning task to be deployed on the target device, the artificial intelligence model reasoning task is deployed; Among them, the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device as the first constraint condition, and the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter as the second constraint condition, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including: Determine the initial model pruning ratio of each artificial intelligence model reasoning task based on the average distribution of the hardware resource parameters of the target device to the artificial intelligence model reasoning tasks to be deployed on the target device; After performing model pruning processing on each of the artificial intelligence model reasoning tasks according to the initial model pruning ratio, a model accuracy test is performed on the artificial intelligence model of each of the artificial intelligence model reasoning tasks, and the model pruning ratio of the artificial intelligence model of each of the artificial intelligence model reasoning tasks is adjusted according to the accuracy test results.
2. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: The computing power constraint in the first constraint is expressed by the following formula: ; in, C is the upper limit of the computing power of the target device. For the i The computing power requirement parameters of the artificial intelligence model reasoning task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
3. The model pruning method based on memory computing power perception according to claim 2 is characterized in that: The upper limit of the computing power of the target device is the maximum number of floating-point operations per second of the target device; The computing power requirement parameter of the artificial intelligence model reasoning task is the minimum number of floating-point operations performed per second by the artificial intelligence model reasoning task to meet the computing time requirement of the artificial intelligence model reasoning task.
4. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: The memory constraint in the first constraint is expressed by the following formula: ; in, M is the upper limit of the device memory of the target device, For the i The memory requirement parameters of the AI model inference task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
5. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: The second constraint is expressed by the following formula: ; in, For the i The actual model accuracy parameters of the artificial intelligence model reasoning task, For the i The model accuracy requirement parameters of the artificial intelligence model reasoning task, n is the number of inference tasks of the artificial intelligence model deployed on the target device.
6. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: Performing multi-model model pruning processing on the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device, including: If at least one of the conditions of the change in the number of the artificial intelligence model inference tasks and the change in the hardware resource parameters of the target device is met, multi-model model pruning processing is performed on the artificial intelligence model adopted by the artificial intelligence model inference tasks to be deployed on the target device.
7. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: Performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task according to the accuracy test result, including: Performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task to obtain a third target task whose actual model accuracy meets the corresponding model accuracy requirement parameters and a fourth target task whose actual model accuracy does not meet the corresponding model accuracy requirement parameters; Increase the model pruning ratio of the third target task, reduce the model pruning ratio of the fourth target task, and return to perform model accuracy testing on the artificial intelligence models of each artificial intelligence model reasoning task until the fourth target task does not exist.
8. The model pruning method based on memory computing power perception according to claim 7 is characterized in that: Performing a model accuracy test on the artificial intelligence model of each artificial intelligence model reasoning task, and adjusting the model pruning ratio of the artificial intelligence model of each artificial intelligence model reasoning task according to the accuracy test result, further comprising: If the third target task does not exist, then after reducing the number of the artificial intelligence model reasoning tasks to be deployed on the target device, return to perform model accuracy testing on the artificial intelligence model of each artificial intelligence model reasoning task until the fourth target task does not exist.
9. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: The first constraint condition is that the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device, and the second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including: Determine the artificial intelligence model reasoning task whose actual model accuracy meets the corresponding model accuracy requirement parameter and whose difference meets the first preset condition as the first target task, and the remaining artificial intelligence model reasoning tasks as the second target task; Deducting the hardware resources occupied by the first target task that has been eliminated from the hardware resource parameters of the target device to obtain updated hardware resource parameters of the remaining hardware resources; The first constraint condition is that the hardware resources required for the second target task deployed on the remaining hardware resources do not exceed the updated hardware resource parameters, and the second constraint condition is that the model accuracy of each second target task satisfies the corresponding model accuracy parameters, and multi-model model pruning processing is performed on the artificial intelligence model adopted by the second target task.
10. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: The first constraint condition is that the hardware resources required for the artificial intelligence model reasoning task deployed on the target device do not exceed the hardware resource parameters of the target device, and the second constraint condition is that the model accuracy of each artificial intelligence model reasoning task meets the corresponding model accuracy requirement parameter, and the artificial intelligence model used in the artificial intelligence model reasoning task to be deployed on the target device is subjected to multi-model model pruning processing, including: According to the order of the difference between the actual model accuracy and the corresponding model accuracy requirement parameter from large to small, model pruning is performed on each of the artificial intelligence model reasoning tasks in turn until the artificial intelligence model reasoning task deployed on the target device meets the first constraint condition and the second constraint condition.
11. The model pruning method based on memory computing power perception according to claim 1 is characterized in that: Performing model pruning processing on the artificial intelligence model of the artificial intelligence model reasoning task, including: Calculate the number of neurons to be pruned based on the calculated model pruning ratio for the artificial intelligence model reasoning task and the number of neurons in the artificial intelligence model of the artificial intelligence model reasoning task; Calculate the L1 norm corresponding to each weight in the artificial intelligence model of the artificial intelligence model reasoning task; The calculated L1 norms are arranged from small to large, and the L1 norms are selected in sequence starting from the first L1 norm until the number of selected L1 norms reaches the number of neurons to be pruned, and the neurons corresponding to the weights corresponding to the selected L1 norms in the artificial intelligence model of the artificial intelligence model reasoning task are pruned.
12. A model pruning device based on memory computing power perception, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the model pruning method based on memory computing power awareness as described in any one of claims 1 to 11 are implemented.
13. A non-volatile storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the model pruning method based on memory computing power perception as described in any one of claims 1 to 11 are implemented.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by the processor, the steps of the model pruning method based on memory computing power awareness as described in any one of claims 1 to 11 are implemented.
