Search

CN-122019015-A - Algorithm running method, device, apparatus, medium and product

CN122019015ACN 122019015 ACN122019015 ACN 122019015ACN-122019015-A

Abstract

The invention discloses an algorithm operation method, device, equipment, medium and product, wherein the method comprises the steps of responding to operation triggering of a first algorithm model, obtaining model input data, analyzing a model structure, obtaining a sub-algorithm module and a model type in the first algorithm model, obtaining a first operator interface based on a mapping relation between a calculation mode and an operator interface, wherein the first operator interface corresponds to the first calculation mode of the sub-algorithm module, obtaining a first operator list through the first operator interface, determining at least one first operator in the first operator list, determining the first operator based on operation environment information of the first algorithm model, a model input shape and a model type corresponding to the model input data, and obtaining and operating the first operator to operate the first algorithm model. The technical scheme of the embodiment of the invention can provide a unified operator interface, automatically distribute operators matched with the operation environment, and reduce the operator use threshold, thereby improving the algorithm operation efficiency.

Inventors

  • YANG YUANHANG
  • SHU JUNHUA
  • WAN JIACHENG
  • CHEN ZHEN
  • ZHANG KE
  • XING ZHAOLONG

Assignees

  • 北京沃东天骏信息技术有限公司

Dates

Publication Date
20260512
Application Date
20260126

Claims (11)

  1. 1. An algorithm operating method, comprising: Responding to operation trigger of a first algorithm model, obtaining model input data, and analyzing a model structure of the first algorithm model to obtain a sub-algorithm module and a model type in the first algorithm model; Obtaining a first operator interface based on a mapping relation between a calculation mode and the operator interface, wherein the first operator interface corresponds to a first calculation mode of the sub-algorithm module; The method comprises the steps of obtaining a first operator list through a first operator interface, and determining at least one first operator in the first operator list, wherein the first operator is a preconfigured operator capable of realizing the algorithm function of a sub-algorithm module, and is determined based on the running environment information of a first algorithm model, the model input shape corresponding to model input data and the model type; and acquiring the first operator and running the first operator to run the first algorithm model.
  2. 2. The method of claim 1, wherein the determining at least one first operator in the first operator list comprises: Determining a first operator set matched with the running environment indicated by the running environment information in the first operator list; determining at least one first operator in the first set of operators that matches the model type and module input shape; wherein the module input shape is determined based on the model input shape and the sub-algorithm module.
  3. 3. The method as recited in claim 2, further comprising: responding to the obtained operator realization setting information and/or model parameter configuration information; And determining at least one first operator in the first operator list based on at least one of the operator implementation setting information and the model parameter configuration information, the model type and a module input shape match.
  4. 4. The method of claim 1, wherein the sub-algorithm module is a complete model algorithm module, a plurality of sub-algorithm modules or operator modules that make up a complete model.
  5. 5. The method of claim 1, further comprising, prior to the first algorithm model run trigger: responding to the configuration operation of the sub-algorithm modules, and obtaining the execution logic and the data transfer relation among more than one sub-algorithm module; And obtaining a model structure of the first algorithm model based on the execution logic and the data flow relation.
  6. 6. The method as recited in claim 1, further comprising: At least one operator data packet is imported in response to operator importing operation, and different operator data packets are applicable to different operator running environment information; and carrying out classified management on operators in the operator data packet based on the operator calculation mode to obtain a plurality of operator lists.
  7. 7. The method of any of claims 1-6, wherein the first algorithm model is a neural network module based on an attention mechanism, comprising part or all of an embedding sub-module, a position encoding sub-module, an input normalization sub-module, an attention sub-module, a residual connection sub-module, a post normalization sub-module, a feed forward neural network sub-module, a mask multi-head attention sub-module, an encoder-decoder attention sub-module, a linear mapping sub-module, an output processing class sub-module, a gradient clipping sub-module, and a tag smoothing sub-module.
  8. 8. An algorithm running apparatus, comprising: The first module is used for responding to the operation trigger of the first algorithm model, obtaining model input data, analyzing the model structure of the first algorithm model and obtaining a sub-algorithm module and a model type in the first algorithm model; The second module is used for obtaining a first operator interface based on the mapping relation between the calculation mode and the operator interface, and the first operator interface corresponds to the first calculation mode of the sub-algorithm module; the third module is used for obtaining a first operator list through the first operator interface and determining at least one first operator in the first operator list, wherein the first operator is an operator which is preconfigured to realize the algorithm function of the sub-algorithm module, and is determined based on the running environment information of the first algorithm model, the model input shape corresponding to the model input data and the model type; And a fourth module, configured to acquire the first operator and run the first operator to run the first algorithm model.
  9. 9. An electronic device, the electronic device comprising: one or more processors; storage means for storing one or more programs, When executed by the one or more processors, causes the one or more processors to implement the algorithm running method of any one of claims 1-8.
  10. 10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the algorithm running method of any one of claims 1-8.
  11. 11. A computer program product comprising a computer program which, when executed by a processor, implements the algorithm running method of any one of claims 1-8.

Description

Algorithm running method, device, apparatus, medium and product Technical Field The present invention relates to the field of computer technologies, and in particular, to an algorithm running method, apparatus, device, medium, and product. Background Operators are direct bridges connecting upper layer algorithms with the underlying hardware, and their execution efficiency is the final bottleneck determining overall performance. Operator optimization is mainly spread around three targets of computational parallelism, memory access efficiency and instruction throughput. However, in the process of performing algorithm optimization, at least the following technical problems are found in the prior art that operators exist as independent code units and are called through a hard-coded lookup table mechanism. This scheduling method requires the user to manually specify operator names in advance. Meanwhile, the operator interface is designed and solidified, so that reusability and usability under different training and reasoning scenes are limited, and the use threshold of a developer is high. Disclosure of Invention The embodiment of the invention provides an algorithm running method, an algorithm running device, an algorithm running equipment, an algorithm running medium and an algorithm running product, which can provide a unified operator interface, automatically distribute operators matched with an operation environment, and reduce the operator use threshold, thereby improving the algorithm running efficiency. In a first aspect, an embodiment of the present invention provides an algorithm running method, where the method includes: Responding to operation trigger of a first algorithm model, obtaining model input data, and analyzing a model structure of the first algorithm model to obtain a sub-algorithm module and a model type in the first algorithm model; Obtaining a first operator interface based on a mapping relation between a calculation mode and the operator interface, wherein the first operator interface corresponds to a first calculation mode of the sub-algorithm module; The method comprises the steps of obtaining a first operator list through a first operator interface, and determining at least one first operator in the first operator list, wherein the first operator is a preconfigured operator capable of realizing the algorithm function of a sub-algorithm module, and is determined based on the running environment information of a first algorithm model, the model input shape corresponding to model input data and the model type; and acquiring the first operator and running the first operator to run the first algorithm model. In a second aspect, an embodiment of the present invention further provides an algorithm running apparatus, where the apparatus includes: The first module is used for responding to the operation trigger of the first algorithm model, obtaining model input data, analyzing the model structure of the first algorithm model and obtaining a sub-algorithm module and a model type in the first algorithm model; The second module is used for obtaining a first operator interface based on the mapping relation between the calculation mode and the operator interface, and the first operator interface corresponds to the first calculation mode of the sub-algorithm module; the third module is used for obtaining a first operator list through the first operator interface and determining at least one first operator in the first operator list, wherein the first operator is an operator which is preconfigured to realize the algorithm function of the sub-algorithm module, and is determined based on the running environment information of the first algorithm model, the model input shape corresponding to the model input data and the model type; And a fourth module, configured to acquire the first operator and run the first operator to run the first algorithm model. In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the algorithm running method according to any one of the embodiments of the present invention when the processor executes the program. In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an algorithm running method according to any of the embodiments of the present invention. In a fifth aspect, embodiments of the present invention also provide a computer program product comprising a computer program which, when executed by a processor, implements an algorithm running method according to any of the embodiments of the present invention. In the embodiment of the invention, model input data are obtained by responding to operation triggering of a first algorithm model, a mod