Network model determination method and apparatus
By utilizing AutoTVM and software simulation technology on a cloud service platform, operators in deep learning network models are optimized, solving the problem of low tuning efficiency on hardware platforms and achieving efficient and low-cost network model deployment.
Patent Information
- Application Number
- CN202110528493.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-14
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-05-14
AI Technical Summary
In existing technologies, the deployment and optimization of deep learning networks on hardware platforms suffer from inefficiency and resource waste, especially when optimizing operators on embedded devices, which requires a lot of resources and time.
By utilizing AutoTVM's automatic tuning method on a cloud service platform, combined with software simulation and distributed deployment, operators in the initial network model are optimized, achieving automated tuning of the initial network model, reducing dependence on dedicated hardware clusters, and improving tuning efficiency.
It enables large-scale, highly scalable, and low-cost network model optimization on cloud service platforms, greatly accelerating operator search time, improving optimization efficiency, and reducing resource waste.
Smart Images

Figure CN115345061B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of computer technology, and particularly relate to a network model determination method. One or more embodiments of the present specification also relate to a network model determination apparatus and a computing device. BACKGROUND
[0002] With the continuous development of the field of artificial intelligence, deep learning networks are increasingly used in various project scenarios, such as common face recognition, pedestrian and vehicle detection in automatic driving, lane line detection, traffic light recognition, etc. The recognition rate and timeliness of deep learning networks in these project scenarios are also highly required. Generally speaking, the deeper the network is, the higher the detection rate will be, and the slower the inference efficiency of the network will be. Based on the analysis of the neural network model, efficiently deploying the neural network model to the corresponding deep learning hardware is a major challenge. SUMMARY
[0003] Therefore, the embodiments of the present specification provide a network model determination method. One or more embodiments of the present specification also relate to a network model determination apparatus and a computing device to solve the technical defects in the prior art.
[0004] According to a first aspect of the embodiments of the present specification, a network model determination method is provided, comprising:
[0005] obtaining an initial network model and determining an initial operator of the initial network model;
[0006] According to the pre-determined parameter space information and the information of the hardware platform to be deployed, the initial operator is optimized through a software model to obtain a simulation implementation of the initial operator on the hardware platform to be deployed;
[0007] The initial network model is optimized using the simulation implementation of the initial operator on the hardware platform to be deployed to obtain a deployment model of the initial network model on the hardware platform to be deployed.
[0008] According to a second aspect of the embodiments of the present specification, a network model determination apparatus is provided, comprising:
[0009] An obtaining module is configured to obtain an initial network model and determine an initial operator of the initial network model;
[0010] An optimization module is configured to optimize the initial operator according to the pre-determined parameter space information and the information of the hardware platform to be deployed through a software model to obtain a simulation implementation of the initial operator on the hardware platform to be deployed;
[0011] An optimization module is configured to optimize the initial network model by using the simulation implementation of the initial operator on the hardware platform to be deployed, to obtain a deployment model of the initial network model on the hardware platform to be deployed.
[0012] According to a third aspect of an embodiment of the present specification, a computing device is provided, comprising:
[0013] a memory and a processor;
[0014] The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, and when the processor executes the computer executable instructions, the steps of the network model determination method are implemented.
[0015] One embodiment of the present specification obtains an initial network model, and determines an initial operator of the initial network model; according to pre-determined parameter space information and information of a hardware platform to be deployed, the initial operator is optimized by a software model to obtain a simulation implementation of the initial operator on the hardware platform to be deployed; and the initial network model is optimized by using the simulation implementation of the initial operator on the hardware platform to be deployed, to obtain a deployment model of the initial network model on the hardware platform to be deployed, which not only realizes automatic optimization of a large-scale deployment and flexible expansion network, but also greatly accelerates operator search time and improves operator optimization efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 is a system architecture diagram of a network model determination method provided by one embodiment of the present specification applied to a hardware platform;
[0017] Figure 2 is a flowchart of a network model determination method provided by one embodiment of the present specification;
[0018] Figure 3 is a process flowchart of initial operator optimization of a network model determination method provided by one embodiment of the present specification;
[0019] Figure 4 is a distributed deployment architecture diagram of single operator optimization in a network model determination method provided by one embodiment of the present specification;
[0020] Figure 5 is a distributed deployment architecture diagram of multiple operator optimization in a network model determination method provided by one embodiment of the present specification;
[0021] Figure 6 is a structural schematic diagram of a network model determination device provided by one embodiment of the present specification;
[0022] Figure 7 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0023] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than those described herein, and it is understood that the scope of the present specification is not limited to the details of the description.
[0024] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0025] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used only to distinguish one from another. For example, without departing from the scope of one or more embodiments of the present specification, first can be termed second, and similarly, second can be termed first. Depending on the context, the word "if' as used herein can be interpreted to mean "when" or "in response to determining."
[0026] First, the noun terms related to one or more embodiments of the present specification are explained.
[0027] AutoTVM: an open source software that automatically searches for an efficient operator implementation suitable for a certain hardware platform through search.
[0028] Deep learning network: an algorithmic model of network structure, composed of many layers, each layer outputs according to its own input and the mathematical definition of the corresponding operator, and these outputs are also used as the input of other layers.
[0029] Inference engine: converts the definition of a deep learning network into specific code, executes on a corresponding deep learning accelerator platform, and completes the inference process of the deep learning network.
[0030] Operator auto-tuning: according to the definition of the operator in the deep learning network, an efficient code implementation on a specific deep learning accelerator is automatically found through a search, so that the inference time is shorter.
[0031] Distributed deployment: large tasks are split into small tasks and distributed to multiple machines for execution.
[0032] Software simulation: re-implement the function of hardware through a software way, achieve the effect close to the real work of hardware.
[0033] With the continuous development of the field of artificial intelligence, deep learning networks are increasingly used in various project scenarios, such as common face recognition, pedestrian and vehicle detection in automatic driving, lane line detection, traffic light recognition, etc. The recognition rate and timeliness of deep learning networks in these project scenarios are also highly required. However, the detection rate of the network and the timeliness of the network usually need to be balanced. Generally speaking, the deeper the network is, the higher the detection rate will be, and the slower the inference efficiency of the network will be. The network model determination method provided by the embodiments of the present specification not only proposes challenges to the structure design and parameter optimization of the network model, but also proposes similar challenges to the inference engine of the network. The core of the network engine is based on the implementation of an efficient operator library. These operator libraries are usually written by those skilled in the art according to the specific hardware characteristics, and then for a specific hardware, efficient operators can be automatically generated. The network model determination method provided by the embodiments of the present specification is based on the search of efficient operators by the inference engine, and proposes an automatic optimization deployment scheme based on software simulation, which helps the inference engine to automatically search for efficient operators in a shorter time.
[0034] The network model determination method provided by the embodiments of the present specification includes that AutoTVM proposes an automatic optimization method for deep learning networks on different deep learning accelerators. For example, AutoTVM will perform level optimization (layer merging, etc.) and operator-level optimization.
[0035] The operator-level automatic tuning scheme of AutoTVM mainly includes the following steps: 1, a user develops a suitable operator implementation template or selects a built-in template; 2, according to the number of modifiable parameters in the template, candidate reference values of the corresponding parameters are set, and the size of the search space (the total number of parameter value combinations that need to be searched) in subsequent searches is determined; 3, a set of parameter data is randomly generated, the parameter data is substituted into the template to generate corresponding operator code, the operator code is compiled into a binary file, the binary file is sent to a deep learning accelerator for inference execution, and the inference delay obtained is taken as a true value result and input into a machine learning model as learning data for delay prediction of the operator code; 4, the built-in search algorithm (simulated annealing algorithm) starts multiple rounds of iterative searches, in each round of iteration, random parameters are constantly generated and input into the machine learning model for delay prediction, the results are sorted, a batch of better parameters are maintained, and after the iteration ends, the better parameters maintained in this round are sent to the deep learning accelerator for inference, and the true value result obtained is fed back to the machine learning model for updating learning; 5, until a larger number of iterations set by the user, the smaller delay is the optimized parameter of the operator.
[0036] AutoTVM needs to simultaneously perform the above tuning steps on a plurality of operators for tuning a deep learning network (which may have dozens to hundreds of different operators), and thus a plurality of problems arise. For example, in the above scheme, the machine learning model needs to rely on the deep learning accelerator to obtain the inference delay data of the operator. In a project scenario using an embedded device, the machine configuration of the deep learning accelerator is low, and it takes a long time (3 hours) to complete the tuning of a small operator (optimal inference delay 200us). A network model needs to complete the tuning of dozens to hundreds of operators, and thus more deep learning accelerator resources (dedicated cluster) are needed to support the tuning of a network in a short time (30 minutes).
[0037] The network model determination method provided in the embodiments of the present application has huge cloud resources and on-demand expansion in the case of cloud service capabilities. The large-scale, high-expansion, high-availability, and flexible billing characteristics of cloud services are not possessed by the dedicated hardware cluster relied on by AutoTVM. By fully utilizing cloud computing capabilities, network tuning is no longer limited by the size and capacity of the cluster, and configuring a large-scale dedicated hardware cluster for a single network model tuning is a huge waste of resources and manpower.
[0038] It should be noted that the network model determination method provided in the embodiments of the present application can be applied to any scenario in which an operator needs to be tuned for a network model, and the embodiments of the present application do not limit the type of network model.
[0039] In the specification, a network model determination method is provided, and the specification also relates to a network model determination apparatus, a computing device, and a computer-readable storage medium, which are described in the following embodiments one by one.
[0040] Figure 1 A system architecture diagram in which a network model determination method provided by one embodiment of the specification is applied to a hardware platform is shown.
[0041] Figure 1 In the formula, A is a parameter space set by a user, B is an initial network model, C is hardware platform information, and D is an operator optimization module. First, the initial network model B is layer-optimized. Then, the parameter space A set by the user, the layer-optimized initial network model B, and the hardware platform information C are input as input data to the operator optimization module D to optimize the operators in the initial network model. In the case where the initial network model has multiple operators, the multiple operators can be optimized. The optimized operators are implemented more optimally on the hardware platform, and the operators with the optimization are used as a target network model to implement optimal deployment on the hardware platform.
[0042] In actual application, the network model input by the user is parsed to complete network layer-related optimization, such as merging multiple operators into one operator and optimizing the memory layout of the operator, to determine all operator information (input information, output information, convolution kernel information, data type, etc.) corresponding to the network; then, the search parameter space information set by the user and the deep learning accelerator (i.e., hardware platform) information are input as input to the operator optimization process for optimization; multiple operator optimizations are simultaneously performed according to the size of the deep learning accelerator cluster; after optimization of all operators is completed, efficient implementation of each operator on the deep learning accelerator is obtained; and based on the efficient implementation of each operator and the network information, the optimal deployment scheme of the network model on the deep learning accelerator is finally completed.
[0043] The network model determination method provided by the embodiment of the specification realizes automatic optimization of the operators in the initial network model through the parameter space set by the user, the hardware platform information, and the optimized initial network model, greatly accelerates the execution time of the operators, and further optimizes the network model.
[0044] Referring to Figure 2 , Figure 2 is a flowchart of a network model determination method provided by one embodiment of the specification.
[0045] Step 202: Obtain an initial network model and determine initial operators of the initial network model.
[0046] The initial network model can be understood as any operator-optimizable network model, such as a convolutional neural network model.
[0047] The initial operator can be understood as operator information corresponding to the initial network model, and can include input information, output information, convolution kernel information, data types, and the like of the operator.
[0048] In actual application, the initial network model can have multiple network layers, and one network layer can correspond to one initial operator. It should be noted that for multiple network layers with the same function, the same operator can be used for processing. After determining at least one initial operator in the initial network model, the corresponding initial operator is optimized to achieve simulation implementation of the initial operator on the hardware platform to be deployed.
[0049] Further, the initial network model can also include layer optimization processing of the network model. Specifically, the determination of the initial operator of the initial network model includes:
[0050] The initial network model is parsed to obtain the network layer of the initial network model, and the network layer is optimized.
[0051] The initial operator of the initial network model is determined based on the optimized network layer.
[0052] Specifically, the initial network model is parsed to obtain the network layer of the initial network model, and the network layer is optimized. The initial operator of the initial network model can be determined based on the optimized network layer.
[0053] In actual application, in order to obtain a better initial network model, the initial network model can be processed by layer optimization to make the initial network model processing more efficient. The operator in the initial network model can also be optimized to make the initial network model processing more efficient. The network model determination method provided by the embodiments of the present application first performs layer optimization on the initial network model, and then optimizes the operator in the initial network model, thereby obtaining an initial network model with higher data processing efficiency.
[0054] For example, the initial network model is a CNN convolutional neural network model, if the convolutional neural network model has 4 network layers, after layer optimization processing is performed on the initial network model, a convolutional neural network model with 3 network layers can be obtained, and based on the convolutional neural network with 3 network layers, 3 initial operators can be determined. It should be noted that the 3 network layers can also have network layers using the same initial operator. Based on this, the determined initial operator can be 2 or 1. In this process, the multiple network layers are de-duplicated to obtain at least one initial operator with different logical functions, so as to facilitate subsequent optimization processing of the initial operator.
[0055] The network model determination method provided by the embodiments of the present specification can improve the processing efficiency of the initial network model by performing layer optimization processing on the initial network model, and facilitate subsequent optimization processing of different initial operators.
[0056] Step 204: According to the pre-determined parameter space information and the information of the hardware platform to be deployed, the initial operator is optimized through a software model to obtain a simulation implementation of the initial operator on the hardware platform to be deployed.
[0057] The parameter space information can be understood as sample set information in the parameter space set by the user in advance.
[0058] The information of the hardware platform to be deployed can be understood as the cpu size, memory space and other hardware platform information of the hardware platform to be deployed.
[0059] In order to realize the optimization processing of the initial operator, an efficient operator can be searched based on the inference engine by determining the target parameter sample set. Specifically, the optimization of the initial operator through the software model includes:
[0060] Obtaining a parameter combination from the pre-determined parameter space information;
[0061] According to the parameter combination and the initial operator, a to-be-optimized operator is obtained;
[0062] According to the information of the hardware platform to be deployed, the to-be-optimized operator is compiled into a to-be-executed operator;
[0063] The to-be-executed operator is simulated and executed to obtain a simulation delay;
[0064] According to the parameter combination and the simulation delay, a software model is trained to obtain an optimization result of the initial operator.
[0065] The parameter combination can be understood as a parameter sample set. For example, the parameter sample set includes parameter 1, parameter 2, parameter 3, and parameter n. The number of parameters in the specific parameter space is not limited. The search space of the parameter sample set determines the size of the parameter combination that can be searched in the operator tuning process. In the actual search process, there can be dozens of parameters and dozens of parameter values, which can correspond to a large number of levels of combination. It should be noted that the parameter sample set can be set by the user or can be a system default parameter sample space.
[0066] The to-be-optimized operator can be understood as a combination of randomly selected parameters and an operator template.
[0067] The to-be-executed operator can be understood as a binary compiled operator code file on a deep learning accelerator (i.e., a deployment platform).
[0068] Specifically, the operator tuning module can obtain a parameter combination according to the pre-determined parameter space information, obtain a to-be-optimized operator based on the parameter combination and an initial operator, compile the to-be-optimized operator into a to-be-executed operator according to information of a hardware platform to be deployed, perform simulation execution on the to-be-executed operator, obtain a simulation delay, train a software model according to the parameter combination and the simulation delay, and obtain a tuning result of the initial operator.
[0069] In actual application, the parameters can be determined by randomly selecting a batch of parameter combinations, and the inference can be performed by a machine learning model to obtain a delay result corresponding to the batch of parameters. The to-be-executed operator is determined based on the batch of parameter combinations and an operator template in the initial operator. The to-be-executed operator is run on a deep learning accelerator based on attribute information of the deep learning accelerator to obtain an execution time corresponding to the to-be-executed operator. The initial network model is iteratively trained multiple times based on the execution time, so that the true value of the parameter combination can be obtained by the software model.
[0070] It should be noted that the search algorithm starts multiple rounds of iterative search until the better parameter combination no longer changes.
[0071] Further, when the operator tuning module determines that the software model is in an initialization state, the obtained parameter combination is substituted into the operator template in the initial operator to generate a to-be-optimized operator. The to-be-optimized operator is compiled based on the information of the hardware platform to be deployed to determine the to-be-executed operator on the deployment platform.
[0072] In actual application, in the case that the software model is empty, the software model does not have the function of accurately predicting the time of the execution of the operator logic, the software model can be trained, the parameter combination randomly selected in the parameter sample set can be substituted into the operator code template to obtain the corresponding operator code, and the operator code can be compiled to generate the binary file on the deep learning accelerator.
[0073] The network model determination method provided by the embodiments of the present specification can obtain the to-be-executed operator according to the parameter combination, the initial operator and the hardware platform information to be deployed, perform simulation execution on the to-be-executed operator, determine the simulation delay, and further train the software model, so as to combine the optimal parameter combination with the operator template to obtain the optimization result of the initial operator.
[0074] Further, after obtaining the compiled operator code, the operator code can be simulated and executed in the deep learning accelerator to determine the execution time corresponding to the operator code. Specifically, the to-be-executed operator is a binary file, and the simulation execution on the to-be-executed operator to obtain the simulation delay includes:
[0075] simulating the execution of the binary file to obtain a to-be-simulated machine instruction sequence;
[0076] passing the to-be-simulated machine instruction sequence through a simulation module to obtain the simulation delay.
[0077] The to-be-simulated machine instruction sequence can be understood as a simulated execution of the conditional judgment and branch jump in the static machine instruction sequence information, and the obtained instruction sequence is basically consistent with the instruction execution sequence in the real running process.
[0078] Specifically, the operator optimization module determines the initial instruction sequence corresponding to the to-be-executed operator based on the to-be-executed operator, performs execution processing on the initial instruction sequence on the deployment platform to obtain the to-be-simulated machine instruction sequence, and further passes the to-be-simulated machine instruction sequence through the simulation module to determine the simulation delay of the to-be-executed operator.
[0079] The network model determination method provided by the embodiments of the present specification can simulate the execution of the to-be-executed operator to determine the to-be-simulated machine instruction sequence, and further perform the simulation module on the deployment platform to determine the simulation delay. The to-be-executed operator can obtain the time approximately consumed by the hardware execution through the deep learning accelerator simulation software, and the resource waste can be reduced.
[0080] Specifically, the simulation execution is as follows:
[0081] extracting the corresponding static machine instruction sequence in the binary file;
[0082] The machine instructions in the static machine instruction sequence are executed one by one in simulation.
[0083] The static machine instruction sequence can be understood as a static instruction sequence of a binary file compiled according to the deep learning accelerator.
[0084] In actual application, a series of machine instructions (addition / subtraction / multiplication / division, shift, register assignment, and the like) are implemented in software simulation inside the simulation executor. By tracking the static machine instruction sequence one by one, the software simulation is executed. At the branch jump, the value obtained through the current simulation execution is used for branch expansion. For example, a loop body logic is executed for ten times. The static machine code can have a branch judgment. Whether the current iteration number is less than ten. If less than ten, jump to the first instruction of the loop body for execution. The simulation executor repeats the instructions in the loop body for ten times to obtain an instruction sequence close to the real execution.
[0085] The network model determination method provided by the embodiment of the present specification performs targeted software simulation and simulation according to the calculation characteristics, memory access characteristics, cache characteristics, concurrency characteristics, and the like of a specific deep learning accelerator. The execution flow of the hardware can be approximately simulated in software, so that the time consumed by the approximate hardware execution can be obtained.
[0086] In order to accelerate the search efficiency of efficient operator implementation, the performance of the to-be-executed operator is rated to filter the to-be-executed operator. Specifically, after the to-be-optimized operator is compiled into a to-be-executed operator according to the information of the to-be-deployed hardware platform, the method further includes:
[0087] Obtain the hardware resource usage in the compilation process.
[0088] According to the hardware resource usage, the performance of the to-be-executed operator is evaluated.
[0089] The hardware resource usage can be understood as the resource utilization of the to-be-simulated machine instruction sequence determined according to the to-be-executed operator when executed on the deployment platform.
[0090] In actual application, the operator optimization module combines the resources of the deep learning accelerator and the hardware resource occupation required by the operator implementation to obtain a rough resource maximization rating, so as to filter the to-be-executed operator and eliminate some very inefficient operator implementations, thereby accelerating the search efficiency of efficient operator implementation.
[0091] The network model determination method provided by an embodiment of the present specification rates the performance of the to-be-executed operator to filter the to-be-executed operator and accelerate the search efficiency of efficient operator implementation.
[0092] Further, the performance of the to-be-executed operator is evaluated according to the hardware resource usage, including:
[0093] If the hardware resource usage is greater than or equal to a first preset resource value, the to-be-executed operator is determined to be of a first level; or
[0094] If the hardware resource usage is less than or equal to a second preset resource value, the to-be-executed operator is determined to be of a second level; or
[0095] If the hardware resource usage is less than the first preset resource value and greater than the second preset resource value, the to-be-executed operator is determined to be of a third level.
[0096] The first level can be understood as high performance rating, the second level can be understood as low performance rating, and the third level can be understood as medium performance rating.
[0097] Specifically, the operator tuning module can determine the to-be-executed operator to be of the first level if the hardware resource usage of the to-be-executed operator on the deployment platform is greater than or equal to the first preset resource value, determine the to-be-executed operator to be of the second level if the hardware resource usage of the to-be-executed operator on the deployment platform is less than or equal to the second preset resource value, and determine the to-be-executed operator to be of the third level if the hardware resource usage of the to-be-executed operator on the deployment platform is less than the first preset resource value and greater than the second preset resource value.
[0098] In actual application, the operator tuning module combines the resources of the deep learning accelerator and the hardware resource occupancy required by the implementation of the operator to obtain a rough resource rating. If the to-be-executed operator can use the deep learning accelerator by more than 60% of the hardware resources, the performance rating is high. If the to-be-executed operator can use the deep learning accelerator by less than 20% of the hardware resources, the performance rating is low. If the to-be-executed operator can use the deep learning accelerator by 20% to 60% of the hardware resources, the performance rating is medium. The number of machine instruction sequences can also be used for judgment. If the number exceeds a certain size, the performance rating is low. If the performance rating is low, the to-be-executed operator is filtered, and the filtered to-be-executed operator is not input to the deep learning accelerator simulation software for simulation. The execution time of the parameter combination corresponding to the to-be-executed operator can be directly set to a large value of the delay.
[0099] The network model determination method provided by the embodiments of the present specification can eliminate some very low-efficiency operator implementations through the judgment of the hardware resource usage of the to-be-simulated machine instruction sequence executed by the to-be-executed operator on the deployment platform, and accelerate the search efficiency of high-efficiency operator implementations.
[0100] Further, another embodiment of the present specification, in order to accelerate the search efficiency of efficient operator implementation, the performance of the to-be-executed operator can be evaluated based on the number of to-be-simulated machine instructions of the to-be-executed operator; specifically, the method further comprises:
[0101] According to the number of to-be-simulated machine instructions, the performance of the to-be-executed operator is evaluated.
[0102] In practical applications, based on the number of to-be-simulated machine instructions of the to-be-executed operator, the execution time of the to-be-executed operator can be determined to evaluate the performance of the to-be-executed operator.
[0103] The network model determination method provided by an embodiment of the present specification filters the to-be-executed operator by evaluating the performance of the to-be-executed operator, thereby accelerating the search efficiency of efficient operator implementation.
[0104] Further, the performance of the to-be-executed operator is evaluated according to the number of to-be-simulated machine instructions, comprising:
[0105] If the number of to-be-simulated machine instructions is greater than or equal to a first preset number, the to-be-executed operator is determined to be a first level;
[0106] If the number of to-be-simulated machine instructions is less than or equal to a second preset number, the to-be-executed operator is determined to be a second level;
[0107] If the number of to-be-simulated machine instructions is less than the first preset number and greater than the second preset number, the to-be-executed operator is determined to be a third level.
[0108] Specifically, the operator optimization module can determine the to-be-executed operator to be a first level when it is determined that the number of to-be-simulated machine instructions of the to-be-executed operator on the deployment platform is greater than or equal to a first preset number, determine the to-be-executed operator to be a second level when it is determined that the number of to-be-simulated machine instructions of the to-be-executed operator on the deployment platform is less than a second preset number, and determine the to-be-executed operator to be a third level when it is determined that the number of to-be-simulated machine instructions of the to-be-executed operator on the deployment platform is less than the first preset number and greater than the second preset number.
[0109] It should be noted that the conditions for inputting to-be-executed operators of different levels to the deep learning accelerator simulation software for simulation are different, and the embodiments of the present specification do not make too many limitations.
[0110] The network model determination method provided by the embodiments of the present specification determines the performance level of the to-be-executed operator by judging the number of to-be-simulated machine instructions executed by the to-be-executed operator, so that some operators with very low efficiency can be removed according to the performance level in the subsequent process, thereby accelerating the search efficiency of efficient operator implementation.
[0111] Based on the filtering of the to-be-executed operator with a low performance rating, the execution time of the to-be-executed operator can be accurately determined. Specifically, if the performance evaluation of the to-be-executed operator is the third level, the to-be-executed operator is abandoned, and a parameter combination is obtained from the pre-determined parameter space information again.
[0112] In actual application, in a case where it is determined that the performance evaluation of the to-be-executed operator is low, the to-be-executed operator is filtered, and the to-be-executed operator is not input to the deep learning accelerator simulation software for simulation, and a parameter combination is obtained from the pre-determined parameter space information again.
[0113] Specifically, in a case where it is determined that the to-be-executed operator is the third level, execution component information of the to-be-executed operator on the deployment platform is obtained, the to-be-executed operator is run based on the execution component information, and the execution time of the to-be-executed operator is determined.
[0114] The execution component information of the deployment platform can be understood as several basic components of the deep learning accelerator, and can include a calculation unit (integer / single precision / double precision / complex), a multi-level cache, a bus, a main memory, each component has its own different working principle and performance parameters, for example, there are 128 calculation units, two levels of cache, a first level cache of 64 KB, a second level cache of 128 KB, a bus bandwidth of 100 GB / s, and a main memory of 16 G.
[0115] Further, after filtering based on the performance analysis of the to-be-executed operator, the to-be-executed operator can obtain the time approximately consumed by hardware execution through the deep learning accelerator simulation software. The deep learning accelerator simulation software performs targeted software simulation and modeling according to the calculation characteristics, memory characteristics, cache characteristics, and concurrency characteristics of a specific deep learning accelerator, can have a approximate software simulation of the execution flow of the hardware, and thus can obtain the time approximately consumed by hardware execution.
[0116] The network model determination method provided by the embodiments of the present specification realizes the functions of these components in a software manner by referring to the hardware design of a specific deep learning accelerator internally, and reasonably connects these component functions by imitating the hardware pipeline design, thereby completing the simulation execution of machine instructions.
[0117] Step 206: optimizing the initial network model by using simulation implementation of the initial operator on the to-be-deployed hardware platform to obtain a deployment model of the initial network model on the to-be-deployed hardware platform.
[0118] In actual application, the initial network model is trained through simulation implementation of the initial operator on the hardware platform to be deployed, and after multiple iterations, the initial network model is applied while being trained to complete optimization of the operator, and based on optimized operator efficient implementation and network information, a better deployment scheme of the network model on the deep learning accelerator is finally realized.
[0119] The network model determination method provided by the embodiments of the present specification realizes that the operator optimization process is greatly accelerated by no longer relying on the deep learning accelerator to perform real operator code execution to obtain operator execution time, but obtaining operator execution time through software simulation, and realizes large-scale, high-expansion, low-cost and efficient deep learning network optimization.
[0120] The following describes the embodiments of the present specification in conjunction with the accompanying Figure 3 , Figure 3 An initial operator optimization process flowchart of a data processing method provided by one embodiment of the present specification is shown, and specifically includes the following steps.
[0121] It should be noted that the initial operator of the initial network model can also be optimized according to the parameter space set by the user, and the execution time of the initial operator that can be predicted on the hardware platform is further judged to realize optimization of the to-be-executed operator; the network model determination method proposed in the present embodiment is a training process of the prediction model in the search module, and the purpose is to realize an optimized prediction model and further optimize the initial operator.
[0122] In addition, the initial operator can be optimized by the search module, the compilation module and the execution module together.
[0123] Step 302: The search module receives the parameter space set by the user.
[0124] Specifically, the parameter search space set by the user determines the size of the parameter combination that can be searched in the operator optimization process. For example, there are three parameters, and each parameter has four optional values, so there are 64 parameter combinations. In the actual search process, there can be dozens of parameters, and there can be dozens of parameter values, which can correspond to a large number of levels of combination.
[0125] Step 304: The search module determines whether the current iteration number exceeds the preset coefficient threshold, if yes, step 330 is performed, and if not, step 306 is performed.
[0126] Step 306: The search module randomly selects a group of parameters in the parameter space set by the user in the case where the prediction model is in the initialization state.
[0127] Specifically, a batch of parameter combinations are randomly selected, and the inference is performed by the machine learning model to obtain the delay results corresponding to the batch of parameters.
[0128] Step 308: The compilation module receives the set of parameters sent by the search module and substitutes the set of parameters into the operator code template.
[0129] Step 310: The compilation module generates the operator code according to the set of parameters and the operator code template.
[0130] Step 312: The compilation module compiles the operator code to obtain the binary compiled operator code.
[0131] Step 314: The execution module receives the compiled operator code sent by the compilation module and analyzes the compiled operator code through the performance analyzer to obtain the performance level of the compiled operator code.
[0132] Specifically, the hardware resource usage and binary file related information during the compilation process are extracted and given to the performance analyzer for analysis to judge the basic performance rating (high, medium, and low).
[0133] Step 316: The execution module filters the performance rating of the compiled operator code. If the performance level is low, step 318 is performed, and if the performance level is medium or high, step 320 is performed.
[0134] Specifically, if the performance rating is low, the filtering is performed and the upper limit value of the delay is directly returned.
[0135] Step 318: The execution module sets the execution time of the compiled operator code with a low performance level to a large value and performs step 324.
[0136] Step 320: The simulation executor of the execution module extracts the static machine instruction sequence of the compiled operator code.
[0137] Step 322: The deep learning accelerator emulation software of the execution module can approximately simulate the execution flow of the hardware and obtain the approximate hardware execution consumption time for the static machine instruction sequence.
[0138] Step 324: The execution module returns the execution time of the compiled operator code and updates the prediction model of the search module.
[0139] Step 326: The prediction model of the search module is trained according to the parameters and the returned execution time.
[0140] Specifically, the batch of parameter combinations and the corresponding running delay are input as true value data to the machine learning model for model training.
[0141] Step 328: The search module determines the parameter set with a smaller execution time and continues to perform step 304 for multi-round iterative training.
[0142] Specifically, the current round of iteration ends, and the next round of iteration begins.
[0143] Step 330: The search module outputs the target parameter set when it is determined that the number of iterations exceeds the preset coefficient threshold.
[0144] The network model determination method provided by the embodiments of the present specification uses a pure software simulation simulation method to replace real execution on a deep learning accelerator hardware, obtains time consumed by hardware execution, and thus designs a complete set of network automatic tuning scheme that can be deployed on a cloud server in a large scale and flexibly expanded.
[0145] Referring to Figure 4 , Figure 4 is a distributed deployment architecture diagram of single operator tuning in a data processing system provided by an embodiment of the present specification.
[0146] Figure 4 The first platform is associated with at least one second platform, and one first platform can correspond to at least one second platform. Single operator automatic tuning mainly includes three modules: a search module, a compilation module, and an execution module. These modules are run on multiple machines in a distributed deployment manner. For example, the search module is mainly run on the first platform machine, and the compilation module and the execution module are run on multiple second platform machines. The execution time of the operator is reported to the first platform machine by the second platform machine, so as to update the machine learning model. The compilation module and the execution module are deployed to multiple machines, which can utilize the resources of multiple machines to perform calculation at the same time, thereby improving the efficiency of tuning.
[0147] Referring to Figure 5 , Figure 5 is a distributed deployment architecture diagram of multiple operator tuning in a data processing system provided by an embodiment of the present specification.
[0148] Figure 5The left side is the operator 1 tuning architecture diagram, and the right side is the operator 2 tuning architecture diagram. In the deep learning network tuning, multiple operators need to be tuned at the same time. Here, the single-operator tuning deployment mode is still followed. Each operator selects a first platform machine and a plurality of second platform machines from the cluster to form a temporary cluster. Until the operator tuning is completed, the occupied first platform and second platform machine resources are released for use by the next batch of operator tuning. The number of large operators that can be supported at the same time is obtained from the number of machines in the entire cluster and the number of machines required for single-operator tuning. The larger the number of machines in the cluster, the more large operators that can be supported, and the shorter the time for network tuning. In actual application, the initial operator tuning task can be divided and distributedly deployed to the cluster for tuning processing to save the initial operator tuning time.
[0149] It should be noted that the network model determination method provided in the specification is based on the software simulation deep learning operator tuning scheme, which can fully utilize the provided cloud service to realize large-scale, high-expansion, low-cost and efficient deep learning network tuning. The cloud resources can be used at any time, and the capacity can be easily expanded. In the scenario where the deep learning network operator is relatively small, it needs to be completed within 1 hour, and only 10 machines may be needed. In the scenario where the deep learning network is large, it needs to be completed within 1 hour, and 100 machines may be needed. The network model determination method provided in the specification can quickly expand the cloud machines according to the number of operators. If it needs to be completed within 30 minutes, 200 machines can be expanded to ensure the timeliness of user demand. In AutoTVM, the deep learning accelerator cluster depends on the lack of cloud service flexibility.
[0150] In summary, the network model determination method provided in the specification tunes multiple initial operators of the initial network model through a distributed deployment scheme, which not only accelerates the search efficiency of high-efficiency operators, but also proposes a complete set of network automatic tuning methods that can be deployed and flexibly expanded on cloud services based on the above pure software simulation method, greatly accelerating the operator search time.
[0151] Corresponding to the above method embodiments, the specification also provides network model determination device embodiments, Figure 6 A structure diagram of a network model determination device provided by an embodiment of the specification is shown. As shown in the figure, Figure 6 The device includes:
[0152] The obtaining module 602 is configured to obtain an initial network model and determine initial operators of the initial network model;
[0153] The tuning module 604 is configured to tune the initial operator by a software model according to the predetermined parameter space information and information of the hardware platform to be deployed, to obtain a simulation implementation of the initial operator on the hardware platform to be deployed.
[0154] The optimization module 606 is configured to optimize the initial network model by using the simulation implementation of the initial operator on the hardware platform to be deployed, to obtain a deployment model of the initial network model on the hardware platform to be deployed.
[0155] Optionally, the tuning module 604 is further configured to:
[0156] The to-be-optimized module is configured to obtain a parameter combination from the predetermined parameter space information, and obtain a to-be-optimized operator according to the parameter combination and the initial operator.
[0157] The compiling module is configured to compile the to-be-optimized operator into a to-be-executed operator according to the information of the hardware platform to be deployed.
[0158] The simulation module is configured to simulate execution of the to-be-executed operator to obtain a simulation delay, and train a software model according to the parameter combination and the simulation delay, to obtain a tuning result of the initial operator.
[0159] Optionally, the simulation module is further configured to:
[0160] simulate execution of the binary file to obtain a to-be-simulated machine instruction sequence;
[0161] obtain a simulation delay by the simulation module from the to-be-simulated machine instruction sequence.
[0162] Optionally, the simulation module is further configured to:
[0163] extract a corresponding static machine instruction sequence from the binary file;
[0164] simulate execution of the machine instructions in the static machine instruction sequence in a piece-by-piece manner.
[0165] Optionally, the apparatus further includes:
[0166] The first evaluation module is configured to obtain a hardware resource usage in the compiling process.
[0167] evaluate performance of the to-be-executed operator according to the hardware resource usage.
[0168] Optionally, the first evaluation module is further configured to:
[0169] If the hardware resource usage is greater than or equal to a first preset resource value, the to-be-executed operator is determined to be a first level; or
[0170] If the hardware resource usage is less than or equal to a second preset resource value, the to-be-executed operator is determined to be a second level; or
[0171] If the hardware resource usage is less than the first preset resource value and greater than the second preset resource value, the to-be-executed operator is determined to be a third level.
[0172] Optionally, the apparatus further comprises:
[0173] The second evaluation module is configured to evaluate the performance of the to-be-executed operator according to the number of machine instructions to be simulated.
[0174] Optionally, the second evaluation module is further configured to:
[0175] If the number of machine instructions to be simulated is greater than or equal to a first preset number, the to-be-executed operator is determined to be a first level;
[0176] If the number of machine instructions to be simulated is less than or equal to a second preset number, the to-be-executed operator is determined to be a second level;
[0177] If the number of machine instructions to be simulated is less than the first preset number and greater than the second preset number, the to-be-executed operator is determined to be a third level.
[0178] Optionally, the apparatus further comprises:
[0179] If the performance evaluation of the to-be-executed operator is a third level, the to-be-executed operator is abandoned, and a parameter combination is obtained from the pre-determined parameter space information again.
[0180] Optionally, the obtaining module 602 is further configured to:
[0181] The initial network model is parsed to obtain a network layer of the initial network model, and the network layer is optimized;
[0182] The initial operator of the initial network model is determined based on the optimized network layer.
[0183] The network model determination apparatus provided by the embodiments of the present specification determines the simulation implementation of the initial operator in the initial network model on a hardware platform to be deployed by automatically tuning the initial operator in the initial operator, and realizes the tuning of the initial network model, which can not only improve the efficiency of operator tuning, but also realize the optimal deployment of the target operator in the hardware platform.
[0184] The network model determination apparatus provided by the embodiments of the present specification can also be applied to the field of automatic driving of vehicles in actual application. Of course, the algorithm modules (i.e., the obtaining module, the tuning module, and the optimization module) will be different according to the types of the automatic driving vehicles. For example, different algorithm modules will be involved for logistics vehicles, public service vehicles, medical service vehicles, and terminal service vehicles. The algorithm modules will be illustrated below for the four types of automatic driving vehicles respectively.
[0185] Among them, the logistics vehicle refers to a vehicle used in a logistics scene, which can be a logistics vehicle with an automatic sorting function, a logistics vehicle with a cold storage function, or a logistics vehicle with a measurement function. These logistics vehicles will involve different algorithm modules.
[0186] For example, for a logistics vehicle, an automatic sorting device can be provided, which can automatically take out, carry, sort, and store goods after the logistics vehicle arrives at the destination. This involves an algorithm module for goods sorting, which mainly implements logic control for taking out, carrying, sorting, and storing goods.
[0187] For example, for a cold chain logistics scene, the logistics vehicle can also be provided with a cold storage device, which can achieve cold storage or preservation of fruits, vegetables, aquatic products, frozen foods, and other perishable foods during transportation, so that they are in a suitable temperature environment, solving the problem of long-distance transportation of perishable foods. This involves an algorithm module for cold storage and preservation control, which is mainly used to dynamically and adaptively calculate the suitable temperature for cold storage or preservation according to the information of food (or goods) properties, perishability, transportation time, current season, climate, etc., and automatically adjust the cold storage and preservation device according to the suitable temperature. In this way, the transportation personnel do not need to manually adjust the temperature when transporting different foods or goods, which liberates the transportation personnel from tedious temperature regulation and improves the efficiency of cold storage and preservation transportation.
[0188] For example, in most logistics scenes, the charges are based on the volume and / or weight of the package. The number of logistics packages is very large, and simply relying on the courier to measure the volume and / or weight of the package is very inefficient and has high labor costs. Therefore, in some logistics vehicles, a measuring device is added to automatically measure the volume and / or weight of the logistics package and calculate the cost of the logistics package. This involves an algorithm module for measuring logistics packages, which is mainly used to identify the type of logistics package, determine the measurement method of the logistics package, such as volume measurement, weight measurement, or combined volume and weight measurement, and complete the volume and / or weight measurement according to the determined measurement method, and complete the cost calculation according to the measurement result.
[0189] Among them, the public service vehicle refers to a vehicle that provides a certain public service, which can be a fire truck, a deicing vehicle, a water truck, a snowplow, a garbage disposal vehicle, a traffic command vehicle, etc. These public service vehicles will involve different algorithm modules.
[0190] For example, for an automatic driving fire truck, its main task is to carry out reasonable fire extinguishing tasks for fire scenes, which involves an algorithm module for fire extinguishing tasks, which at least needs to realize the identification of fire conditions, the planning of fire extinguishing schemes, and the automatic control of fire extinguishing devices, etc.
[0191] For example, for a deicing vehicle, its main task is to remove ice and snow on the road surface, which involves an algorithm module for deicing, which at least needs to realize the identification of ice and snow conditions on the road surface, the formulation of deicing schemes according to the ice and snow conditions, such as which road sections need to be deiced, which road sections do not need to be deiced, whether to use salt, the amount of salt, etc., and the automatic control of deicing devices under the condition of determining the deicing scheme, etc.
[0192] Among them, the medical service vehicle refers to an automatic driving vehicle that can provide one or more medical services. This vehicle can provide disinfection, temperature measurement, medicine dispensing, isolation, etc. Medical services involve algorithm modules for providing various self-service medical services. These algorithm modules mainly realize the identification of disinfection needs and the control of disinfection devices to disinfect patients, or the identification of patient positions, the control of temperature measurement devices to automatically approach the positions such as the forehead of patients to measure their temperature, or the judgment of diseases, the prescription according to the judgment results, the identification of medicines / medicine containers, and the control of medicine grabbing manipulators to grab medicines for patients according to the prescription, etc.
[0193] Among them, the terminal service vehicle refers to a self-service automatic driving vehicle that can replace some terminal devices to provide certain convenient services to users, such as printing, attendance, scanning, unlocking, payment, retail, etc.
[0194] For example, in some application scenarios, users often need to go to a specific location to print or scan documents, which is time-consuming and laborious. Therefore, a terminal service vehicle that can provide printing / scanning services for users appears. These service vehicles can interconnect with user terminal devices, and users can issue printing instructions through terminal devices. The service vehicles respond to the printing instructions, automatically print the documents required by the users, and can automatically deliver the printed documents to the user location, so that users do not need to queue at the printer and can greatly improve the printing efficiency. Alternatively, the service vehicles can move to the user location in response to the scanning instructions issued by the user through the terminal device, and the user can place the document to be scanned on the scanning tool of the service vehicle to complete the scanning, without the need to queue at the printer / scanner, saving time and effort. This involves an algorithm module for providing printing / scanning services, which at least needs to identify the interconnection with the user terminal device, the response to the printing / scanning instruction, the positioning of the user location, and the travel control, etc.
[0195] For another example, with the development of new retail business, more and more e-commerce companies use self-service vending machines to deliver goods to major office buildings and public areas, but these self-service vending machines are placed in fixed positions and cannot be moved. Users need to be close to the self-service vending machine to purchase the required goods, which is still not very convenient. Therefore, self-driving vehicles that can provide retail services appear. These service vehicles can carry goods and automatically move, and can provide corresponding self-service shopping APPs or shopping portals. Users can use terminal devices such as mobile phones to place orders through the APPs or shopping portals to the self-driving vehicles that provide retail services. The order includes the name and quantity of the goods to be purchased and the user location. After receiving the order request, the vehicle can determine whether the remaining goods have the goods to be purchased by the user and whether the quantity is sufficient. If the goods to be purchased by the user are available and the quantity is sufficient, the vehicle can automatically move to the user location with the goods and provide the goods to the user, further improving the convenience of user shopping, saving user time, and allowing users to use their time for more important things. This involves algorithm modules for providing retail services, which mainly implement the logic of responding to user order requests, order processing, goods information maintenance, user location positioning, and payment management.
[0196] The above is a schematic scheme of the network model determination apparatus of the embodiment. It should be noted that the technical scheme of the network model determination apparatus belongs to the same concept as the technical scheme of the network model determination method described above. The technical scheme of the network model determination apparatus that is not described in detail can be referred to the description of the technical scheme of the network model determination method.
[0197] Figure 7A structural block diagram of a computing device 700 according to one embodiment of the present specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected with the memory 710 through a bus 730, and a database 750 is used to save data.
[0198] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include the 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 740 can include one or more of any type of network interface (e.g., network interface card (NIC)) such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide 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, either wired or wireless.
[0199] In one embodiment of the present specification, the above-mentioned components of the computing device 700 and other components not shown in the above-mentioned components can be connected with each other, for example, through a bus. It should be understood that, Figure 7 Figure 7 The structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Other components can be added or replaced as needed by those skilled in the art.
[0200] The computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. The computing device 700 can also be a mobile or stationary server.
[0201] The processor 720 is configured to execute computer-executable instructions, and the steps of the network model determination method are implemented when the processor 720 executes the computer-executable instructions.
[0202] The above is a schematic scheme of a computing device according to the present embodiment. It should be noted that the technical scheme of the computing device belongs to the same concept as the technical scheme of the network model determination method described above, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the network model determination method.
[0203] The embodiment of the present specification also provides a computer readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the network model determination method.
[0204] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the network model determination method described above belong to the same concept, and the details of the technical scheme of the storage medium which are not described in detail can be referred to the description of the technical scheme of the network model determination method.
[0205] The specific embodiments of the present specification are described above. 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 a different order and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown or sequential order in order to achieve the desired results. In some implementations, multitasking and parallel processing can be advantageous.
[0206] The computer instructions include computer program codes which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying the computer program codes, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the contents included in the computer readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0207] It should be noted that for the foregoing method embodiments, in order to facilitate description, they are all described as a combination of a series of actions, but those skilled in the art should know that the embodiments of the present specification are not limited to the order of the actions described, because according to the embodiments of the present specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily all necessary for the embodiments of the present specification.
[0208] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0209] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. Alternative embodiments do not describe all the details and limit the present application to the specific embodiments described. Obviously, many modifications and variations of the embodiments of the present specification can be made in light of the content of the present specification. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and utilize the present specification. The present specification is limited only by the claims and their full scope and equivalents.
Claims
1. A method for determining a network model, comprising: obtaining an initial network model and determining an initial operator of the initial network model; tuning the initial operator by a software model according to pre-determined parameter space information and information of a hardware platform to be deployed, to obtain a simulation implementation of the initial operator on the hardware platform to be deployed, wherein the tuning of the initial operator by the software model comprises: obtaining a parameter combination from the pre-determined parameter space information; obtaining an optimized operator according to the parameter combination and the initial operator; compiling the optimized operator into an executable operator according to the information of the hardware platform to be deployed; simulating and executing the executable operator to obtain a simulation delay; training the software model according to the parameter combination and the simulation delay, to obtain a tuning result of the initial operator; and optimizing the initial network model by the simulation implementation of the initial operator on the hardware platform to be deployed, to obtain a deployment model of the initial network model on the hardware platform to be deployed. 2.The method of claim 1, wherein the executable operator is a binary file, and the simulating and executing of the executable operator to obtain a simulation delay comprises: simulating the binary file to obtain a sequence of machine instructions to be simulated; and obtaining the simulation delay by a simulation module from the sequence of machine instructions to be simulated. 3.The method of claim 2, wherein the simulating of the binary file comprises: extracting a corresponding sequence of static machine instructions from the binary file; and simulating and executing the sequence of static machine instructions one by one. 4.The method of claim 2, further comprising: obtaining a hardware resource usage during the compiling; and evaluating a performance of the executable operator according to the hardware resource usage. 5.The method of claim 4, wherein the evaluating of the performance of the executable operator according to the hardware resource usage comprises: determining the executable operator as a first level if the hardware resource usage is greater than or equal to a first preset resource value; or determining the executable operator as a second level if the hardware resource usage is less than or equal to a second preset resource value; or determining the executable operator as a third level if the hardware resource usage is less than the first preset resource value and greater than the second preset resource value. 6.The method of claim 4, further comprising: evaluating the performance of the executable operator according to a number of the sequence of machine instructions to be simulated. 7.The method of claim 6, wherein the evaluating of the performance of the executable operator according to the number of the sequence of machine instructions to be simulated comprises: determining the executable operator as the first level if the number of the sequence of machine instructions to be simulated is greater than or equal to a first preset number; determining the executable operator as the second level if the number of the sequence of machine instructions to be simulated is less than or equal to a second preset number. If the number of machine instructions to be emulated is less than the first preset number and greater than the second preset number, the to-be-executed operator is determined as a third level.
8. The method of claim 5 or 7, if the performance evaluation of the to-be-executed operator is the third level, discarding the to-be-executed operator and re-obtaining a parameter combination from the pre-determined parameter space information.
9. The method of claim 1, wherein the determining the initial operator of the initial network model comprises: parsing the initial network model to obtain a network layer of the initial network model, and optimizing the network layer; determining the initial operator of the initial network model based on the optimized network layer.
10. A network model determination apparatus, comprising: an obtaining module configured to obtain an initial network model and determine an initial operator of the initial network model; a tuning module configured to tune the initial operator by a software model according to pre-determined parameter space information and information of a hardware platform to be deployed, to obtain an emulation implementation of the initial operator on the hardware platform to be deployed; the tuning module is further configured to: a to-be-optimized module configured to obtain a parameter combination from the pre-determined parameter space information, and obtain a to-be-optimized operator according to the parameter combination and the initial operator; a compiling module configured to compile the to-be-optimized operator into a to-be-executed operator according to the information of the hardware platform to be deployed; an emulation module configured to perform emulation execution on the to-be-executed operator to obtain an emulation delay; and train a software model according to the parameter combination and the emulation delay to obtain a tuning result of the initial operator; an optimization module configured to optimize the initial network model by using the emulation implementation of the initial operator on the hardware platform to be deployed, to obtain a deployment model of the initial network model on the hardware platform to be deployed.
11. A computing device, comprising: a memory and a processor; the memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, wherein the processor executes the computer executable instructions to implement steps of the network model determination method of any one of claims 1-9.
12. A computer readable storage medium, comprising computer instructions, wherein the computer instructions are executed by a processor to implement steps of the network model determination method of any one of claims 1-9.
Citation Information
Patent Citations
Neural network model deployment method and device, electronic equipment and storage medium
CN111222637A
Deployment method and device of deep learning network and terminal equipment
CN111290762A