WO2020056647A1 - 一种ai模型的开发方法及装置 - Google Patents

一种ai模型的开发方法及装置 Download PDF

Info

Publication number
WO2020056647A1
WO2020056647A1 PCT/CN2018/106566 CN2018106566W WO2020056647A1 WO 2020056647 A1 WO2020056647 A1 WO 2020056647A1 CN 2018106566 W CN2018106566 W CN 2018106566W WO 2020056647 A1 WO2020056647 A1 WO 2020056647A1
Authority
WO
WIPO (PCT)
Prior art keywords
model
candidate
platform
strategy
parameter
Prior art date
Application number
PCT/CN2018/106566
Other languages
English (en)
French (fr)
Inventor
于超
谢淼
许翔
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201880074664.9A priority Critical patent/CN111357014B/zh
Priority to PCT/CN2018/106566 priority patent/WO2020056647A1/zh
Priority to EP18933825.4A priority patent/EP3836021B1/en
Priority to US17/276,949 priority patent/US20220036236A1/en
Publication of WO2020056647A1 publication Critical patent/WO2020056647A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/10Interfaces, programming languages or software development kits, e.g. for simulating neural networks
    • G06N3/105Shells for specifying net layout
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • the embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular, to a method and device for developing an AI model.
  • AI artificial intelligence
  • AI is an indispensable technology for mobile terminal to realize artificial intelligence.
  • the cloud can train multiple AI models for different business needs.
  • the mobile terminal can transmit the data to be processed to the AI service interface of the cloud through the network.
  • the cloud processes the data to be processed through the corresponding AI model, and then transmits the processing results to the mobile terminal through the AI service interface.
  • the end-to-side AI model refers to configuring an AI model in a mobile terminal, and the mobile terminal processes the data to be processed through the AI model.
  • an AI-specific processing chip such as a neural network processing unit (NPU) chip, and an intelligent video processing unit (VPU) chip, may be mounted in a mobile terminal.
  • NPU neural network processing unit
  • VPU intelligent video processing unit
  • an AI model in the cloud can be configured in a mobile terminal.
  • AI models in the cloud usually take up a lot of memory space.
  • the mobile terminal needs to have strong computing ability to obtain the processing result in a short time through the AI model.
  • the AI model cannot be widely deployed in mobile terminals.
  • different mobile terminal systems are different, and the running environment of the AI model that they can provide is different, and different mobile terminals have different requirements for the performance (such as power consumption and storage space usage) of the AI model.
  • developers with high business capabilities are required to optimize multiple AI models one by one for the operating environment of each terminal and the performance requirements of the AI model, which is difficult to debug and has a high development cost.
  • the embodiments of the present application provide a method and a device for developing an AI model, which can develop an AI model that meets a terminal's operating environment and performance requirements at a lower cost.
  • an embodiment of the present application provides a method for developing an AI model.
  • the method may include: developing a platform to obtain platform instruction information, service instruction information, and parameter requirement information of an AI model to be generated; wherein the platform instruction information is used for Indicate the running platform of the AI model to be generated.
  • the service instruction information is used to indicate the first service to be executed by the AI model to be generated.
  • the parameter requirement information is used to indicate the performance parameter requirements of the AI model to be generated.
  • a plurality of available operators corresponding to the running platform and used to execute the first service are selected from the sub-database; the development platform selects the operators from the plurality of available operators and completes the parameter setting of the selected operators to generate the first Candidate strategy; the development platform performs sample training on the first candidate strategy to obtain the first candidate AI model; the development platform calls the simulator component of the operating platform to run the first candidate AI model to execute the first business processing test data to obtain the first operating parameter ; If the first operating parameter matches the parameter requirement information, the development platform determines that the first candidate AI model is AI standard model.
  • the development platform since the development platform generates the AI model, it not only refers to the platform instructions, but also refers to the performance parameters of the running platform to run the AI model. Therefore, the AI model generated by the development platform meets the operating environment of the running platform and can be used for The first service is executed, and the performance parameters meet the requirements of the parameter requirement information when the first service is executed. In addition, the development platform can automatically generate model code that can run on the running platform for different business requirements and running environments, and deploy the model code on the running platform.
  • the model code that can be run on the running platform can be generated according to the first candidate AI model.
  • the development platform can send the model code to the running platform. In this way, the running platform can run the model code and execute the first business.
  • the strategic structure of the AI model for executing the first business is certain.
  • the development platform fills the corresponding operator in the strategy structure of the first service to obtain a first candidate strategy.
  • the above-mentioned development platform selects from the operator database a plurality of available operators corresponding to the operating platform and used to execute the first service.
  • the method may include: the development platform determines the AI to be generated according to the first service.
  • the strategy structure of the model; the plurality of available operators corresponding to the operating platform are selected from the operator database according to the logic of processing data.
  • the above strategy structure is used to characterize the logic of the AI model processing data to be generated, and the strategy structure can be used to generate a first candidate strategy according to the logic filling operator.
  • a method for generating a first candidate strategy may include: selecting an operator from the plurality of available operators, and filling in a policy structure Enter the selected operator, complete the parameter setting of the selected operator, and generate a first candidate strategy.
  • the foregoing parameter requirement information may include: the parameter requirement information includes: a requirement for a power consumption of an AI platform to be generated by an operating platform, and an operation platform to run the to-be-generated Requirements of the accuracy rate of the AI model processing data, the speed of processing data of the AI model to be generated by the running platform, the storage space requirement of the AI model to be generated, and the running of the AI model to be generated by the running platform At least one of the required storage space requirements.
  • the above-mentioned first operating parameter may not match the above-mentioned parameter requirement information. If the first operating parameter does not match the parameter requirement information, the development platform may obtain the first difference information. The first difference information is used to indicate a difference between the first operating parameter and the parameter requirement information. Then, the development platform adjusts the operators in the first candidate strategy according to the first difference information to obtain the second candidate strategy. The development platform performs sample training on the second candidate strategy to obtain a second candidate AI model. The development platform calls the simulator component and runs the second candidate AI model to obtain the second operating parameters. If the second operating parameter matches the parameter requirement information, the development platform determines that the second candidate AI model is the target AI model.
  • the development platform determines whether the first operating parameter matches the parameter requirement information, which may specifically include: the development platform determines whether the power consumption of the simulator component of the operating platform running the first candidate AI model is less than or equal to the parameter requirement information required power consumption, and the development The platform judges whether the accuracy rate of the simulator component running the first candidate AI model to process data is higher than or equal to the accuracy required by the parameter request information, and the development platform judges whether the simulator component runs the first candidate AI model to process data faster than or equal to The speed required by the parameter requirement information, the development platform judges whether the storage space occupied by the simulator component running the first candidate AI model (that is, the running memory of the simulator component running the first candidate AI model) is less than or equal to the parameter requirement information required running memory.
  • the parameter requirement information required running memory is the storage space occupied by the parameter requirement information required operating platform to run the first candidate AI model.
  • the power consumption of the simulator component running the first candidate AI model is less than or equal to the parameter requirement information requirement power consumption
  • the accuracy of the simulator component running the first candidate AI model to process data is higher than or equal to the accuracy requirement of the parameter requirement information
  • simulation The component running the first candidate AI model is processing data faster than or equal to the parameter request information, and the storage space occupied by the simulator component running the first candidate AI model is less than or equal to the running memory required by the parameter request information, then
  • the first operating parameter matches the parameter requirement information, and the first candidate AI model meets the requirements of the parameter requirement information. If the first operating parameter matches the parameter request information.
  • the first running parameter does not meet the requirement that "the power consumption of the simulator component running the first candidate AI model is less than or equal to the parameter requirement information requirement power consumption", "the accuracy rate of the simulator component running the first candidate AI model to process data is higher than or equal to "Accuracy rate of parameter requirement information requirement", "The speed at which the simulator component runs the first candidate AI model to process data is higher than or equal to the speed of the parameter requirement information requirement" and "The simulator component runs the first candidate AI model with less storage space than Or equal to any of the conditions of the running memory required by the parameter request information ", it means that the first running parameter does not match the parameter request information.
  • the development platform can obtain the difference between the first operating parameter and the parameter requirement information (that is, the first difference information), so as to adjust the first candidate strategy according to the first difference information and produce a new Candidate AI models until the development platform obtains AI models that meet the requirements of the parameter information.
  • the development platform can modify an existing benchmarking model to generate an AI model that can be run on the operating platform to execute the first business.
  • a benchmarking model of the first business may be determined, and the benchmarking model is an AI model for processing the first business.
  • the strategy structure of the AI model to be generated is the strategy structure of the benchmark model, and the strategy structure is used to represent the logic of the benchmark model's processing data.
  • the method for generating the first candidate strategy may include: the development platform randomly selects from a plurality of available operators according to the policy structure of the benchmark model The operator is selected, and the randomly selected operator is used to replace the operator in the benchmark model that does not correspond to the operating platform, and the parameters of each operator are adjusted to obtain the first candidate strategy.
  • the development platform can randomly select operators from a plurality of available operators according to the policy structure of the benchmark model, use randomly selected operators to replace the operators in the benchmark model that do not correspond to the operating platform, and adjust the parameters of each operator To get the first candidate strategy.
  • the benchmark model is an AI model used to execute the first business, that is, when the development platform generates the AI model, it refers to the platform instruction information.
  • the development platform when the development platform generates the AI model, it also refers to the requirements for the performance parameters of the running platform to run the AI model. Therefore, the AI model generated by the development platform conforms to the operating environment of the operating platform, and can be used to execute the first service, and the performance parameters meet the requirements of the parameter requirement information when the first service is executed.
  • the development platform can automatically generate model code that can run on the running platform for different business requirements and running environments, and deploy the model code on the running platform.
  • the development platform 210 may not only refer to the above first difference information (that is, the first operation) when adjusting the first candidate strategy.
  • the difference information between the parameter and the parameter requirement information may also be referred to the difference information (ie, the second difference information) between the third operating parameter and the first operating parameter obtained by executing the first business processing test data of the benchmark model.
  • the development platform obtains the first difference information and the second difference information; the development platform adjusts the operator in the first candidate strategy according to the first difference information and the second difference information.
  • the development platform performs sample training on the second candidate strategy to obtain a second candidate AI model; the development platform calls a simulator component and runs the second candidate AI model to obtain a second operating parameter; if the second operating parameter Matching the parameter requirement information, the development platform determines the second candidate AI model as the target AI model.
  • the first candidate strategy generated by the development platform may not meet the requirements of the above-mentioned parameter requirement information.
  • the above parameter requirement information may at least include: a requirement that the AI model to be generated occupies storage space.
  • the storage space occupied by the first candidate strategy may be larger than the storage space occupied by the AI model to be generated in the parameter requirement information.
  • a compression algorithm may be used to compress the first candidate strategy to obtain the compressed first candidate strategy.
  • the development platform performs sample training on the compressed first candidate strategy to obtain a first candidate AI model.
  • the development platform may encode the first candidate strategy to obtain a binary number string of the first candidate strategy.
  • the development platform may perform sample training on the binary number string of the first candidate strategy to obtain the first candidate AI model.
  • the first candidate strategy generated by the development platform may not meet the requirements of the above-mentioned parameter requirement information.
  • the above parameter requirement information may at least include: a requirement that the AI model to be generated occupies storage space.
  • the development platform may determine whether the first candidate strategy meets a preset condition before performing sample training on the first candidate strategy.
  • the above preset conditions include: the storage space required by the first candidate strategy satisfies the requirement that the parameter information requires the storage space occupied by the AI model to be generated.
  • the storage space required by the first candidate strategy satisfies the storage space requirement of the AI model to be generated by the parameter requirement information.
  • the storage space required by the first candidate strategy is less than the AI model to be generated in the parameter requirement information. Storage space used.
  • the development platform can perform sample training on the first candidate strategy that meets the preset conditions to obtain the first candidate AI model.
  • the development platform first determines whether the first candidate strategy meets a preset condition after generating the first candidate strategy; the development platform performs sample training on the first candidate strategy that meets the preset condition to obtain a first candidate AI model. In this way, the possibility that the development platform generates the first candidate AI model that does not meet the requirements of the parameter requirement information according to the first candidate strategy that does not meet the preset conditions can be reduced, and the efficiency of the development platform to generate the AI model that meets the requirements can be improved.
  • an embodiment of the present application provides a development platform including: a processor, a memory, and a plurality of simulator components; a memory, a plurality of simulator components, and a processor are coupled; and the plurality of simulator components include running The simulator component of the platform, the memory is used to store computer program code; the computer program code includes computer instructions, and when the processor executes the above computer instructions, the processor is used to obtain platform instruction information, business instruction information, and Parameter requirement information, platform instruction information is used to indicate the running platform of the AI model to be generated, service instruction information is used to indicate the first service to be executed by the AI model to be generated, and parameter requirement information is used to indicate the AI model to be generated.
  • Requirements for performance parameters select from the operator database multiple available operators that correspond to the operating platform and are used to execute the first business.
  • the operator database holds multiple operators for generating AI models; from multiple Operator from the available operators, and complete the parameter setting of the selected operator to generate the first candidate strategy Omitted; the first candidate strategy is composed of multiple operators; sample training is performed on the first candidate strategy to obtain the first candidate AI model; the processor is also used to call the simulator component of multiple simulator components and the running platform, Run the first candidate AI model to execute the first business processing test data to obtain the first operating parameter; if the first operating parameter matches the parameter required information, determine that the first candidate AI model is the target AI model.
  • the processor is further configured to, after determining the first candidate AI model as the target AI model, generate model code that can be run on the running platform according to the first candidate AI model. .
  • the foregoing processor is configured to select, from the operator database, multiple available operators corresponding to the running platform and used to execute the first service, including: processing A device for determining the policy structure of the AI model to be generated according to the first service, the policy structure is used to characterize the logic of the AI model to process the data, and the policy structure generates a first candidate policy according to the logic filling operator of the processed data ; According to the logic for processing data, a plurality of available operators corresponding to the operating platform are selected from the operator database.
  • the above processor is configured to select an operator from a plurality of available operators and complete the parameter setting of the selected operator to generate a first candidate strategy, including: a processor configured to select an operator from the plurality of available operators , Fill in the selected operator in the strategy structure, complete the parameter setting of the selected operator, and generate the first candidate strategy.
  • the processor is further configured to obtain first difference information if the first operation parameter does not match the parameter requirement information, and the first difference information is used to indicate the first operation. Differences in parameters and parameter required information; adjusting operators in the first candidate strategy according to the first difference information to obtain a second candidate strategy; and performing sample training on the second candidate strategy to obtain a second candidate AI model.
  • the processor is further configured to call a simulator component of the running platform to run the second candidate AI model to obtain the second running parameter; if the second running parameter matches the parameter requirement information, determine the second candidate AI model as the target AI model.
  • the foregoing processor is further configured to select an operator from multiple available operators and complete parameter settings of the selected operator before generating the first candidate strategy
  • the benchmarking model is an AI model for processing the first business; wherein the strategy structure of the AI model to be generated is the strategy structure of the benchmarking model, and the strategy structure is used to represent the logic of the benchmarking model to process data .
  • a processor for selecting an operator from a plurality of available operators and completing the parameter setting of the selected operator to generate a first candidate strategy including: a processor, configured to: from the plurality of available operators according to the policy structure of the benchmark model The operator is randomly selected from the operators, and the randomly selected operator is used to replace the operator in the benchmark model that does not correspond to the operating platform, and the parameters of each operator are adjusted to obtain the first candidate strategy.
  • the foregoing processor is further configured to obtain the first difference information and the second difference information if the first operating parameter does not match the parameter requirement information; the first difference information is used for To indicate the difference between the first operating parameter and the parameter request information; the second difference information is used to indicate the difference between the first operating parameter and the third operating parameter, and the third operating parameter is an operating parameter obtained by the benchmark model executing the first business processing test data ; Adjusting an operator in the first candidate strategy to obtain a second candidate strategy according to the first difference information and the second difference information; performing sample training on the second candidate strategy to obtain a second candidate AI model.
  • the processor is further configured to call a simulator component of the running platform to run the second candidate AI model to obtain the second running parameter; if the second running parameter matches the parameter requirement information, determine the second candidate AI model as the target AI model.
  • the processor is further configured to compress the first candidate strategy by using a compression algorithm after generating the first candidate strategy to obtain the compressed first candidate strategy.
  • the processor is configured to perform sample training on the first candidate strategy to obtain a first candidate AI model, and includes a processor to perform sample training on the compressed first candidate strategy to obtain a first candidate AI model.
  • the processor is further configured to encode the first candidate strategy after generating the first candidate strategy to obtain a binary number string of the first candidate strategy.
  • the processor is configured to perform sample training on the first candidate strategy to obtain a first candidate AI model, and includes a processor configured to perform sample training on a binary number string of the first candidate strategy to obtain the first candidate AI model.
  • the foregoing parameter requirement information includes: the power consumption requirement of the AI platform to be generated by the running platform, and the accuracy rate of the AI model processing data to be generated by the running platform. At least of the requirements of the processing platform to run the AI model to be generated to process data, the requirements of the storage space occupied by the generated AI model, and the storage space required of the platform to run the AI model to be generated.
  • the foregoing parameter requirement information includes at least: a requirement that an AI model to be generated occupies storage space.
  • the processor is further configured to determine whether the first candidate strategy meets a preset condition before performing sample training on the first candidate strategy to obtain the first candidate AI model; the preset condition includes: the storage space required by the first candidate strategy meets
  • the parameter requirement information is the requirement of the storage space occupied by the generated AI model.
  • a processor configured to perform sample training on the first candidate strategy to obtain a first candidate AI model, and includes a processor configured to perform sample training on the first candidate strategy if the first candidate strategy meets a preset condition to obtain a first candidate AI model; Candidate AI model.
  • an embodiment of the present application provides a development platform including a constraint library, a policy generator, an artificial intelligence AI model generator, an evaluator, a code generator, and multiple simulator components.
  • the constraint library is used to provide platform instruction information, service instruction information, and parameter requirement information of the AI model to be generated.
  • the platform instruction information is used to indicate the running platform of the AI model to be generated, and the service instruction information is used to indicate the to-be-generated model.
  • the first service to be executed by the AI model is parameter requirement information used to indicate the requirements of the performance parameters of the AI model to be generated.
  • a policy generator selects from the operator database a plurality of available operators corresponding to the running platform and used to execute the first service, which are stored in the operator database There are multiple operators for generating AI models; selecting an operator from multiple available operators, and completing the parameter setting of the selected operator to generate a first candidate strategy; the first candidate strategy is composed of multiple operators.
  • the AI model generator is configured to perform sample training on the first candidate strategy generated by the strategy generator to obtain a first candidate AI model.
  • the evaluator is used to call the simulator component of the running platform, run the first candidate AI model generated by the AI model generator, execute the first business processing test data, and obtain the first operating parameter; determine whether the first operating parameter matches the parameter request information ;
  • the simulator component of the running platform is one of multiple simulator components.
  • a code generator is configured to generate a model code that can be run on an operating platform according to the first candidate AI model generated by the AI model generator if the evaluator determines that the first operating parameter matches the parameter requirement information.
  • the policy generator is configured to select from the operator database a plurality of available operators corresponding to the running platform and used to execute the first service, including: a policy
  • the generator is used to determine the strategy structure of the AI model to be generated according to the first service.
  • the strategy structure is used to represent the logic of the AI model to process the data. According to the logic of the data, it is selected and run from the operator database Multiple available operators for the platform.
  • the policy generator is used to select an operator from multiple available operators and complete the parameter setting of the selected operator to generate a first candidate strategy.
  • the first candidate strategy is composed of multiple operators and includes: a policy generator , Used to select an operator from a plurality of available operators, fill in the selected operator in the strategy structure, complete the parameter setting of the selected operator, and generate a first candidate strategy.
  • the evaluator is further configured to obtain first difference information if the first operation parameter does not match the parameter requirement information, and the first difference information is used to indicate the first operation. Differences in parameters and parameter request information.
  • the policy generator is further configured to adjust an operator in the first candidate strategy according to the first difference information to obtain a second candidate strategy.
  • the AI model generator is further configured to perform sample training on the second candidate strategy generated by the strategy generator to obtain a second candidate AI model.
  • the evaluator is also used to call the simulator component of the running platform, run the second candidate AI model generated by the AI model generator, and obtain the second running parameter; determine whether the second running parameter matches the parameter requirement information; run the simulator of the platform
  • the component is one of multiple simulator components.
  • the code generator is further configured to generate a model code that can be run on the running platform according to the second candidate AI model generated by the AI model generator if the evaluator determines that the second operating parameter matches the parameter requirement information.
  • the above-mentioned strategy generator is further configured to select an operator from multiple available operators and complete parameter settings of the selected operator to generate a first candidate strategy
  • the benchmarking model of the first business was selected from the benchmarking model database.
  • the benchmarking model is an AI model used to process the first business.
  • the strategy structure of the AI model to be generated is the strategy structure of the benchmarking model. Characterize the logic of the benchmark model processing data; the benchmark model database stores multiple AI models.
  • a policy generator is used to select an operator from a plurality of available operators and complete the parameter setting of the selected operator to generate a first candidate policy, including a policy generator, which is used to select a plurality of operators according to the policy structure of the benchmark model.
  • the operator can be randomly selected from the operators, and the randomly selected operator is used to replace the operator in the benchmark model that does not correspond to the operating platform, and the parameters of each operator are adjusted to obtain the first candidate strategy.
  • the above-mentioned evaluator is further configured to obtain the first difference information and the second difference information if the first operating parameter does not match the parameter requirement information, and the first difference information is used To indicate the difference between the first operating parameter and the parameter request information; the second difference information is used to indicate the difference between the first operating parameter and the third operating parameter, and the third operating parameter is an operating parameter obtained by the benchmark model executing the first business processing test data .
  • the policy generator is further configured to adjust an operator in the first candidate strategy according to the first difference information and the second difference information to obtain a second candidate strategy.
  • the AI model generator is further configured to perform sample training on the second candidate strategy generated by the strategy generator to obtain a second candidate AI model.
  • the evaluator is also used to call the simulator component of the running platform, run the second candidate AI model generated by the AI model generator, and obtain the second running parameter; determine whether the second running parameter matches the parameter requirement information; run the simulator of the platform
  • the component is one of multiple simulator components.
  • the code generator is further configured to generate a model code that can be run on the running platform according to the second candidate AI model generated by the AI model generator if the evaluator determines that the second operating parameter matches the parameter requirement information.
  • the strategy generator is further configured to compress the first candidate strategy by using a compression algorithm after generating the first candidate strategy to obtain a compressed first candidate strategy.
  • the AI model generator is configured to perform sample training on the first candidate strategy compressed by the strategy generator to obtain a first candidate AI model.
  • the strategy generator is further configured to encode the first candidate strategy after generating the first candidate strategy to obtain a binary number string of the first candidate strategy.
  • An AI model generator is configured to perform sample training on a binary number string of a first candidate strategy to obtain a first candidate AI model.
  • the above parameter requirement information includes: the power consumption requirement of the AI platform to be generated by the running platform, and the accuracy rate of the AI model processing data to be generated by the running platform. At least of the requirements of the processing platform to run the AI model to be generated to process data, the requirements of the storage space occupied by the generated AI model, and the storage space required of the platform to run the AI model to be generated.
  • the foregoing parameter requirement information includes at least: a requirement that an AI model to be generated occupies storage space.
  • the AI model generator is further configured to determine whether the first candidate strategy satisfies a preset condition before performing a sample training on the first candidate strategy to obtain the first candidate AI model.
  • the preset condition includes: storage required for the first candidate strategy.
  • the space satisfies the requirement that the parameter information requires the AI model to generate storage space.
  • An AI model generator for performing sample training on the first candidate strategy to obtain a first candidate AI model including: an AI model generator for performing sample training on the first candidate strategy if the first candidate strategy meets a preset condition To get the first candidate AI model.
  • an embodiment of the present application provides a computer storage medium including computer instructions, and when the computer instructions are run on a development platform, the development platform executes the same as the first aspect and any one of them Development method of AI model as described in possible design way.
  • an embodiment of the present application provides a computer program product, and when the computer program product is run on a computer, the computer is caused to execute the AI model described in the first aspect and any one of possible design modes. Development method.
  • FIG. 1 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a system network structure to which an AI model development method according to an embodiment of the present application is applied;
  • FIG. 3 is a first flowchart of a method for developing an AI model according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of an example of a policy structure provided by an embodiment of the present application.
  • FIG. 5 is a first schematic diagram of an example of a first candidate strategy provided by an embodiment of the present application.
  • FIG. 6 is a second schematic diagram of an example of a first candidate strategy provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a principle of an AI model development method according to an embodiment of the present application.
  • FIG. 8A is a schematic diagram 2 of an AI model development method according to an embodiment of the present application.
  • 8B is a second flowchart of a method for developing an AI model according to an embodiment of the present application.
  • FIG. 8C is a third schematic diagram of an AI model development method provided by an embodiment of the present application.
  • FIG. 9 is a third flowchart of a method for developing an AI model according to an embodiment of the present application.
  • FIG. 10 is a schematic diagram of an example of a benchmarking model according to an embodiment of the present application.
  • FIG. 11 is a schematic diagram of an example of an AI model of an OCR service according to an embodiment of the present application.
  • FIG. 12 is a schematic structural example of a convolution block and a convolution layer in the AI model of the OCR service shown in FIG. 11;
  • FIG. 12 is a schematic structural example of a convolution block and a convolution layer in the AI model of the OCR service shown in FIG. 11;
  • FIG. 12 is a schematic structural example of a convolution block and a convolution layer in the AI model of the OCR service shown in FIG. 11;
  • FIG. 13 is a schematic structural composition diagram of a development platform provided by an embodiment of the present application.
  • the embodiment of the present application provides a method for developing an AI model, which can be applied to the process of developing an AI model.
  • the development platform may generate an AI model according to the instruction information (i.e., platform instruction information) of the running platform of the AI model to be generated, the services to be processed by the AI model, and the performance parameters of the running AI model of the running platform. Then, the development platform can generate the model code that can be run on the running platform according to the generated AI model and the instruction information of the running platform.
  • the development platform may issue the model code to the running platform (ie, the terminal) to deploy the model code on the running platform, so that the running platform can execute the model code to run the AI model.
  • the development platform since the development platform generates the AI model, not only the instruction information of the operation platform to run the AI model, but also the requirements for the performance parameters of the operation platform to run the AI model; therefore, the AI model generated by the development platform meets the operation platform. (Ie terminal) operating environment and performance requirements. Moreover, in the embodiments of the present application, the development platform can automatically generate model code that can be run on the running platform for different business requirements and running environments, and deploy the model code on the running platform.
  • the development platform in the embodiment of the present application may be a device with strong computing power and storage capacity, such as a personal computer (PC), a notebook computer, or a cloud server.
  • the operating platform in the embodiment of the present application may be a portable computer (such as a mobile phone), a notebook computer, a PC, a wearable electronic device (such as a smart watch), a tablet computer, augmented reality (AR) ⁇ virtual reality, VR) equipment, on-board computer, etc., the following embodiments do not specifically limit the specific form of the terminal.
  • the development platform is configured with a simulator component of the running platform. After generating the AI model, the development platform can simulate and run the AI model on the simulator component of the running platform to obtain the performance parameters of the simulator component running the AI model. In this way, the development platform can judge whether the obtained performance parameters meet the requirements for the performance parameters of the running platform's AI model.
  • the operating platform may be the electronic device 100 shown in FIG. 1.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display 194, And a subscriber identity module (SIM) card interface 195.
  • SIM subscriber identity module
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an environment Light sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer parts than shown, or some parts may be combined, or some parts may be split, or different parts may be arranged.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor ( image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural-network processing unit (NPU), etc. .
  • AP application processor
  • GPU graphics processing unit
  • ISP image signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • different processing units may be independent devices or integrated in one or more processors.
  • the controller may be a nerve center and a command center of the electronic device 100.
  • the controller can generate operation control signals according to the instruction operation code and timing signals, and complete the control of fetching and executing instructions.
  • the processor 110 may further include a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or used cyclically. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided and the waiting time of the processor 110 is reduced, thereby improving the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit (inter-integrated circuit, sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver receiver / transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input / output (GPIO) interface, subscriber identity module (SIM) interface, and / Or universal serial bus (universal serial bus, USB) interface.
  • I2C integrated circuit
  • I2S integrated circuit
  • PCM pulse code modulation
  • UART universal asynchronous transceiver receiver / transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input / output
  • SIM subscriber identity module
  • USB universal serial bus
  • the interface connection relationship between the modules illustrated in the embodiments of the present invention is only a schematic description, and does not constitute a limitation on the structure of the electronic device 100.
  • the electronic device 100 may also adopt different interface connection modes or a combination of multiple interface connection modes in the above embodiments.
  • the charging management module 140 is configured to receive a charging input from a charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100. While the charge management module 140 is charging the battery 142, the power management module 141 can also provide power to the electronic device.
  • the power management module 141 is used to connect the battery 142, the charge management module 140 and the processor 110.
  • the power management module 141 receives inputs from the battery 142 and / or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, and a baseband processor.
  • the antenna 1 and the antenna 2 are used for transmitting and receiving electromagnetic wave signals.
  • Each antenna in the electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed into a diversity antenna for a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide a wireless communication solution including 2G / 3G / 4G / 5G and the like applied on the electronic device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like.
  • the mobile communication module 150 may receive the electromagnetic wave by the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic wave, and transmit it to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and turn it into electromagnetic wave radiation through the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110.
  • the modem processor may include a modulator and a demodulator. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and disposed in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 may provide wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (bluetooth, BT), and global navigation satellites applied to the electronic device 100. Wireless communication solutions such as global navigation system, GNSS, frequency modulation (FM), near field communication (NFC), and infrared technology (infrared, IR).
  • the wireless communication module 160 may be one or more devices that integrate at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency-modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 may also receive a signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and convert it into electromagnetic wave radiation through the antenna 2.
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include a global mobile communication system (GSM), a general packet radio service (GPRS), a code division multiple access (CDMA), and broadband. Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and / or IR technology.
  • the GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation navigation system (BDS), and a quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and / or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Bertdou navigation navigation system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing and is connected to the display 194 and an application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active matrix organic light emitting diode active-matrix organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • emitting diodes AMOLED
  • flexible light-emitting diodes FLEDs
  • Miniled MicroLed
  • Micro-oLed quantum dot light emitting diodes
  • QLEDs quantum dot light emitting diodes
  • the electronic device 100 may include one or N display screens 194, where N is a positive integer
  • the electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display 194, and an application processor.
  • the ISP processes the data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and the light is transmitted to the light receiving element of the camera through the lens. The light signal is converted into an electrical signal, and the light receiving element of the camera passes the electrical signal to the ISP for processing and converts the image to the naked eye. ISP can also optimize the image's noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, an ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • An object generates an optical image through a lens and projects it onto a photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs digital image signals to the DSP for processing.
  • DSP converts digital image signals into image signals in standard RGB, YUV and other formats.
  • the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
  • NPU is a neural network (Neural-Network, NN) computing processor.
  • NN neural network
  • the NPU can realize applications such as intelligent recognition of the electronic device 100, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the NPU can run the model code of the AI model in the embodiment of the present application, and perform the above-mentioned services such as image recognition, face recognition, speech recognition, and text understanding.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, save music, videos and other files on an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area may store an operating system, at least one application required by a function (such as a sound playback function, an image playback function, etc.) and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
  • a memory such as the internal memory 121) may be used to save the model code of the AI model.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, and an application processor. Such as music playback, recording, etc.
  • the audio module 170 is configured to convert digital audio information into an analog audio signal and output, and is also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 may also be used to encode and decode audio signals.
  • the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
  • the keys 190 include a power-on key, a volume key, and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 may receive a key input, and generate a key signal input related to user settings and function control of the electronic device 100.
  • the motor 191 may generate a vibration alert.
  • the motor 191 can be used for vibration alert for incoming calls, and can also be used for touch vibration feedback.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting or removing the SIM card interface 195.
  • the electronic device 100 may support one or N SIM card interfaces, and N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple SIM cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards may be the same or different.
  • the SIM card interface 195 may also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through a SIM card to implement functions such as calling and data communication.
  • the electronic device 100 uses an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
  • FIG. 2 is a schematic diagram of a system architecture composed of a development platform and an operation platform provided by an embodiment of the present application.
  • the system includes a development platform 200 and an operation platform 210.
  • the development platform 200 may execute the method for developing an AI model provided in the embodiments of the present application to generate model code of the AI model.
  • the development platform 200 may transmit the generated model code to the execution platform 210.
  • the execution platform 210 can then execute the model code to run the AI model.
  • the embodiment of the present application provides a method for developing an AI model, which is applied to the development platform 200 shown in FIG. 2.
  • the development method of the AI model may include:
  • the development platform 200 obtains platform instruction information, service instruction information, and parameter requirement information of an AI model to be generated.
  • the platform instruction information is used to indicate an operating platform 210 for running the AI model to be generated.
  • the platform indication information may be an identifier of a running platform 210 that runs an AI model to be generated.
  • the platform instruction information may indicate that the running platform 210 running the AI model to be generated is Huawei Mate10.
  • the platform instruction information can be the logo of Huawei Mate10.
  • the service instruction information is used to indicate a service to be executed by the AI model to be generated.
  • the services in the embodiments of the present application may include: text recognition, image recognition, and natural language processing.
  • text recognition may be optical character recognition (OCR)
  • image recognition may be face recognition.
  • the above parameter requirement information is used to indicate a requirement for a performance parameter of the AI platform to run the AI model to be generated.
  • the parameter requirement information may include: the power consumption requirement for the running platform 210 to run the AI model to be generated, the accuracy requirement for the processing data of the AI model to be generated by the running platform 210, and the operation of the running platform 210. At least one of a requirement of the processing speed of the AI model to be generated, a requirement of the storage space occupied by the AI model to be generated, and a requirement of the storage space required by the operating platform 210 to run the AI model to be generated.
  • the development platform 200 may provide a developer with a setting interface for setting the platform instruction information, service instruction information, and parameter requirement information.
  • the development platform 200 displays the setting interface.
  • This setting interface can include multiple setting options. Such as operating platform setting options, business setting options, power consumption setting options, accuracy setting options, speed setting options, and storage space setting options.
  • the setting option of the running platform is used to set a running platform for running the AI model to be generated.
  • the service setting option is used to set the business to be processed by the AI model to be generated.
  • the power consumption setting option is used to set the requirements for the power consumption of the AI model to be generated by the running platform.
  • the accuracy setting option is used to set the requirements for the accuracy of the AI model processing data to be generated by the running platform.
  • the speed setting option is used to set the requirements for the speed at which the running platform runs the AI model to be generated to process the data.
  • the storage space setting option is used to set the requirements for the storage space occupied by the running platform to run the AI model to be generated.
  • the development platform 200 may receive a user's setting operation of each setting option on the above-mentioned setting interface, and obtain the above-mentioned platform instruction information, service instruction information, and parameter requirement information.
  • the development platform 200 may receive platform instruction information, service instruction information, and parameter requirement information sent by other devices (such as the running platform 210).
  • the development platform 200 selects a plurality of available operators corresponding to the running platform 210 from the operator database and used to execute the first service.
  • the operator database stores a plurality of operators for generating AI models.
  • the operator database may store multiple operators according to the type of the operator. According to the types of operators, multiple operators can be divided into: Convolution operator, deConv operator, Sum operator, Batch normalization operator, and scale change (Scale) operator and activation function (ReLu / Sigmoid) operator.
  • the operators in the embodiments of the present application include, but are not limited to, the above-mentioned convolution operators, deconvolution operators, addition operators, batch normalization operators, scale change operators, and activation function operators.
  • the operator database may include operators for generating various AI models.
  • the operator database may use the operator information table shown in Table 1 to store multiple operators.
  • the operator database can store various operators such as convolution operator, deconvolution operator, addition operator, batch normalization operator, scale change operator, and activation function operator. Moreover, for each type of operator in the operator database, multiple operators that can be run on different operating platforms are stored. For example, as shown in Table 1, for the convolution operator in the operator database, convolution operator 1 and convolution operator 4 can be run on the operation platform 210, and convolution operator 1 can be run on the operation platform b. And convolution operator 2 and convolution operator 3 that can be run on the operation platform c.
  • convolution operator 1 and convolution operator 4 can be run on the operation platform 210
  • convolution operator 1 can be run on the operation platform b.
  • convolution operator 2 and convolution operator 3 that can be run on the operation platform c.
  • the operator database in the embodiment of the present application may be stored in the development platform 200.
  • the operator database can be stored in a cloud server.
  • the development platform 200 can read the data in the operator database in the cloud server to select multiple available operators from the operator database.
  • the operating platform indicated by the platform instruction information is the operating platform 210
  • the first service indicated by the service instruction information is the service a.
  • Table 2 it is assumed that the available operators for performing service a include: convolution operator, deconvolution operator, addition operator and activation function operator. It can be known from Table 1: As shown in Table 2, the convolution operator corresponding to the running platform 210 in the operator database includes convolution operator 1 and convolution operator 4, that is, convolution operator 1 and convolution operator 4.
  • the deconvolution operator corresponding to the running platform 210 in the operator database includes deconvolution operator 1 and deconvolution operator n, that is, deconvolution operator 1 and deconvolution operator n can run on the running platform 210;
  • the addition operator corresponding to the running platform 210 in the operator database includes the addition operator 1 and the addition operator 3, that is, the addition operator 1 and the addition operator 3 can be running
  • the platform 210 runs;
  • the activation function operator corresponding to the running platform 210 in the operator database includes the activation function operator 1, that is, the activation function operator 1 can run on the running platform 210.
  • the strategic structure of the AI model that executes each business is certain.
  • the service instruction information is used to indicate that the service to be processed by the AI model to be generated is service a.
  • the development platform 200 determines the service a according to the service instruction information, it can determine the policy structure of the AI model that executes the service a, that is, the policy structure of the AI model to be generated.
  • the AI model's policy structure can represent the logic of the AI model's processing data when it executes business.
  • FIG. 4 is a schematic diagram illustrating an example of a policy structure of an AI model for executing a service a.
  • the strategy structure 400 shown in FIG. 4 is composed of a convolution operator, a deconvolution operator, an addition operator, and an activation function operator.
  • the logic of the AI model processing data represented by the strategy structure 400 shown in FIG. 4 is composed of a convolution operator, a deconvolution operator, an addition operator, and an activation function operator.
  • one convolution operator processes data 401 (data to be processed) and output data 402; another convolution operator (Convolution operator K) Processes data 402 and outputs data 404; Activation function operator processes data 402 to obtain data 403; Deconvolution operator processes data 403 to obtain data 405; Sum operator processes data 404 and data 405 to obtain data 406 ; Another convolution operator (convolution operator Y) processes the data 406 to obtain a processing result.
  • the development platform 200 After the development platform 200 determines the strategic structure of the AI model that executes the first business (such as business a), it can select a plurality of corresponding to the operating platform 210 from the operator database according to the logic of processing data represented by the strategic structure. Available operators. For example, after determining that the policy structure of the AI model of the service a is the policy structure 400 shown in FIG. 4, the development platform 200 may determine that the policy structure 400 shown in FIG. 4 is composed of a convolution operator, a deconvolution operator, and a sum Operator and activation function operator. Then, the development platform may select a plurality of convolution operators, deconvolution operators, addition operators, and activation function operators corresponding to the operating platform 210 from the operator database. For example, the development platform 200 may select a plurality of available operators shown in Table 2 from a plurality of operators shown in Table 1.
  • the development platform 200 selects an operator from a plurality of available operators, completes the parameter setting of the selected operator, and generates a first candidate strategy.
  • the first candidate strategy is composed of multiple operators. This first candidate strategy is used to characterize the logic of the AI model processing data to be generated.
  • the development platform 200 may determine a policy structure of an AI model that executes the first business. Then, the development platform 200 may randomly select an operator from the plurality of available operators, fill the selected operator into the strategy structure, and complete the parameters of the selected operator to obtain a first candidate strategy. Among them, the development platform 200 selects an operator from a plurality of available operators according to the platform instruction information, and completes the parameter setting of the selected operator, and can generate one or more first candidate strategies.
  • the development platform 200 may randomly select an operator from the available operators shown in Table 2 and fill the selected operator into the strategy structure 400 shown in FIG. 4.
  • the development platform 200 may randomly select the convolution operator 1 in Table 2 to be filled in the convolution operator X shown in FIG. 4, and select the convolution operator 4 in Table 2 to be filled in the convolution shown in FIG. 4.
  • operator K the activation function operator 1 in Table 2 is selected and filled in the activation function operator shown in FIG. 4, and the deconvolution operator 1 in Table 2 is selected and filled in the deconvolution calculation shown in FIG. 4.
  • the addition operator 1 in Table 2 is selected to be filled in the addition operator shown in FIG. 4, and the convolution operator 4 in Table 2 is selected to be filled in the convolution operator Y shown in FIG. 4,
  • the first candidate strategy 500 shown in FIG. 5 is obtained.
  • the development platform 200 may randomly select the convolution operator 4 in Table 2 to be filled in the convolution operator X shown in FIG. 4, and select the convolution operator 4 in Table 2 to be filled in the volumes shown in FIG. 4.
  • the activation function operator 1 in Table 2 is selected and filled in the activation function operator shown in FIG. 4, and the deconvolution operator n in Table 2 is selected and filled in the deconvolution shown in FIG. 4.
  • the addition operator 3 in Table 2 is selected to be filled in the addition operator shown in FIG. 4, and the convolution operator 4 in Table 2 is selected to be filled in the convolution operator Y shown in FIG. 4.
  • the first candidate strategy 600 shown in FIG. 6 is obtained.
  • the parameter setting of the operator can be completed.
  • the development platform 200 may randomly set the parameters of the operators filled in the strategy structure.
  • the parameter of the convolution operator may be the size of the convolution kernel of the convolution operator.
  • the development platform 200 may set the convolution kernel size of the convolution operator 1 shown in FIG. 5 to 2 * 2, that is, the convolution operator 1 shown in FIG. 5 may be input to the convolution operator 1. Perform a 2 * 2 convolution operation on the data.
  • the development platform 200 performs sample training on the first candidate strategy to obtain a first candidate AI model.
  • the development platform 200 can store multiple sample data for sample training for each service.
  • the development platform 200 can perform sample training on the first candidate strategy to obtain the first candidate AI model according to the sample data corresponding to the first service.
  • the first service is an OCR service
  • the above sample data may be a large number of characters and their character patterns.
  • the first candidate AI model obtained after the training platform 200 performs sample training on the first candidate strategy according to the sample data of the OCR service can associate the text pattern with the corresponding text. In this way, the first candidate AI model can recognize the text pattern and determine the corresponding text.
  • the development platform 200 performs sample training on the first candidate strategy according to the sample data to obtain the first candidate AI model.
  • the development platform performs sample training on the candidate strategy to obtain the AI model. I repeat.
  • a compression algorithm may be used to compress the first candidate strategy to obtain the compressed first candidate strategy. Accordingly, the development platform 200 performs sample training on the compressed first candidate strategy to obtain a first candidate AI model.
  • the development platform 200 may encode the first candidate strategy to obtain a binary number string of the first candidate strategy.
  • the development platform 200 may perform sample training on the binary number string of the first candidate strategy to obtain a first candidate AI model.
  • the first candidate strategy generated by the development platform 200 may not meet the requirements of the parameter requirement information described above.
  • the above parameter requirement information may at least include: a requirement that the AI model to be generated occupies storage space.
  • the development platform 200 may determine whether the first candidate strategy satisfies a preset condition before performing sample training on the first candidate strategy (or the compressed first candidate strategy).
  • the first candidate strategy and the compressed first candidate strategy are collectively referred to as a first candidate strategy.
  • the preset condition includes that the storage space required by the first candidate strategy satisfies the requirement that the parameter information requires the storage space occupied by the AI model to be generated.
  • the storage space required by the first candidate strategy satisfies the storage space requirement of the AI model to be generated by the parameter requirement information. Specifically, the storage space required by the first candidate strategy is less than the AI model to be generated in the parameter requirement information. Storage space used.
  • the development platform 200 may perform sample training on a first candidate strategy that meets a preset condition to obtain a first candidate AI model.
  • the storage space occupied by the AI model to be generated refers to the storage space occupied by the model code when the operating platform 210 saves the model code of the AI model to be generated.
  • the development platform 200 may generate one or more first candidate strategies. In the case where the development platform 200 generates a first candidate strategy, if the first candidate strategy does not satisfy a preset condition, the development platform 200 may generate a new candidate strategy. In the case where the development platform 200 generates a plurality of first candidate strategies, the development platform 200 may perform sample training on the first candidate strategies that satisfy a preset condition among the plurality of first candidate strategies to obtain a first candidate AI model. If the multiple first candidate strategies do not meet the preset conditions, the development platform 200 may generate a new candidate strategy.
  • the development platform 200 invokes the simulator component of the operation platform 210, runs the first candidate AI model, executes the first business processing test data, and obtains the first operation parameters.
  • the first operating parameter may include: the power consumption of the first candidate AI model running by the simulator component (AI Model Simulator) of the running platform 210, the accuracy rate of the simulator component running the first candidate AI model processing data, and the simulator component operation At least one of the speed at which the first candidate AI model processes data, and the size of the storage space occupied by the simulator component running the first candidate AI model.
  • the first operating parameter obtained by the development platform corresponds to the above-mentioned parameter requirement information.
  • the above parameter requirement information includes requirements for the power consumption of the AI model to be generated by the running platform, and to be generated by the running platform.
  • the first operating parameter accordingly includes the power consumption of the simulator component (AI Model Simulator) of the operating platform running the first candidate AI model, and the simulator component running the first candidate AI model. Accuracy of processed data.
  • multiple simulator components of the running platform 210 may be stored in the development platform 200. Before the development platform 200 calls the simulator component of the running platform 210, the running platform 210 indicated by the platform instruction information may be determined first; then, the simulator component of the running platform 210 is initialized.
  • the simulator component of the running platform 210 may be stored in a cloud server.
  • a plurality of simulator components running the platform 210 may be stored in the cloud server.
  • the development platform 200 may send the platform instruction information, the service instruction information, and the first candidate AI model to the cloud server.
  • the cloud server receives the platform instruction information, business instruction information, and the first candidate AI model, it can first determine the operating platform 210 indicated by the platform instruction information; then, initialize the simulator component of the operating platform 210 and call the simulator
  • the component runs the first candidate AI model to execute the first business processing test data indicated by the business instruction information to obtain the first operating parameter; finally, the cloud server may send the first operating parameter to the development platform 200; the development platform 200 may receive the cloud server The first operating parameter sent.
  • the development platform 200 determines whether the first operation parameter matches the parameter requirement information.
  • the development platform 200 determines whether the first operating parameter matches the parameter requirement information. According to the setting of the parameter requirement information, the corresponding first operating parameter is obtained, and the two are compared. Specifically, it may include at least one of the following: the development platform 200 determines Whether the power consumption of the simulator component running the first candidate AI model of the platform 210 is less than or equal to the power required by the parameter requirement information, and the development platform 200 determines whether the accuracy of the simulator component running the first candidate AI model to process data is higher than or equal to The accuracy rate required by the parameter request information. The development platform 200 judges whether the speed at which the simulator component runs the first candidate AI model is faster than or equal to the speed required by the parameter request information. The development platform 200 judges that the simulator component runs the first candidate AI model.
  • the parameter requirement information required running memory is the storage space occupied by the parameter requirement information required running platform 210 to run the first candidate AI model.
  • the parameter requirement information herein may include a requirement for the storage space occupied by the AI model to be generated, and the first operating parameter may include the size of the storage space occupied by the first candidate AI model.
  • the development platform 200 determines whether the Whether the size of the storage space occupied by a candidate AI model is less than or equal to the storage space required by the parameter requirement information.
  • the first operating parameter here may not include the size of the storage space occupied by the first candidate AI model.
  • the requirement of the storage space occupied by the AI model to be generated in the parameter requirement information can be determined by determining the size of the storage space required by the first candidate strategy, as described in step S304.
  • the power consumption of the simulator component running the first candidate AI model is less than or equal to the parameter requirement information requirement power consumption
  • the accuracy of the simulator component running the first candidate AI model to process data is higher than or equal to the accuracy requirement of the parameter requirement information
  • simulation The component running the first candidate AI model is processing data faster than or equal to the parameter request information, and the storage space occupied by the simulator component running the first candidate AI model is less than or equal to the running memory required by the parameter request information, then
  • the first operating parameter matches the parameter requirement information, and the first candidate AI model meets the requirements of the parameter requirement information. If the first operating parameter matches the parameter requirement information, the development platform may continue to execute S307.
  • the development platform may continue to execute S308.
  • the development platform 200 generates a model code that can be run on the execution platform 210 according to the first candidate AI model.
  • the development platform 200 may determine that the first candidate AI model is a target AI model.
  • the development platform 200 may generate a model code that can be run on the execution platform 210 according to the first candidate AI model (that is, the target AI model).
  • the development platform 200 may send the model code to the execution platform 210 after generating the model code.
  • the development platform 200 may generate a model code that can be run on the execution platform 210 according to the execution platform 210 indicated by the platform instruction information.
  • the running platform 210 can execute the model code to run the corresponding AI model. That is, in the embodiment of the present application, the AI model generated by the development platform 200 can be deployed to the operation platform 210 (ie, the terminal) with one click.
  • the development platform 200 obtains the first difference information.
  • the first difference information is used to indicate a difference between the first operating parameter and the parameter requirement information.
  • the development platform 200 may obtain the difference between the first operating parameter and the parameter requirement information (that is, the first difference information), so as to adjust the first candidate strategy according to the first difference information.
  • the required parameters refer to the parameters required by the information required by the operating platform 210 to run the AI model to be generated
  • the simulation parameters refer to the parameters when the simulator component of the operating platform 210 runs the first candidate AI model.
  • the power requirement of the parameter request information is A
  • the accuracy rate of the parameter request information is B
  • the speed of the parameter request information is C
  • the size of the storage space occupied by the parameter request information request is D.
  • the power consumption of the simulator component running the first candidate AI model is a
  • the accuracy of the simulator component running the first candidate AI model to process data is b
  • the speed of the simulator component running the first candidate AI model to process data is c.
  • the size of the storage space occupied by the component running the first candidate AI model is d; then, the above first difference information may be: power consumption difference Aa, accuracy difference Bb, speed difference Cc, and storage space difference Dd.
  • the development platform 200 adjusts the first candidate strategy according to the first difference information to obtain a second candidate strategy.
  • the development platform 200 may use a preset algorithm to adjust the first candidate strategy according to the first difference information to obtain the second candidate strategy.
  • the preset algorithm may be a multi-objective evolutionary algorithm (MOEA) or a gradient descent algorithm.
  • the development platform 200 adjusting the first candidate strategy may include: the development platform 200 replaces the corresponding operator in the first candidate strategy with an available operator.
  • the development platform 200 may use the addition operator 3 in Table 2 to replace the addition operator 1 in the first candidate strategy 500 shown in FIG. 5.
  • the development platform 200 adjusting the first candidate strategy may further include: the development platform 200 adjusting an operator parameter in the first candidate strategy.
  • the development platform 200 may adjust the convolution kernel size of the convolution operator 1 in the first candidate strategy 500 shown in FIG. 5 from 2 * 2 to 3 * 3, so that the convolution operator 1 can input the volume to The data of the integrator 1 performs a 3 * 3 convolution operation.
  • the development platform 200 performs sample training on the second candidate strategy to obtain a second candidate AI model.
  • the development platform 200 invokes the simulator component of the running platform 210 to run the second candidate AI model to obtain a second running parameter.
  • the second running parameter is a performance parameter of the simulator running the second candidate AI model.
  • the development platform 200 determines whether the second operating parameter matches the parameter requirement information.
  • the development platform may continue to execute S313. If the second running parameter does not match the parameter requirement information, it means that the second candidate AI model does not meet the requirements of the parameter requirement information, and the development platform may continue to execute S314:
  • the development platform 200 generates model code that can be run on the execution platform 210 according to the second candidate AI model.
  • the development platform 200 adjusts the second candidate strategy according to the difference information between the second operating parameter and the parameter requirement information, and performs sample training on the adjusted second candidate strategy to obtain a third candidate AI model.
  • the development platform 200 may call a simulator component to run a third candidate AI model to obtain operating parameters. Then, the development platform 200 determines whether the operation parameter matches the parameter requirement information. If the running parameter matches the parameter requirement information, the development platform may generate model code that can be run on the running platform 210 according to the third candidate AI. If the operating parameter does not match the parameter requirement information, the development platform 200 may continue to adjust the second candidate strategy until the development platform 200 obtains an AI model that meets the requirements of the parameter requirement information.
  • FIG. 7 illustrates a schematic diagram of a method for developing an AI model provided by an embodiment of the present application.
  • the development platform 200 can be divided into five modules: a constraint library 701, a policy generator 702, an AI model generator 703, an evaluator 704, and a code generator 705.
  • the constraint library 701 can obtain the constraint conditions of the AI model to be generated, that is, the above-mentioned platform instruction information, service instruction information, and parameter requirement information.
  • the policy generator 702 may select a plurality of available operators from the operator database 700 according to the platform instruction information and business instruction information in the constraint library 701; and then, fill the selected available operators to the instruction indicated by the execution business instruction information In the strategy structure of the AI model of the first service, and complete the parameter setting of the operator, a candidate strategy (that is, the first candidate strategy) is obtained.
  • the AI model generator 703 may perform sample training on the candidate strategies generated by the strategy generator 702 to generate candidate AI models.
  • the evaluator 704 may initialize a simulator component of the running platform 210 indicated by the platform instruction information, and use the simulator component to run a candidate AI model to obtain a first operating parameter. The evaluator 704 compares the parameter request information with the first operating parameter.
  • the code generator 705 If the parameter requirement information matches the first running parameter, the code generator 705 generates a model code according to the candidate AI model. If the parameter requirement information does not match the first operating parameter, a reward signal is fed back to the policy generator 702, and the candidate policy is adjusted by the policy generator 702, and then the AI candidate generator 703 performs sample training on the adjusted candidate policy to obtain a new Candidate AI model.
  • the reward signal carries difference information (such as the first difference information).
  • the embodiments of the present application provide a method for developing an AI model.
  • the development platform 200 When the development platform 200 generates the AI model, not only the platform instruction information but also the requirements for the performance parameters of the running platform 210 to run the AI model; therefore, the AI model generated by the development platform 210 conforms to the operating environment of the running platform 210. It is used to execute the first service, and the performance parameters meet the requirements of the parameter requirement information when the first service is executed.
  • the development platform 200 can automatically generate model code that can be run on the execution platform 210 according to different business requirements and operating environments, and deploy the model code on the execution platform 210.
  • the development platform 210 adjusts the first candidate strategy, it may not only refer to the first difference information (that is, the first operating parameter and the parameter requirement information). Difference information), and reference may also be made to difference information (ie, second difference information) between the third operating parameter and the first operating parameter obtained by executing the first business processing test data of the benchmark model.
  • FIG. 8A is a schematic diagram illustrating a principle framework of a method for developing an AI model provided by an embodiment of the present application.
  • the evaluator 704 determines that the first operating parameter does not match the operating parameter information, the evaluator 704 feeds back the reward signal to the policy generator 702.
  • the benchmark signal database 800 may also be included. Relevant information (such as the second difference information) of the operating parameters of the benchmark model (that is, the third operating parameters described above).
  • the benchmark model is obtained by the policy generator 702 from the benchmark model database 800 according to the first service indicated by the service instruction information.
  • the benchmark model is an AI model for executing a first service.
  • the benchmark model database 800 stores a plurality of AI models that can be used to process various types of business. These AI models can be run in the development platform 210 to execute the corresponding business. However, these AI models may not necessarily run in the operation platform 210. Therefore, in the embodiment of the present application, the development platform 200 may modify the benchmark model (that is, the AI model used to execute the first service in the benchmark model database 800) to obtain the above-mentioned target AI model.
  • the benchmark model that is, the AI model used to execute the first service in the benchmark model database 800
  • the benchmark model database 800 may use a model information table shown in Table 4 to store multiple AI models.
  • the benchmark model database 800 may store one or more AI models for performing the service.
  • the benchmark model database 800 may store one or more AI models (referred to as text recognition AI models) for performing text recognition services.
  • the benchmark model database 800 may store x text recognition AI models, y image recognition AI models, z natural language processing AI models, and the like.
  • the development platform 200 may select an AI model for executing the first service indicated by the service instruction information from the benchmark model database 800 as the benchmark model.
  • the embodiment of the present application also provides a method for developing an AI model.
  • the method in the embodiment of the present application may include S301-S308, S801-S802, S310-S313, and S803. This method first executes S301-S308, and then executes S801:
  • the development platform 200 obtains the second difference information.
  • the second difference information is used to indicate a difference between the first operating parameter and the third operating parameter.
  • the third operating parameter is an operating parameter obtained when the benchmark model executes the first service to process the test data.
  • the development platform 200 may run the benchmark model and execute the first business processing test data to obtain the third operating parameter. Wherein, after the development platform 200 runs the benchmark model to obtain the third operating parameter, the third operating parameter may be saved. In this way, after the development platform 200 adjusts the first candidate strategy to generate a new candidate AI model (such as the second candidate AI model), if the simulator component runs the second candidate AI model, the operating parameters (such as the above-mentioned second operating parameters) and parameters If the required information does not match, the development platform 200 can compare the second operating parameter with the saved third operating parameter without having to run the benchmark model again to obtain the third operating parameter.
  • a new candidate AI model such as the second candidate AI model
  • the operating parameters such as the above-mentioned second operating parameters
  • the development platform 200 adjusts the first candidate strategy according to the first difference information and the second difference information to obtain a second candidate strategy.
  • the method in the embodiment of the present application may further include the foregoing S310-S312.
  • S312 if the running performance parameters (second running parameters) of the second candidate model and the parameter requirement information match, S313 is performed; if they do not match, the method in the embodiment of the present application may further include S803:
  • the development platform 200 adjusts the second candidate strategy according to the difference information between the second operating parameter and the parameter requirement information, and the difference information between the second operating parameter and the third operating parameter, and samples the adjusted second candidate strategy.
  • the third candidate AI model is trained.
  • the development platform 200 may call a simulator component to run a third candidate AI model to obtain operating parameters. Then, the development platform 200 determines whether the operation parameter matches the parameter requirement information. If the running parameter matches the parameter requirement information, the development platform may generate model code that can be run on the running platform 210 according to the third candidate AI. If the operating parameter does not match the parameter requirement information, the development platform 200 may continue to adjust the third candidate strategy until the development platform 200 obtains an AI model that meets the requirements of the parameter requirement information.
  • the development platform 200 may modify an existing benchmarking model to generate an AI model that can be run on the operation platform 210 to execute the first service.
  • FIG. 8C shows a schematic diagram of a principle framework of an AI model development method provided by an embodiment of the present application.
  • the policy generator 702 selects a plurality of available operators from the operator database 700 according to the platform instruction information and service instruction information in the constraint library 701.
  • a business AI model's strategy structure is populated with available operators to generate new candidate strategies; instead, operators are randomly selected from multiple available operators according to the policy structure of the benchmark model, and randomly selected operators are used to replace the benchmark model, Operators that do not correspond to the operating platform, and adjust the parameters of each operator to obtain candidate strategies.
  • the embodiment of the present application also provides a method for developing an AI model.
  • the development method of the AI model can include S901-S916:
  • the development platform 200 obtains platform instruction information, service instruction information, and parameter requirement information of an AI model to be generated.
  • the development platform 200 selects a plurality of available operators corresponding to the operation platform 210 from the operator database and used to execute the first service.
  • S901 is the same as S301.
  • S902 is the same as S302.
  • the development platform 200 determines a benchmark model of the first service, and the benchmark model is an AI model for processing the first service.
  • the benchmark model database 800 includes one or more AI models for executing the first service indicated by the service instruction information.
  • the development platform 200 may randomly select an AI model from the one or more AI models (the AI model used to execute the first service in the benchmark model database 800) as the benchmark model.
  • the first service is a character recognition service.
  • the development platform 200 may randomly select a character recognition AI model from the character recognition AI models 1, the character recognition AI model 2 and the character recognition AI model x shown in Table 4 as a benchmark model.
  • the development platform 200 randomly selects operators from a plurality of available operators according to the policy structure of the benchmark model, and uses randomly selected operators to replace the operators in the benchmark model that do not correspond to the operating platform 210, and adjusts each Parameters to get the first candidate strategy.
  • the benchmark model 1000 is a benchmark model selected by the development platform for the first service.
  • the convolution operator 2 in the benchmark model 1000 shown in (a) of FIG. 10 the activation function operator k, the deconvolution operator 2 and the addition operator 2 do not correspond to the running platform 210. . That is, the convolution operator 2, the activation function operator k, the deconvolution operator 2, and the addition operator 2 shown in (a) in FIG. 10 cannot be operated on the operation platform 210.
  • the development platform 200 may randomly select a convolution operator, an activation function operator, a deconvolution operator, and a sum operator from the above available operators (as shown in the table of available operators shown in Table 2) to replace FIG. 10 Convolution operator 2 shown in (a), activation function operator k, deconvolution operator 2, and summation operator 2.
  • Convolution operator 2 shown in (a) activates function operator 1, deconvolution operator 1, and sum operator 1, and then uses convolution operator 1.
  • Replace convolution operator 2 shown in (a) of FIG. 10 use activation function operator 1 to replace activation function operator k shown in (a) of FIG. 10, and use deconvolution function operator 1 to replace the figure
  • the activation function operator 2 shown in (a) in FIG. 10 is replaced with the addition function operator 1 shown in (a) in FIG. 10, and the result shown in (b) in FIG. 10 is obtained.
  • the development platform 200 can also adjust parameters of each operator in the model 1001 shown in FIG. 10 (b).
  • the development platform 200 compresses the first candidate strategy by using a compression algorithm to obtain the compressed first candidate strategy.
  • S905 may refer to the method for compressing the first candidate strategy by the development platform 200 in the embodiment of the present application, which will not be repeated here in the embodiment of the present application. Among them, S905 is optional.
  • the development platform 200 performs sample training on the compressed first candidate strategy to obtain a first candidate AI model.
  • the development platform 200 invokes the simulator component of the operation platform 210, runs the first candidate AI model, executes the first business processing test data, and obtains the first operating parameters.
  • the development platform 200 determines whether the first operating parameter matches the parameter requirement information.
  • S907 is the same as S305.
  • S908 is the same as S306.
  • the development platform 200 executes S909; if the first operating parameter does not match the parameter requirement information, the development platform 200 executes S910:
  • the development platform 200 generates a model code that can be run on the execution platform 210 according to the first candidate AI model.
  • the development platform 200 may send the model code to the execution platform 210 after generating the model code.
  • S909 reference may be made to the description of S307 in the embodiment of the present application, which is not repeated in the embodiment of the present application.
  • the development platform 200 obtains first difference information and second difference information.
  • the first difference information is used to indicate a difference between the first operation parameter and the parameter requirement information
  • the second difference information is used to indicate the first operation parameter and the third operation parameter. The difference.
  • the above first candidate strategy is obtained by modifying the benchmarking model by the development platform 200; therefore, if the first operating parameter does not match the parameter requirement information, the development platform 200 may refer to the benchmarking model to execute the first business when the candidate strategy is regenerated.
  • the development platform 200 adjusts the first candidate strategy according to the first difference information and the second difference information to obtain a second candidate strategy.
  • the development platform 200 when the development platform 200 adjusts the first candidate strategy to obtain a new candidate strategy (such as the third candidate strategy), it may not only refer to the parameter requirement information and the first candidate AI model to execute the first business processing test data to obtain the operating parameters
  • the difference information (that is, the first difference information) can also be referred to the benchmark model to execute the first business processing test data to obtain the operating parameters and the first candidate AI model to execute the first business processing test data to obtain the operating parameter difference information (that is, the second difference information).
  • the development platform 200 performs sample training on the second candidate strategy to obtain a second candidate AI model.
  • the development platform 200 calls a simulator component of the running platform 210 to run the second candidate AI model to obtain a second running parameter.
  • S912 is the same as S310, and S913 is the same as S311.
  • the development platform 200 determines whether the second operating parameter matches the parameter requirement information.
  • the development platform may continue to execute S915. If the second running parameter does not match the parameter requirement information, it means that the second candidate AI model does not meet the requirements of the parameter requirement information, and the development platform may continue to execute S916:
  • the development platform 200 generates model code that can be run on the execution platform 210 according to the second candidate AI model.
  • the development platform 200 adjusts the second candidate strategy according to the difference information between the second operating parameter and the parameter requirement information, and the difference information between the second operating parameter and the third operating parameter, and samples the adjusted second candidate strategy.
  • the third candidate AI model is trained.
  • S915 is the same as S313.
  • S916 is the same as S314.
  • the embodiments of the present application provide a method for developing an AI model.
  • the development platform 200 may randomly select operators from a plurality of available operators according to the policy structure of the benchmark model, replace the operators in the benchmark model that do not correspond to the operating platform 210 with randomly selected operators, and adjust the parameters of each operator To get the first candidate strategy.
  • the benchmark model is an AI model for executing the first business, that is, when the development platform 200 generates the AI model, it refers to the platform instruction information.
  • the development platform 200 when the development platform 200 generates the AI model, reference is also made to the requirements for the performance parameters of the AI model run by the execution platform 210.
  • the AI model generated by the development platform 210 conforms to the operating environment of the operation platform 210 and can be used to execute the first service, and the performance parameters meet the requirements of the parameter requirement information when the first service is executed.
  • the development platform 200 can automatically generate model code that can be run on the execution platform 210 according to different business requirements and operating environments, and deploy the model code on the execution platform 210.
  • FIG. 11 illustrates an example of an AI model for performing OCR services provided by an embodiment of the present application.
  • the first service indicated by the service instruction information is an OCR service.
  • the operating platform indicated by the above platform instruction information is Huawei Mate10.
  • the parameter requirement information requires that the AI model to be generated (that is, the target AI model) recognize a line of text in less than or equal to 1 second (s), that is, the parameter requirement information requires that Huawei Mate10 runs the target AI model to process data at a speed of less than or equal to 1s / Line text.
  • the parameter requirement information requires that the storage space occupied by Huawei Mate10 to run the target AI model is less than or equal to 10 megabits (MB).
  • the parameter requirement information requires that the recall rate of the target AI model's recognition text is greater than or equal to 90%, and the parameter requirement information requires that the target AI model's recognition rate of the text is higher than or equal to 90%.
  • the recall rate of the recognized text of the target AI model refers to the proportion of the recognized text in the line of text when the target AI model recognizes a line of text. For example, suppose a line of text includes 10 Chinese characters. The target AI model recognizes 9 of the 10 Chinese characters, and the recall rate of the target AI model's recognized text is 90%.
  • the AI model 1100 of the OCR service may include: a convolution block 1101, a convolution block 1102, a convolution block 1103, a deconvolution operator 1104, a convolution block 1106, a sum operator 1107, and a deconvolution
  • the AI model 1100 of the OCR service processes the data of the OCR service according to the logic of processing the data corresponding to the direction corresponding to the arrow of the data flowing into each operator or convolution block as shown in FIG. 11.
  • the convolution block shown in FIG. 11 includes a plurality of convolution layers.
  • the convolution block 1101 may include convolution layers such as a convolution layer 1, a convolution layer 2, and a convolution layer N.
  • Each convolution layer may include a convolution operator, a deconvolution operator, a batch normalization operator, an activation function operator, and the like.
  • the convolution layer 1 may include a convolution operator, a deconvolution operator, a batch normalization operator, an activation function operator, and the like.
  • the AI model 1100 of the OCR service that calls the simulator component of Huawei Mate10 to run the OCR service processing data (such as a line of text) can obtain the following first operating parameters:
  • the processing speed is 800 milliseconds (ms)
  • running takes up 8MB of storage space
  • the recall rate of recognized text is 91%
  • the development platform 200 may generate a model code of the AI model 1100 of the OCR service.
  • the above-mentioned development platform 200 includes a hardware structure and / or a software module corresponding to each function.
  • the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is performed by hardware or computer software-driven hardware depends on the specific application of the technical solution and design constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules may be implemented in the form of hardware or software functional modules. It should be noted that the division of the modules in the embodiments of the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner.
  • FIG. 13 shows a possible structural diagram of a development platform involved in the foregoing embodiment.
  • the development platform 1300 includes a processor 1301, a memory 1302, and a plurality of simulator components (such as the simulator component 1303 and the simulator component 1304).
  • the simulator component 1303 is a simulator component of a running platform indicated by the platform instruction information.
  • the simulator component 1304 is a simulator component of other operating platforms.
  • the memory 1302, the simulator component 1303, and the processor 1301 are coupled.
  • the memory 1302 is configured to store computer program code; the computer program code includes computer instructions.
  • the processor 1301 executes the computer instructions, the processor 1301 is configured to support the development platform 1300 to execute S301-S304, S306-S310 in the foregoing method embodiment.
  • the simulator component 1303 is configured to support the development platform 1300 to execute S305, S311, S907, and S913 in the above method embodiment in response to the call of the processor 1301, and / or other processes for the technology described herein.
  • the simulator component 1303 can simulate a running environment of a running platform.
  • the processor 1301 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), and a field programmable gate. Array (Field Programmable Gate Array, FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.
  • the processor 1301 may further include an NPU. It may implement or execute various exemplary logical blocks, modules, and circuits described in connection with the present disclosure.
  • the processor may also be a combination that implements computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
  • the communication module may be a transceiver, a transceiver circuit, or a communication interface.
  • the above-mentioned memory 1302 may store the operator database and the benchmark model database described in the above embodiments.
  • the above-mentioned memory 1302 may further store an operation parameter, that is, a third operation parameter, of the benchmark model executing the first business process test data.
  • the unit modules in the development platform 1300 include, but are not limited to, a processor 1301, a memory 1302, and multiple simulator components.
  • the development platform 1300 may further include a communication interface (such as a radio frequency module, a Wi-Fi module, and a Bluetooth module), a display, and an audio module (including a microphone, a speaker, a receiver, and a headphone interface).
  • the memory 1302, a plurality of simulator components, a communication interface, a display, a microphone, a receiver, and a speaker may be coupled to the processor 1301 through a bus (thick black line shown in FIG. 13).
  • An embodiment of the present application further provides a computer storage medium.
  • the computer storage medium stores computer program code.
  • the processor 1301 executes the computer program code
  • the development platform 1300 executes any one of FIG. 3, FIG. 8B, or FIG.
  • the relevant method steps in the figure implement the method in the above embodiment.
  • the embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute the related method steps in any one of FIG. 3, FIG. 8B, or FIG. 9 to implement the above-mentioned embodiments. method.
  • the development platform 1300, computer storage medium, or computer program product provided in the embodiment of the present application is used to execute the corresponding methods provided above. Therefore, for the beneficial effects that can be achieved, reference may be made to the corresponding ones provided above. The beneficial effects in the method are not repeated here.
  • the disclosed apparatus and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the modules or units is only a logical function division.
  • multiple units or components may be divided.
  • the combination can either be integrated into another device, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium.
  • the technical solution of the embodiments of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution may be embodied in the form of a software product that is stored in a storage medium. Included are several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in the embodiments of the present application.
  • the foregoing storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请实施例公开了一种AI模型的开发方法及装置,涉及AI技术领域,可以在较低的成本下,开发出符合终端的运行环境以及性能要求的AI模型。具体方案为:开发平台获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息;从算子数据库中选择出与运行平台对应且用于执行第一业务的多个可用算子;从多个可用算子中选择算子并完成选择的算子的参数设置,生成第一候选策略;对第一候选策略进行样本训练得到第一候选AI模型;调用运行平台的模拟器组件运行第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;若第一运行参数与参数要求信息匹配,则确定第一候选AI模型为目标AI模型。

Description

一种AI模型的开发方法及装置 技术领域
本申请实施例涉及人工智能(artificial intelligence,AI)技术领域,尤其涉及一种AI模型的开发方法及装置。
背景技术
随着通信技术的发展和终端计算能力的增强,移动终端逐渐成为人们生活、娱乐、工作和学习中不可或缺的通用设备,扮演着个人智能助理的角色。AI是移动终端实现人工智能必不可少的技术。
传统的,云端可以针对不同的业务需求训练出多个AI模型。移动终端可以通过网络将待处理数据传输至云端的AI服务接口。云端通过相应的AI模型处理待处理数据,然后通过AI服务接口向移动终端传输处理结果。然而,随着人们对个人隐私的重视,AI模型端侧化的需求越来强烈。其中,AI模型的端侧化是指在移动终端中配置AI模型,由移动终端通过AI模型处理待处理数据。
一种方案中,可以在移动终端中搭载AI专用处理芯片,如神经网络计算单元(neural network processing unit,NPU)芯片,以及智能视频处理单元(Video Processing Unit,VPU)芯片等。但是,上述AI专用处理芯片的开发过程极其繁琐,且开发成本较大。
另一种方案中,可以在移动终端中配置云端的AI模型。但是,云端的AI模型通常会占用较大内存空间。并且,移动终端需要具备较强的计算能力,才可以通过该AI模型在较短的时间内得到处理结果。这样,AI模型则不能被广泛配置于移动终端中。即使一些方案中,可以尝试通过对AI模型的剪裁和压缩等技术降低AI模型的大小,提高AI模型的运算速度以降低对移动终端的要求。但是,不同的移动终端的系统不同,其所能够提供的AI模型的运行环境则不同,并且不同移动终端对AI模型的性能(如功耗、存储空间占用情况等)要求也不同。在上述方案中,需要业务能力较高的开发人员,针对每个终端的运行环境和对AI模型的性能要求,对多个AI模型逐个进行优化,调试难度大,开发成本较高。
发明内容
本申请实施例提供一种AI模型的开发方法及装置,可以在较低的成本下,开发出符合终端的运行环境以及性能要求的AI模型。
第一方面,本申请实施例提供一种AI模型的开发方法,该方法可以包括:开发平台获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息;其中,平台指示信息用于指示运行待生成的AI模型的运行平台,业务指示信息用于指示待生成的AI模型所要执行的第一业务,参数要求信息用于指示对待生成的AI模型的性能参数的要求;开发平台从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子;开发平台从多个可用算子中选择算子,并完成选择的算子的参数设置, 生成第一候选策略;开发平台对第一候选策略进行样本训练,得到第一候选AI模型;开发平台调用运行平台的模拟器组件,运行第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;若第一运行参数与参数要求信息匹配,开发平台确定第一候选AI模型为目标AI模型。
其中,由于开发平台生成AI模型时,不仅参考了平台指示信息,还参考了对运行平台运行AI模型的性能参数的要求;因此,开发平台生成的AI模型符合运行平台的运行环境,可以用于执行第一业务,并且执行第一业务时性能参数符合参数要求信息的要求。并且,可以由开发平台针对不同的业务需求和运行环境,自动生成能够在运行平台上运行的模型代码,并在运行平台部署该模型代码。
结合第一方面,在一种可能的设计方式中,开发平台确定第一候选AI模型为目标AI模型之后,可以根据第一候选AI模型,生成能够在运行平台运行的模型代码。开发平台可以向运行平台发送该模型代码。这样,运行平台便可以运行该模型代码,执行第一业务。
结合第一方面,在另一种可能的设计方式中,执行第一业务的AI模型的策略结构是一定的。开发平台在第一业务的策略结构中填充对应的算子得到第一候选策略。具体的,上述开发平台从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子的方法可以包括:开发平台根据所述第一业务,确定待生成的AI模型的策略结构;按照处理数据的逻辑,从算子数据库中选择出与运行平台对应的所述多个可用算子。其中,上述策略结构用于表征待生成的AI模型处理数据的逻辑,策略结构中按照处理数据的逻辑填充算子可以生成第一候选策略。上述开发平台从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略的方法可以包括:从多个可用算子中选择算子,在策略结构中填入选择的算子,完成选择的算子的参数设置,生成第一候选策略。
结合第一方面,在另一种可能的设计方式中,上述参数要求信息可以包括:参数要求信息包括:对运行平台运行待生成的AI模型的功耗的要求、对运行平台运行所述待生成的AI模型处理数据的准确率的要求、对运行平台运行所述待生成的AI模型处理数据的速度的要求,对待生成的AI模型占用存储空间的要求,以及对运行平台运行待生成的AI模型所需要的存储空间的要求中的至少一项。
结合第一方面,在另一种可能的设计方式中,上述第一运行参数可能与上述参数要求信息不匹配。若第一运行参数与所述参数要求信息不匹配,开发平台可以获取第一差异信息。该第一差异信息用于指示第一运行参数和参数要求信息的差异。然后,开发平台根据第一差异信息,调整第一候选策略中的算子,得到第二候选策略。开发平台对第二候选策略进行样本训练,得到第二候选AI模型。开发平台调用模拟器组件,运行第二候选AI模型,得到第二运行参数。若第二运行参数与参数要求信息匹配,开发平台确定第二候选AI模型为目标AI模型。
其中,开发平台判断第一运行参数与参数要求信息是否匹配,具体可以包括:开发平台判断运行平台的模拟器组件运行第一候选AI模型的功耗是否小于或者等于参数要求信息要求功耗,开发平台判断模拟器组件运行第一候选AI模型处理数据的准确率是否高于或者等于参数要求信息要求的准确率,开发平台判断模拟器组件运行第一 候选AI模型处理数据的速度是否高于或者等于参数要求信息要求的速度,开发平台判断模拟器组件运行第一候选AI模型所占用存储空间(即模拟器组件运行第一候选AI模型的运行内存)是否小于或者等于参数要求信息要求运行内存。其中,参数要求信息要求运行内存是参数要求信息要求运行平台运行第一候选AI模型所占用的存储空间。
如果模拟器组件运行第一候选AI模型的功耗小于或者等于参数要求信息要求功耗,模拟器组件运行第一候选AI模型处理数据的准确率高于或者等于参数要求信息要求的准确率,模拟器组件运行第一候选AI模型处理数据的速度高于或者等于参数要求信息要求的速度,且模拟器组件运行第一候选AI模型所占用存储空间小于或者等于参数要求信息要求的运行内存,则表示第一运行参数与参数要求信息匹配,第一候选AI模型符合上述参数要求信息的要求。如果第一运行参数与参数要求信息匹配。
如果第一运行参数不满足“模拟器组件运行第一候选AI模型的功耗小于或者等于参数要求信息要求功耗”、“模拟器组件运行第一候选AI模型处理数据的准确率高于或者等于参数要求信息要求的准确率”、“模拟器组件运行第一候选AI模型处理数据的速度高于或者等于参数要求信息要求的速度”和“模拟器组件运行第一候选AI模型所占用存储空间小于或者等于参数要求信息要求的运行内存”中的任一条件,则表示第一运行参数与参数要求信息不匹配。
如果第一运行参数与参数要求信息不匹配,开发平台可以获取第一运行参数和参数要求信息的差异(即第一差异信息),以便于根据第一差异信息调整第一候选策略,生产新的候选AI模型,直到开发平台得到符合参数要求信息的要求的AI模型。
结合第一方面,在另一种可能的设计方式中,开发平台可以修改已有的标杆模型,生成能够在运行平台运行以执行第一业务的AI模型。具体的,开发平台生成第一候选策略之前,可以确定第一业务的标杆模型,该标杆模型是用于处理第一业务的AI模型。在这种情况下,待生成的AI模型的策略结构为标杆模型的策略结构,策略结构用于表征标杆模型处理数据的逻辑。上述开发平台从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略的方法可以包括:开发平台按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台不对应的算子,并调整各个算子的参数,得到第一候选策略。
其中,开发平台可以按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台不对应的算子,并调整各个算子的参数,得到第一候选策略。其中,标杆模型是用于执行第一业务的AI模型,也就是说,开发平台生成AI模型时,参考了平台指示信息。并且,开发平台生成AI模型时,还参考了对运行平台运行AI模型的性能参数的要求。因此,开发平台生成的AI模型符合运行平台的运行环境,可以用于执行第一业务,并且执行第一业务时性能参数符合参数要求信息的要求。
并且,可以由开发平台针对不同的业务需求和运行环境,自动生成能够在运行平台上运行的模型代码,并在运行平台部署该模型代码。
结合第一方面,在另一种可能的设计方式中,如果第一运行参数与参数要求信息不匹配,开发平台210调整第一候选策略时,不仅可以参考上述第一差异信息(即第 一运行参数与参数要求信息的差异信息),还可以参考标杆模型执行第一业务处理测试数据得到的第三运行参数与第一运行参数的差异信息(即第二差异信息)。具体的,若第一运行参数与参数要求信息不匹配,开发平台获取第一差异信息和第二差异信息;开发平台根据第一差异信息和第二差异信息,调整第一候选策略中的算子,得到第二候选策略;开发平台对第二候选策略进行样本训练,得到第二候选AI模型;开发平台调用模拟器组件,运行第二候选AI模型,得到第二运行参数;若第二运行参数与参数要求信息匹配,开发平台确定第二候选AI模型为目标AI模型。
结合第一方面,在另一种可能的设计方式中,开发平台生成的第一候选策略可能并不满足上述参数要求信息的要求。例如,上述参数要求信息中至少可以包括:对待生成的AI模型占用存储空间的要求。第一候选策略所要占用的存储空间可能会大于参数要求信息中要求待生成的AI模型占用的存储空间。开发平台生成第一候选策略后,可以采用压缩算法压缩第一候选策略,得到压缩后的第一候选策略。相应的,开发平台对压缩后的第一候选策略进行样本训练,得到第一候选AI模型。
结合第一方面,在另一种可能的设计方式中,开发平台在生成第一候选策略后,可以对上述第一候选策略进行编码,得到第一候选策略的二进制数串。开发平台可以对第一候选策略的二进制数串进行样本训练,得到第一候选AI模型。
结合第一方面,在另一种可能的设计方式中,开发平台生成的第一候选策略可能并不满足上述参数要求信息的要求。例如,上述参数要求信息中至少可以包括:对待生成的AI模型占用存储空间的要求。基于此,开发平台在对第一候选策略进行样本训练之前,可以先判断第一候选策略是否满足预设条件。上述预设条件包括:第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求。其中,第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求,具体是指:第一候选策略所要占用的存储空间小于参数要求信息中要求待生成的AI模型占用的存储空间。开发平台可以对满足预设条件的第一候选策略进行样本训练,得到第一候选AI模型。
其中,开发平台在生成第一候选策略后,先判断第一候选策略是否满足预设条件;开发平台对满足预设条件的第一候选策略进行样本训练,得到第一候选AI模型。这样,可以降低开发平台根据不满足预设条件的第一候选策略生成不符合参数要求信息的要求的第一候选AI模型的可能性,提高开发平台生成符合要求的AI模型的效率。
第二方面,本申请实施例提供一种开发平台,该开发平台包括:处理器、存储器和多个模拟器组件;存储器、多个模拟器组件与处理器耦合;多个模拟器组件中包括运行平台的模拟器组件,存储器用于存储计算机程序代码;计算机程序代码包括计算机指令,当处理器执行上述计算机指令时,处理器,用于获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息,平台指示信息用于指示运行待生成的AI模型的运行平台,业务指示信息用于指示待生成的AI模型所要执行的第一业务,参数要求信息用于指示对待生成的AI模型的性能参数的要求;从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子,算子数据库中保存有多个用于生成AI模型的算子;从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;第一候选策略由多个算子组成;对第一候选策略进行样本训练,得到 第一候选AI模型;处理器,还用于调用多个模拟器组件中、运行平台的模拟器组件,运行第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;若第一运行参数与参数要求信息匹配,确定第一候选AI模型为目标AI模型。
结合第二方面,在一种可能的设计方式中,上述处理器,还用于在确定第一候选AI模型为目标AI模型之后,根据第一候选AI模型,生成能够在运行平台运行的模型代码。
结合第二方面,在另一种可能的设计方式中,上述处理器,用于从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子,包括:处理器,用于根据第一业务,确定待生成的AI模型的策略结构,策略结构用于表征待生成的AI模型处理数据的逻辑,策略结构中按照处理数据的逻辑填充算子生成第一候选策略;按照处理数据的逻辑,从算子数据库中选择出与运行平台对应的多个可用算子。上述处理器,用于从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:处理器,用于从多个可用算子中选择算子,在策略结构中填入选择的算子,完成选择的算子的参数设置,生成第一候选策略。
结合第二方面,在另一种可能的设计方式中,上述处理器,还用于若第一运行参数与参数要求信息不匹配,获取第一差异信息,第一差异信息用于指示第一运行参数和参数要求信息的差异;根据第一差异信息,调整第一候选策略中的算子,得到第二候选策略;对第二候选策略进行样本训练,得到第二候选AI模型。处理器,还用于调用运行平台的模拟器组件,运行第二候选AI模型,得到第二运行参数;若第二运行参数与参数要求信息匹配,确定第二候选AI模型为目标AI模型。
结合第二方面,在另一种可能的设计方式中,上述处理器,还用于在从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略之前,确定第一业务的标杆模型,标杆模型是用于处理第一业务的AI模型;其中,待生成的AI模型的策略结构为标杆模型的策略结构,策略结构用于表征标杆模型处理数据的逻辑。处理器,用于从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:处理器,用于按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台不对应的算子,并调整各个算子的参数,得到第一候选策略。
结合第二方面,在另一种可能的设计方式中,上述处理器,还用于若第一运行参数与参数要求信息不匹配,获取第一差异信息和第二差异信息;第一差异信息用于指示第一运行参数和参数要求信息的差异;第二差异信息用于指示第一运行参数和第三运行参数的差异,第三运行参数是标杆模型执行第一业务处理测试数据得到的运行参数;根据第一差异信息和第二差异信息,调整第一候选策略中的算子,得到第二候选策略;对第二候选策略进行样本训练,得到第二候选AI模型。处理器,还用于调用运行平台的模拟器组件,运行第二候选AI模型,得到第二运行参数;若第二运行参数与参数要求信息匹配,确定第二候选AI模型为目标AI模型。
结合第二方面,在另一种可能的设计方式中,上述处理器,还用于在生成第一候选策略之后,采用压缩算法压缩第一候选策略,得到压缩后的第一候选策略。处理器,用于对第一候选策略进行样本训练,得到第一候选AI模型,包括:处理器,用于对压 缩后的第一候选策略进行样本训练,得到第一候选AI模型。
结合第二方面,在另一种可能的设计方式中,上述处理器,还用于在生成第一候选策略之后,对第一候选策略进行编码,得到第一候选策略的二进制数串。处理器,用于对第一候选策略进行样本训练,得到第一候选AI模型,包括:处理器,用于对第一候选策略的二进制数串进行样本训练,得到第一候选AI模型。
结合第二方面,在另一种可能的设计方式中,上述参数要求信息包括:对运行平台运行待生成的AI模型的功耗的要求、对运行平台运行待生成的AI模型处理数据的准确率的要求、对运行平台运行待生成的AI模型处理数据的速度的要求,对待生成的AI模型占用存储空间的要求,以及对运行平台运行待生成的AI模型所需要的存储空间的要求中的至少一项。
结合第二方面,在另一种可能的设计方式中,上述参数要求信息至少包括:对待生成的AI模型占用存储空间的要求。处理器,还用于在对第一候选策略进行样本训练,得到第一候选AI模型之前,判断第一候选策略是否满足预设条件;预设条件包括:第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求。处理器,用于对第一候选策略进行样本训练,得到第一候选AI模型,包括:处理器,用于若第一候选策略满足预设条件,对第一候选策略进行样本训练,得到第一候选AI模型。
第三方面,本申请实施例提供一种开发平台,该开发平台包括:约束库、策略生成器、人工智能AI模型生成器、评价器、代码生成器和多个模拟器组件。其中,约束库,用于提供待生成的AI模型的平台指示信息、业务指示信息和参数要求信息,平台指示信息用于指示运行待生成的AI模型的运行平台,业务指示信息用于指示待生成的AI模型所要执行的第一业务,参数要求信息用于指示对待生成的AI模型的性能参数的要求。策略生成器,用于根据约束库提供的平台指示信息和业务指示信息,从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子,算子数据库中保存有多个用于生成AI模型的算子;从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;第一候选策略由多个算子组成。AI模型生成器,用于对策略生成器生成的第一候选策略进行样本训练,得到第一候选AI模型。评价器,用于调用运行平台的模拟器组件,运行AI模型生成器生成的第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;判断第一运行参数是否与参数要求信息匹配;运行平台的模拟器组件是多个模拟器组件中的一个。代码生成器,用于若评价器判断得到第一运行参数与参数要求信息匹配,则根据AI模型生成器生成的第一候选AI模型,生成能够在运行平台运行的模型代码。
结合第三方面,在一种可能的设计方式中,上述策略生成器,用于从算子数据库中选择出与运行平台对应,且用于执行第一业务的多个可用算子,包括:策略生成器,用于根据第一业务,确定待生成的AI模型的策略结构,策略结构用于表征待生成的AI模型处理数据的逻辑;按照处理数据的逻辑,从算子数据库中选择出与运行平台对应的多个可用算子。上述策略生成器,用于从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;第一候选策略由多个算子组成,包括:策略生成器,用于从多个可用算子中选择算子,在策略结构中填入选择的算子,完成选择 的算子的参数设置,生成第一候选策略。
结合第三方面,在另一种可能的设计方式中,上述评价器,还用于若第一运行参数与参数要求信息不匹配,获取第一差异信息,第一差异信息用于指示第一运行参数和参数要求信息的差异。策略生成器,还用于根据第一差异信息,调整第一候选策略中的算子,得到第二候选策略。AI模型生成器,还用于对策略生成器生成的第二候选策略进行样本训练,得到第二候选AI模型。评价器,还用于调用运行平台的模拟器组件,运行AI模型生成器生成的第二候选AI模型,得到第二运行参数;判断第二运行参数是否与参数要求信息匹配;运行平台的模拟器组件是多个模拟器组件中的一个。代码生成器,还用于若评价器判断得到第二运行参数与参数要求信息匹配,则根据AI模型生成器生成的第二候选AI模型,生成能够在运行平台运行的模型代码。
结合第三方面,在另一种可能的设计方式中,上述策略生成器,还用于在从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略之前,从标杆模型数据库中选择出第一业务的标杆模型,标杆模型是用于处理第一业务的AI模型;其中,待生成的AI模型的策略结构为标杆模型的策略结构,策略结构用于表征标杆模型处理数据的逻辑;标杆模型数据库中保存有多个AI模型。策略生成器,用于从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:策略生成器,用于按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台不对应的算子,并调整各个算子的参数,得到第一候选策略。
结合第三方面,在另一种可能的设计方式中,上述评价器,还用于若第一运行参数与参数要求信息不匹配,获取第一差异信息和第二差异信息,第一差异信息用于指示第一运行参数和参数要求信息的差异;第二差异信息用于指示第一运行参数和第三运行参数的差异,第三运行参数是标杆模型执行第一业务处理测试数据得到的运行参数。策略生成器,还用于根据第一差异信息和第二差异信息,调整第一候选策略中的算子,得到第二候选策略。AI模型生成器,还用于对策略生成器生成的第二候选策略进行样本训练,得到第二候选AI模型。评价器,还用于调用运行平台的模拟器组件,运行AI模型生成器生成的第二候选AI模型,得到第二运行参数;判断第二运行参数是否与参数要求信息匹配;运行平台的模拟器组件是多个模拟器组件中的一个。代码生成器,还用于若评价器判断得到第二运行参数与参数要求信息匹配,则根据AI模型生成器生成的第二候选AI模型,生成能够在运行平台运行的模型代码。
结合第三方面,在另一种可能的设计方式中,上述策略生成器,还用于在生成第一候选策略之后,采用压缩算法压缩第一候选策略,得到压缩后的第一候选策略。AI模型生成器,用于对策略生成器压缩后的第一候选策略进行样本训练,得到第一候选AI模型。
结合第三方面,在另一种可能的设计方式中,上述策略生成器,还用于在生成第一候选策略之后,对第一候选策略进行编码,得到第一候选策略的二进制数串。AI模型生成器,用于对第一候选策略的二进制数串进行样本训练,得到第一候选AI模型。
结合第三方面,在另一种可能的设计方式中,上述参数要求信息包括:对运行平台运行待生成的AI模型的功耗的要求、对运行平台运行待生成的AI模型处理数据的 准确率的要求、对运行平台运行待生成的AI模型处理数据的速度的要求,对待生成的AI模型占用存储空间的要求,以及对运行平台运行待生成的AI模型所需要的存储空间的要求中的至少一项。
结合第三方面,在另一种可能的设计方式中,上述参数要求信息至少包括:对待生成的AI模型占用存储空间的要求。AI模型生成器,还用于在对第一候选策略进行样本训练,得到第一候选AI模型之前,判断第一候选策略是否满足预设条件;预设条件包括:第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求。AI模型生成器,用于对第一候选策略进行样本训练,得到第一候选AI模型,包括:AI模型生成器,用于若第一候选策略满足预设条件,对第一候选策略进行样本训练,得到第一候选AI模型。
第四方面,本申请实施例提供一种计算机存储介质,该计算机存储介质包括计算机指令,当所述计算机指令在开发平台上运行时,使得所述开发平台执行如第一方面及其任一种可能的设计方式所述的AI模型的开发方法。
第五方面,本申请实施例提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如第一方面及其任一种可能的设计方式所述的AI模型的开发方法。
另外,第二方面和第三方面及其任一种设计方式所述的开发平台,以及第四方面所述的计算机存储介质、第五方面所述的计算机程序产品所带来的技术效果可参见上述第一方面及其不同设计方式所带来的技术效果,此处不再赘述。
附图说明
图1为本申请实施例提供的一种电子设备的硬件结构示意图;
图2为本申请实施例提供的一种AI模型的开发方法所应用的系统网络结构示意图;
图3为本申请实施例提供的一种AI模型的开发方法流程图一;
图4为本申请实施例提供的一种策略结构的实例示意图;
图5为本申请实施例提供的一种第一候选策略的实例示意图一;
图6为本申请实施例提供的一种第一候选策略的实例示意图二;
图7为本申请实施例提供的一种AI模型开发方法原理示意图一;
图8A为本申请实施例提供的一种AI模型开发方法原理示意图二;
图8B为本申请实施例提供的一种AI模型的开发方法流程图二;
图8C为本申请实施例提供的一种AI模型开发方法原理示意图三;
图9为本申请实施例提供的一种AI模型的开发方法流程图三;
图10为本申请实施例提供的一种标杆模型的实例示意图;
图11为本申请实施例提供的一种OCR业务的AI模型实例示意图;
图12为图11所示的OCR业务的AI模型中的卷积块和卷积层的结构实例示意图;
图13为本申请实施例提供的一种开发平台的结构组成示意图。
具体实施方式
本申请实施例提供一种AI模型的开发方法,可以应用于AI模型的开发过程中。具体的,开发平台可以根据待生成的AI模型的运行平台的指示信息(即平台 指示信息)、该AI模型所要处理的业务,以及对运行平台运行AI模型的性能参数的要求,生成AI模型。然后,开发平台可以根据已生成的AI模型,结合运行平台的指示信息,生成能够在该运行平台上运行的模型代码。其中,开发平台可以向运行平台(即终端)下发该模型代码,以在运行平台上部署该模型代码,使得运行平台可以执行该模型代码以运行AI模型。
其中,由于开发平台生成AI模型时,不仅参考了要运行AI模型的运行平台的指示信息,还参考了对运行平台运行AI模型的性能参数的要求;因此,开发平台生成的AI模型符合运行平台(即终端)的运行环境以及性能要求。并且,本申请实施例中,可以由开发平台针对不同的业务需求和运行环境,自动生成能够在该运行平台上运行的模型代码,并在运行平台部署该模型代码。
示例性的,本申请实施例中的开发平台可以为个人计算机(personal computer,PC)、笔记本电脑或者云服务器等具有较强的计算能力和存储能力的设备。本申请实施例中的运行平台可以为便携式计算机(如手机)、笔记本电脑、PC、可穿戴电子设备(如智能手表)、平板电脑、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、车载电脑等,以下实施例对该终端的具体形式不做特殊限制。
需要注意的是,开发平台中配置有运行平台的模拟器组件。开发平台可以在生成AI模型后,在运行平台的模拟器组件上模拟运行AI模型,以得到模拟器组件运行AI模型的性能参数。这样,开发平台便可以判断得到的性能参数是否符合对运行平台运行AI模型的性能参数的要求。
参考图1,其示出本申请实施例提供的运行平台的结构示意图。该运行平台可以为图1所示的电子设备100。该电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或 神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经 天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194 以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
NPU为神经网络(Neural-Network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。例如,NPU可以运行本申请实施例中的AI模型的模型代码,执行上述图像识别,人脸识别,语音识别,文本理解等业务。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。例如,存储器(如内部存储器121)可以用于保存AI模型的模型代码。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
请参考图2,其示出本申请实施例提供的一种开发平台和运行平台组成的系统架构示意图。如图2所示,该系统包括开发平台200和运行平台210。开发平台200可以执行本申请实施例提供的AI模型的开发方法生成AI模型的模型代码。开发平台200可以将生成的模型代码传输至运行平台210。运行平台210便可以执行该模型代码以运行AI模型。
本申请实施例提供一种AI模型的开发方法,应用于图2所示的开发平台200。如图3所示,该AI模型的开发方法可以包括:
S301、开发平台200获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息。
其中,平台指示信息用于指示运行待生成的AI模型的运行平台210。其中,平台指示信息可以为运行待生成的AI模型的运行平台210的标识。例如,平台指示信息可以指示运行待生成的AI模型的运行平台210为华为的Mate10。该平台指示信息可以为华为Mate10的标识。
业务指示信息用于指示待生成的AI模型所要执行的业务。其中,本申请实施例中的业务可以包括:文字识别、图像识别和自然语言处理等。例如,文字识别可以为光学字符识别(optical character recognition,OCR),图像识别可以为人脸识别。
上述参数要求信息用于指示对运行平台210运行待生成的AI模型的性能参数的要求。示例性的,该参数要求信息可以包括:对运行平台210运行待生成的AI模型的功耗的要求、对运行平台210运行待生成的AI模型处理数据的准确率的要求、对运行平台210运行待生成的AI模型处理数据的速度的要求,对待生成的AI模型占用存储空间的要求,以及对运行平台210运行待生成的AI模型所需要的存储空间的要求等中的至少一项。
在一种实现方式中,开发平台200可以为开发人员提供设置上述平台指示信息、业务指示信息和参数要求信息的设置界面。开发平台200显示该设置界面。该设置界面中可以包括多个设置选项。如运行平台的设置选项、业务的设置选项、功耗的设置选项、准确率的设置选项、速度的设置选项和存储空间的设置选项等。其中,运行平台的设置选项用于设置运行待生成的AI模型的运行平台。业务的设置选项用于设置待生成的AI模型所要处理的业务。功耗的设置选项用于设置对运行平台运行待生成的AI模型的功耗的要求。准确率的设置选项用于设置对运行平台运行待生成的AI模型处理数据的准确 率的要求。速度的设置选项用于设置对运行平台运行待生成的AI模型处理数据的速度的要求。存储空间的设置选项用于设置对运行平台运行待生成的AI模型所占用存储空间的要求。开发平台200可以接收用户在上述设置界面对各个设置选项的设置操作,得到上述平台指示信息、业务指示信息和参数要求信息。
在另一种实现方式中,开发平台200可以接收其他设备(如运行平台210)发送的平台指示信息、业务指示信息和参数要求信息。
S302、开发平台200从算子数据库中选择出与运行平台210对应,且用于执行第一业务的多个可用算子。算子数据库中保存有多个用于生成AI模型的算子。
示例性的,算子数据库可以按照算子的类型保存多个算子。按照算子的类型可以将多个算子分为:卷积(Convolution)算子、反卷积(deConv)算子、加和(Sum)算子、批标准化(Batch Normalization)算子、尺度变化(Scale)算子和激活函数(ReLu/Sigmoid)算子等。本申请实施例中的算子包括但不限于上述卷积算子、反卷积算子、加和算子、批标准化算子、尺度变化算子和激活函数算子。算子数据库中可以包括用于生成各种AI模型的算子。
例如,算子数据库可以采用表1所示的算子信息表的方式,保存多个算子。
表1
Figure PCTCN2018106566-appb-000001
Figure PCTCN2018106566-appb-000002
如表1所示,算子数据库中可以保存有卷积算子、反卷积算子、加和算子、批标准化算子、尺度变化算子和激活函数算子等多种算子。并且,算子数据库中针对每一种类型算子,保存了可以在不同运行平台运行的多个算子。例如,如表1所示,算子数据库中针对卷积算子,保存了可以在运行平台210运行卷积算子1和卷积算子4,可以在运行平台b运行卷积算子1,以及可以在运行平台c运行的卷积算子2和卷积算子3等。
需要说明的是,本申请实施例中的算子数据库可以保存在开发平台200中。或者,算子数据库可以保存在云服务器中。开发平台200可以读取云服务器中的算子数据库中的数据,以从算子数据库中选择多个可用算子。
示例性的,以平台指示信息指示的运行平台为运行平台210,业务指示信息指示的第一业务为业务a为例。请参考表2所示的可用算子表。如表2所示,假设用于执行业务a的可用算子包括:卷积算子、反卷积算子、加和算子和激活函数算子。由表1可知:如表2所示,算子数据库中与运行平台210对应的卷积算子包括卷积算子1和卷积算子4,即卷积算子1和卷积算子4可以在运行平台210运行;算子数据库中与运行平台210对应的反卷积算子包括反卷积算子1和反卷积算子n,即反卷积算子1和反卷积算子n可以在运行平台210运行;算子数据库中与运行平台210对应的加和算子包括加和算子1和加和算子3,即加和算子1和加和算子3可以在运行平台210运行;算子数据库中与运行平台210对应的激活函数算子包括激活函数算子1,即激活函数算子1可以在运行平台210运行。
表2
Figure PCTCN2018106566-appb-000003
其中,执行每个业务的AI模型的策略结构是一定的。示例性的,假设业务指示信息用于指示待生成的AI模型所要处理的业务为业务a。开发平台200在根据业务指示信息确定该业务a后,便可以确定执行该业务a的AI模型的策略结构,即待生成的AI模型的策略结构。AI模型的策略结构可以表征AI模型执行业务时处理数据的逻辑。
请参考图4,其示出执行业务a的AI模型的策略结构实例示意图。图4所示的策略结构400由卷积算子、反卷积算子、加和算子和激活函数算子组成。图4所示的策略结构400所表征的AI模型处理数据的逻辑为:一个卷积算子(卷积算子X)处理数据401(待处理的数据)输出数据402;另一个卷积算子(卷积算子K)处理数据402输出数据404;激活函数算子处理数据402得到数据403;反卷积算子处理数据403得到数据405;加和算子处理数据404和数据405得到数据406;另一个卷积算子(卷积算子Y)处理数据406得到处理结果。
开发平台200在确定执行第一业务(如业务a)的AI模型的策略结构后,可以按照该策略结构所表征的处理数据的逻辑,从算子数据库中选择出与运行平台210对应的多个可用算子。例如,开发平台200在确定业务a的AI模型的策略结构为图4所示的策略结构400后,可以确定图4所示的策略结构400由卷积算子、反卷积算子、加和算子和激活函数算子组成。然后,开发平台可以从算子数据库中选择出与运行平台210对应的多个卷积算子、反卷积算子、加和算子和激活函数算子。例如,开发平台200可以从表1所示的多个算子中选择出表2所示的多个可用算子。
S303、开发平台200从多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略。
其中,上述第一候选策略由多个算子组成。该第一候选策略用于表征待生成的AI模型处理数据的逻辑。
开发平台200可以确定执行第一业务的AI模型的策略结构。然后,开发平台200可以从上述多个可用算子中随机选择算子,并将选择的算子填充至该策略结构中,完成选择的算子的参数,便可以得到第一候选策略。其中,开发平台200根据平台指示信息从多个可用算子中选择算子,并完成选择的算子的参数设置,可以生成一个或多个第一候选策略。
结合上述实例,开发平台200可以从表2所示的可用算子中随机选择算子,并将选择的算子填充至图4所示的策略结构400中。
例如,开发平台200可以随机选择表2中的卷积算子1填充在图4所示的卷积算子X中,选择表2中的卷积算子4填充在图4所示的卷积算子K中,选择表2中的激活函数算子1填充在图4所示的激活函数算子中,选择表2中的反卷积算子1填充在图4所示的反卷积算子中,选择表2中的加和算子1填充在图4所示的加和算子中,选择表2中的卷积算子4填充在图4所示的卷积算子Y中,得到图5所示的第一候选策略500。
又例如,开发平台200可以随机选择表2中的卷积算子4填充在图4所示的卷积算子X中,选择表2中的卷积算子4填充在图4所示的卷积算子K中,选择表2中的激活函数算子1填充在图4所示的激活函数算子中,选择表2中的反卷积算子n填充在图4所示的反卷积算子中,选择表2中的加和算子3填充在图4所示的加和算子中,选择表2中的卷积算子4填充在图4所示的卷积算子Y中,得到图6所示的第一候选策略600。
开发平台200在策略结构中填充算子后,可以完成算子的参数设置。其中,开发平台200可以随机设置填充在策略结构中的算子的参数。示例性的,以卷积算子为例,卷积算子的参数可以是卷积算子的卷积核尺寸。例如,例如,开发平台200可以将图5所示的卷积算子1的卷积核尺寸设置为2*2,即图5所示的卷积算子1可以对输入该卷积算子1的数据执行2*2的卷积运算。
S304、开发平台200对第一候选策略进行样本训练,得到第一候选AI模型。
其中,开发平台200中针对各个业务,可以保存多个用于进行样本训练的样本数据,开发平台200可以根据第一业务对应的样本数据,对第一候选策略进行样本训练得到第一候选AI模型。例如,假设第一业务是OCR业务,上述样本数据可以为大量的文字及其文字图样。开发平台200根据OCR业务的样本数据对第一候选策略进行样本训练后得到的第一候选AI模型,可以将文字图样与对应的文字联系起来。这样,第一候选AI模型便可以识别文字图样,确定出对应的文字。
开发平台200根据样本数据对第一候选策略进行样本训练,得到第一候选AI模型的方法,可以参考常规技术中,开发平台对候选策略进行样本训练得到AI模型的方法,本申请实施例这里不予赘述。
开发平台200生成第一候选策略后,可以采用压缩算法压缩第一候选策略,得到压缩后的第一候选策略。相应的,开发平台200对压缩后的第一候选策略进行样本训练,得到第一候选AI模型。
本申请实施例中,开发平台200在生成第一候选策略后,可以对上述第一候选策略进行编码,得到第一候选策略的二进制数串。开发平台200可以对第一候选策略的二进制数串进行样本训练,得到第一候选AI模型。
可选的,开发平台200生成的第一候选策略(或者开发平台200压缩后的第一候选策略)可能并不满足上述参数要求信息的要求。例如,上述参数要求信息中至少可以包括:对待生成的AI模型占用存储空间的要求。基于此,开发平台200在对第一候选策略(或者压缩后的第一候选策略)进行样本训练之前,可以先判断第一候选策略是否满足预设条件。本申请实施例这里将第一候选策略和压缩后的第一候选策略统称为第一候选策略。该预设条件包括:第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求。其中,第一候选策略所需的存储空间满足参数要求信息对待生成的AI模型占用存储空间的要求,具体是指:第一候选策略所要占用的存储空间小于参数要求信息中要求待生成的AI模型占用的存储空间。开发平台200可以对满足预设条件的第一候选策略进行样本训练,得到第一候选AI模型。其中,本申请实施例中,待生成的AI模型占用存储空间是指运行平台210保存该待生成的AI模型的模型代码时,该模型代码所要占用的存储空间。
开发平台200可以生成一个或多个第一候选策略。在开发平台200生成一个第一候选策略的情况下,如果该第一候选策略不满足预设条件,开发平台200则可以生成新的候选策略。在开发平台200生成多个第一候选策略的情况下,开发平台200可以对这多个第一候选策略中满足预设条件的第一候选策略进行样本训练,得到第一候选AI模型。如果这多个第一候选策略都不满足预设条件,那么开发平台200则可以生成新的候选策略。
S305、开发平台200调用运行平台210的模拟器组件,运行第一候选AI模型执行第 一业务处理测试数据,得到第一运行参数。
其中,第一运行参数可以包括:运行平台210的模拟器组件(AI Model Simulator)运行第一候选AI模型的功耗、模拟器组件运行第一候选AI模型处理数据的准确率、模拟器组件运行第一候选AI模型处理数据的速度,以及模拟器组件运行第一候选AI模型所占用存储空间的大小中的至少一项。可以理解地,开发平台得到的第一运行参数和上述参数要求信息相对应,例如:上述参数要求信息中包括了对运行平台运行待生成的AI模型的功耗的要求、对运行平台运行待生成的AI模型处理数据的准确率的要求,则第一运行参数中相应地包括运行平台的模拟器组件(AI Model Simulator)运行第一候选AI模型的功耗、模拟器组件运行第一候选AI模型处理数据的准确率。
在一种实现方式中,开发平台200中可以保存多个运行平台210的模拟器组件。开发平台200调用运行平台210的模拟器组件之前,可以先确定出上述平台指示信息所指示的运行平台210;然后,初始化该运行平台210的模拟器组件。
在另一种实现方式中,运行平台210的模拟器组件可以保存在云端服务器中。云端服务器中可以保存多个运行平台210的模拟器组件。开发平台200可以向云端服务器发送上述平台指示信息、上述业务指示信息和第一候选AI模型。云端服务器接收到平台指示信息、业务指示信息和第一候选AI模型后,可以先确定出上述平台指示信息所指示的运行平台210;然后,初始化该运行平台210的模拟器组件,调用该模拟器组件运行第一候选AI模型执行上述业务指示信息指示的第一业务处理测试数据,得到第一运行参数;最后,云端服务器可以向开发平台200发送该第一运行参数;开发平台200可以接收云端服务器发送的第一运行参数。
S306、开发平台200判断第一运行参数与参数要求信息是否匹配。
其中,开发平台200判断第一运行参数与参数要求信息是否匹配,根据参数要求信息的设置,得到相应地第一运行参数,将两者进行比较,具体可以包括以下至少一项:开发平台200判断运行平台210的模拟器组件运行第一候选AI模型的功耗是否小于或者等于参数要求信息要求功耗,开发平台200判断模拟器组件运行第一候选AI模型处理数据的准确率是否高于或者等于参数要求信息要求的准确率,开发平台200判断模拟器组件运行第一候选AI模型处理数据的速度是否高于或者等于参数要求信息要求的速度,开发平台200判断模拟器组件运行第一候选AI模型所占用存储空间(即模拟器组件运行第一候选AI模型的运行内存)是否小于或者等于参数要求信息要求运行内存。其中,参数要求信息要求运行内存是参数要求信息要求运行平台210运行第一候选AI模型所占用的存储空间。可以理解地,此处参数要求信息可以包括对待生成的AI模型占用存储空间的要求,第一运行参数可以包括第一候选AI模型的占用存储空间的大小,则步骤S306中包括开发平台200判断第一候选AI模型的占用存储空间的大小是否小于或等于参数要求信息要求的存储空间的要求。可以理解地,此处第一运行参数可以不包括第一候选AI模型的占用存储空间的大小。此处参数要求信息中对于待生成的AI模型占用存储空间的要求可以通过对第一候选策略所需存储空间大小进行判断是否满足,如步骤S304中的相关描述。
如果模拟器组件运行第一候选AI模型的功耗小于或者等于参数要求信息要求功耗,模拟器组件运行第一候选AI模型处理数据的准确率高于或者等于参数要求信息要求的准确率,模拟器组件运行第一候选AI模型处理数据的速度高于或者等于参数要求信息要求的速 度,且模拟器组件运行第一候选AI模型所占用存储空间小于或者等于参数要求信息要求的运行内存,则表示第一运行参数与参数要求信息匹配,第一候选AI模型符合上述参数要求信息的要求。如果第一运行参数与参数要求信息匹配,开发平台则可以继续执行S307。
如果第一运行参数不满足“模拟器组件运行第一候选AI模型的功耗小于或者等于参数要求信息要求功耗”、“模拟器组件运行第一候选AI模型处理数据的准确率高于或者等于参数要求信息要求的准确率”、“模拟器组件运行第一候选AI模型处理数据的速度高于或者等于参数要求信息要求的速度”和“模拟器组件运行第一候选AI模型所占用存储空间小于或者等于参数要求信息要求的运行内存”中的任一条件,则表示第一运行参数与参数要求信息不匹配,第一候选AI模型不符合上述参数要求信息的要求。如果第一运行参数与参数要求信息不匹配,开发平台则可以继续执行S308。
S307、开发平台200根据第一候选AI模型,生成能够在运行平台210运行的模型代码。
其中,如果第一运行参数与参数要求信息匹配,开发平台200则可以确定第一候选AI模型是目标AI模型。开发平台200可以根据第一候选AI模型(即目标AI模型),生成能够在运行平台210运行的模型代码。开发平台200可以在生成模型代码后,向运行平台210发送模型代码。其中,开发平台200可以按照平台指示信息所指示的运行平台210,根据第一候选AI模型生成能够在运行平台210运行的模型代码。该模型代码部署到运行平台210后,运行平台210便可以执行该模型代码,以运行对应的AI模型。也就是说,本申请实施例中,开发平台200生成的AI模型可以一键部署到运行平台210(即终端)中。
S308、开发平台200获取第一差异信息。第一差异信息用于指示第一运行参数和参数要求信息的差异。
如果第一运行参数与参数要求信息不匹配,则表示第一候选AI模型不符合上述参数要求信息的要求。在这种情况下,开发平台200可以获取第一运行参数和参数要求信息的差异(即第一差异信息),以便于根据第一差异信息调整第一候选策略。
示例性的,如表3所示,为本申请实施例示出的一种运行参数表实例。
表3
Figure PCTCN2018106566-appb-000004
如表3所示,要求的参数是指参数要求信息要求运行平台210运行待生成的AI模型时所要达到的参数,模拟参数是指运行平台210的模拟器组件运行第一候选AI模型时的参数。例如,假设参数要求信息要求功耗为A,参数要求信息要求的准确率 为B,参数要求信息要求的速度为C,参数要求信息要求运行占用的存储空间大小为D。如果模拟器组件运行第一候选AI模型的功耗为a,模拟器组件运行第一候选AI模型处理数据的准确率为b,模拟器组件运行第一候选AI模型处理数据的速度为c,模拟器组件运行第一候选AI模型所占用存储空间的大小为d;那么,上述第一差异信息则可以为:功耗差异A-a,准确率差异B-b,速度差异C-c,存储空间差异D-d。
S309、开发平台200根据第一差异信息,调整第一候选策略,得到第二候选策略。
其中,开发平台200可以采用预设算法根据第一差异信息调整第一候选策略,得到第二候选策略。例如,该预设算法可以为多目标基因算法(Multi-Objective evolutionary algorithm,MOEA)或者梯度下降算法等。
本申请实施例中,开发平台200调整第一候选策略,可以包括:开发平台200采用可用算子替换第一候选策略中对应的算子。例如,开发平台200可以采用表2中的加和算子3替换图5所示的第一候选策略500中的加和算子1。开发平台200调整第一候选策略,还可以包括:开发平台200调整第一候选策略中算子的参数。例如,开发平台200可以将图5所示的第一候选策略500中的卷积算子1的卷积核尺寸由2*2调成为3*3,使得卷积算子1可以对输入该卷积算子1的数据执行3*3的卷积运算。
S310、开发平台200对第二候选策略进行样本训练,得到第二候选AI模型。
其中,S310的详细描述可以参考本申请实施例对S304的介绍,本申请实施例这里不再赘述。
S311、开发平台200调用运行平台210的模拟器组件,运行第二候选AI模型,得到第二运行参数,第二运行参数为模拟器运行第二候选AI模型的性能参数。
其中,S311的详细描述可以参考本申请实施例对S305的介绍,本申请实施例这里不再赘述。
S312、开发平台200判断第二运行参数与参数要求信息是否匹配。
其中,S312的详细描述可以参考本申请实施例对S306的介绍,本申请实施例这里不再赘述。
其中,如果第二运行参数与参数要求信息匹配,则表示第二候选AI模型符合上述参数要求信息的要求,开发平台则可以继续执行S313。如果第二运行参数与参数要求信息不匹配,则表示第二候选AI模型不符合上述参数要求信息的要求,开发平台则可以继续执行S314:
S313、开发平台200根据第二候选AI模型,生成能够在运行平台210运行的模型代码。
S314、开发平台200根据第二运行参数和参数要求信息的差异信息,调整第二候选策略,并对调整后的第二候选策略进行样本训练得到第三候选AI模型。
本申请实施例中,开发平台200可以调用模拟器组件,运行第三候选AI模型,得到运行参数。然后,开发平台200判断该运行参数与参数要求信息是否匹配。如果该运行参数与参数要求信息匹配,开发平台则可以根据第三候选AI生成能够在运行平台210运行的模型代码。如果该运行参数与参数要求信息不匹配,开发平台200则可以继续调整第二候选策略,直到开发平台200得到符合参数要求信息的要求的AI模型。
其中,S312-S314的详细描述可以参考本申请实施例对S306-S310的介绍,本申请实施例这里不再赘述。
请参考图7,其示出了本申请实施例提供的一种AI模型的开发方法的原理框架示意图。如图7所示,开发平台200可以划分为5个模块:约束库701、策略生成器702、AI模型生成器703、评价器704和代码生成器705。约束库701可以获取对待生成的AI模型的约束条件,即上述平台指示信息、业务指示信息和参数要求信息。策略生成器702可以根据约束库701中的平台指示信息和业务指示信息,从算子数据库700中选择出多个可用算子;然后,将选择出的可用算子填充至执行业务指示信息所指示的第一业务的AI模型的策略结构中,并完成算子的参数设置,得到候选策略(即第一候选策略)。AI模型生成器703可以对策略生成器702生成的候选策略进行样本训练,生成候选AI模型。评价器704可以初始化平台指示信息所指示的运行平台210的模拟器组件,采用该模拟器组件运行候选AI模型,得到第一运行参数。评价器704对比参数要求信息和第一运行参数。如果参数要求信息与第一运行参数匹配,则由代码生成器705根据候选AI模型生成模型代码。如果参数要求信息与第一运行参数不匹配,则向策略生成器702反馈reward信号,由策略生成器702调整候选策略,然后由AI模型生成器703对调整后的候选策略进行样本训练,得到新的候选AI模型。reward信号中携带差异信息(如第一差异信息)。
本申请实施例提供一种AI模型的开发方法。由于开发平台200生成AI模型时,不仅参考了平台指示信息,还参考了对运行平台210运行AI模型的性能参数的要求;因此,开发平台210生成的AI模型符合运行平台210的运行环境,可以用于执行第一业务,并且执行第一业务时性能参数符合参数要求信息的要求。
并且,可以由开发平台200针对不同的业务需求和运行环境,自动生成能够在运行平台210上运行的模型代码,并在运行平台210部署该模型代码。
在本申请另一实施例中,如果第一运行参数与参数要求信息不匹配,开发平台210调整第一候选策略时,不仅可以参考上述第一差异信息(即第一运行参数与参数要求信息的差异信息),还可以参考标杆模型执行第一业务处理测试数据得到的第三运行参数与第一运行参数的差异信息(即第二差异信息)。
请参考图8A,其示出了本申请实施例提供的一种AI模型的开发方法的原理框架示意图。如图8A所示,与图7不同的是:如果评价器704确定第一运行参数与运行参数信息不匹配,评价器704向策略生成器702反馈reward信号中还可以包括标杆模型数据库800中的标杆模型的运行参数(即上述第三运行参数)的相关信息(如第二差异信息)。其中,标杆模型是策略生成器702根据业务指示信息所指示的第一业务从标杆模型数据库800中获取的。其中,该标杆模型是用于执行第一业务的AI模型。
其中,标杆模型数据库800中保存了多个可以用于处理各类业务的AI模型。这些AI模型可以在开发平台210中运行以执行对应的业务。但是,这些AI模型不一定可以在运行平台210中运行。因此,本申请实施例中,开发平台200可以修改标杆模型(即标杆模型数据库800中用于执行第一业务的AI模型),以得到上述目标AI模型。
例如,标杆模型数据库800可以采用表4所示的模型信息表的方式,保存多个AI模型。
表4
Figure PCTCN2018106566-appb-000005
Figure PCTCN2018106566-appb-000006
其中,针对每一种业务,标杆模型数据库800可以保存一个或多个用于执行该业务的AI模型。例如,标杆模型数据库800可以保存一个或多个用于执行文字识别业务的AI模型(简称文字识别AI模型)。
示例性的,如表4所示,标杆模型数据库800中可以保存有x个文字识别AI模型、y个图像识别AI模型和z个自然语言处理AI模型等。开发平台200可以从标杆模型数据库800中选择用于执行业务指示信息所指示的第一业务的AI模型,作为标杆模型。
本申请实施例还提供一种AI模型的开发方法。如图8B所示,本申请实施例的方法可以包括S301-S308、S801-S802、S310-S313和S803。该方法先执行S301-S308,然后执行S801:
S801、开发平台200获取第二差异信息。第二差异信息用于指示第一运行参数与第三运行参数的差异。第三运行参数是标杆模型执行第一业务处理上述测试数据得到的运行参数。
开发平台200可以运行标杆模型执行第一业务处理测试数据得到上述第三运行参数。其中,开发平台200运行标杆模型得到第三运行参数后,可以保存该第三运行参数。这样,开发平台200调整第一候选策略生成新的候选AI模型(如第二候选AI模型)后,如果模拟器组件运行第二候选AI模型得到的运行参数(如上述第二运行参数)与参数要求信息不匹配,开发平台200便可以对比第二运行参数和保存的第三运行参数,而不需要再次运行标杆模型以获取第三运行参数。
S802、开发平台200根据第一差异信息和第二差异信息,调整第一候选策略,得到第二候选策略。
在S802之后,本申请实施例的方法还可以包括上述S310-S312。在S312之后,如果第二候选模型的运行的性能参数(第二运行参数)和参数要求信息匹配就执行S313;如果不匹配,本申请实施例的方法还可以包括S803:
S803、开发平台200根据第二运行参数和参数要求信息的差异信息,以及第二运行参数和上述第三运行参数的差异信息,调整第二候选策略,并对调整后的第二候选 策略进行样本训练得到第三候选AI模型。
本申请实施例中,开发平台200可以调用模拟器组件,运行第三候选AI模型,得到运行参数。然后,开发平台200判断该运行参数与参数要求信息是否匹配。如果该运行参数与参数要求信息匹配,开发平台则可以根据第三候选AI生成能够在运行平台210运行的模型代码。如果该运行参数与参数要求信息不匹配,开发平台200则可以继续调整第三候选策略,直到开发平台200得到符合参数要求信息的要求的AI模型。
在本申请另一实施例中,开发平台200可以修改已有的标杆模型,生成能够在运行平台210运行以执行第一业务的AI模型。请参考图8C,其示出了本申请实施例提供的一种AI模型的开发方法的原理框架示意图。如图8C所示,与图8A不同的是:策略生成器702根据约束库701中的平台指示信息和业务指示信息,从算子数据库700中选择出多个可用算子后,不需要在第一业务的AI模型的策略结构中填充可用算子生成新的候选策略;而是按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台不对应的算子,并调整各个算子的参数,得到候选策略。
本申请实施例还提供一种AI模型的开发方法。如图9所示,该AI模型的开发方法可以包括S901-S916:
S901、开发平台200获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息。
S902、开发平台200从算子数据库中选择出与运行平台210对应,且用于执行第一业务的多个可用算子。
其中,S901与S301相同。S902与S302相同。
S903、开发平台200确定第一业务的标杆模型,标杆模型是用于处理第一业务的AI模型。
其中,标杆模型数据库800中包括一个或多个用于执行业务指示信息所指示的第一业务的AI模型。开发平台200可以从这一个或多个AI模型(标杆模型数据库800中用于执行第一业务的AI模型)中随机选择一个AI模型,作为标杆模型。例如,假设第一业务为文字识别业务。开发平台200可以从表4所示的文字识别AI模型1、文字识别AI模型2和文字识别AI模型x等文字识别AI模型中,随机选择一个文字识别AI模型,作为标杆模型。
S904、开发平台200按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台210不对应的算子,并调整各个算子的参数,得到第一候选策略。
示例性的,如图10中的(a)所示,标杆模型1000为开发平台为第一业务选择的标杆模型。参考表2可知:图10中的(a)所示的标杆模型1000中的卷积算子2,激活函数算子k、反卷积算子2和加和算子2与运行平台210不对应。即图10中的(a)所示的卷积算子2,激活函数算子k、反卷积算子2和加和算子2不能在运行平台210运行。
开发平台200可以从上述可用算子(如表2所示的可用算子表中)随机选择出卷积算子、激活函数算子、反卷积算子和加和算子,来替换图10中的(a)所示的卷积 算子2,激活函数算子k、反卷积算子2和加和算子2。例如,假设开发平台200从表2所示的可用算子表中选择卷积算子1,激活函数算子1、反卷积算子1和加和算子1,然后采用卷积算子1替换图10中的(a)所示的卷积算子2,采用激活函数算子1替换图10中的(a)所示的激活函数算子k,采用反卷积函数算子1替换图10中的(a)所示的激活函数算子2,采用加和函数算子1替换图10中的(a)所示的加和算子2,得到图10中的(b)所示的模型1001。并且,开发平台200还可以调整图10中的(b)所示的模型1001中各个算子的参数。
S905、开发平台200采用压缩算法压缩第一候选策略,得到压缩后的第一候选策略。
其中,S905的详细描述可以参考本申请实施例中开发平台200压缩第一候选策略的方法,本申请实施例这里不再赘述。其中,S905是可选的。
S906、开发平台200对压缩后的第一候选策略进行样本训练,得到第一候选AI模型。
S907、开发平台200调用运行平台210的模拟器组件,运行第一候选AI模型执行第一业务处理测试数据,得到第一运行参数。
S908、开发平台200判断第一运行参数与参数要求信息是否匹配。
其中,S907与S305相同。S908与S306相同。
具体的,如果第一运行参数与参数要求信息匹配,开发平台200则执行S909;如果第一运行参数与参数要求信息不匹配,开发平台200则执行S910:
S909、开发平台200根据第一候选AI模型,生成能够在运行平台210运行的模型代码。
开发平台200可以在生成模型代码后,向运行平台210发送模型代码。其中,S909的详细描述可以参考本申请实施例对S307的介绍,本申请实施例这里不再赘述。
S910、开发平台200获取第一差异信息和第二差异信息,第一差异信息用于指示第一运行参数和参数要求信息的差异,第二差异信息用于指示第一运行参数与第三运行参数的差异。
由于上述第一候选策略是开发平台200修改标杆模型得到的;因此,如果第一运行参数与参数要求信息不匹配,那么开发平台200在重新生成候选策略时,则可以参考标杆模型执行第一业务处理测试数据得到运行参数(即第三运行参数)与第一候选AI模型执行第一业务处理测试数据得到运行参数(即第一运行参数)的差异。这样,可以更加快速的生成符合参数要求信息的要求的AI模型。
S911、开发平台200根据第一差异信息和第二差异信息,调整第一候选策略,得到第二候选策略。
本申请实施例中,开发平台200调整第一候选策略得到新的候选策略(如第三候选策略)时,不仅可以参考参数要求信息与第一候选AI模型执行第一业务处理测试数据得到运行参数的差异信息(即第一差异信息),还可以参考标杆模型执行第一业务处理测试数据得到运行参数与第一候选AI模型执行第一业务处理测试数据得到运行参数的差异信息(即第二差异信息)。
S912、开发平台200对第二候选策略进行样本训练,得到第二候选AI模型。
S913、开发平台200调用运行平台210的模拟器组件,运行第二候选AI模型,得到第二运行参数。
其中,S912与S310相同,S913与S311相同。
S914、开发平台200判断第二运行参数与参数要求信息是否匹配。
其中,如果第二运行参数与参数要求信息匹配,则表示第三候选AI模型符合上述参数要求信息的要求,开发平台则可以继续执行S915。如果第二运行参数与参数要求信息不匹配,则表示第二候选AI模型不符合上述参数要求信息的要求,开发平台则可以继续执行S916:
S915、开发平台200根据第二候选AI模型,生成能够在运行平台210运行的模型代码。
S916、开发平台200根据第二运行参数和参数要求信息的差异信息,以及第二运行参数和上述第三运行参数的差异信息,调整第二候选策略,并对调整后的第二候选策略进行样本训练得到第三候选AI模型。
其中,S915与S313相同。S916与S314相同。
本申请实施例提供一种AI模型的开发方法。开发平台200可以按照标杆模型的策略结构从多个可用算子中随机选择算子,采用随机选择的算子替换标杆模型中、与运行平台210不对应的算子,并调整各个算子的参数,得到第一候选策略。其中,标杆模型是用于执行第一业务的AI模型,也就是说,开发平台200生成AI模型时,参考了平台指示信息。并且,开发平台200生成AI模型时,还参考了对运行平台210运行AI模型的性能参数的要求。因此,开发平台210生成的AI模型符合运行平台210的运行环境,可以用于执行第一业务,并且执行第一业务时性能参数符合参数要求信息的要求。并且,可以由开发平台200针对不同的业务需求和运行环境,自动生成能够在运行平台210上运行的模型代码,并在运行平台210部署该模型代码。
示例性的,请参考图11,其示出本申请实施例提供的一种用于执行OCR业务的AI模型实例。假设上述业务指示信息指示的第一业务为OCR业务。上述平台指示信息指示的运行平台为华为Mate10。参数要求信息要求待生成的AI模型(即目标AI模型)识别一行文本的时间小于或者等于1秒(s),即参数要求信息要求华为Mate10运行目标AI模型处理数据的速度为:小于或等于1s/行文本。参数要求信息要求华为Mate10运行目标AI模型所占用存储空间小于或等于10兆比特(MB)。参数要求信息要求目标AI模型识别文本的召回率高于或者等于90%,参数要求信息要求目标AI模型识别文本的准确率高于或者等于90%。
其中,目标AI模型识别文本的召回率是指目标AI模型识别一行文本时,识别出的文本在这行文本中的占比。例如,假设一行文本包括10个汉字。目标AI模型识别出这10个汉字中的9个汉字,那么目标AI模型识别文本的召回率则为90%。目标AI模型识别文本的准确率是指目标AI模型识别一行文本时,正确识别出的文本在识别出的文本中的占比。例如,假设一行文本包括10个汉字。目标AI模型识别出这10个汉字中的9个汉字,识别出的9个汉字中有8个汉字的识别结果是正确的,1个汉字的识别结果是错误的。那么目标AI模型识别文本的准确率则为(8/9)*100%=88.89%。
如图11所示,OCR业务的AI模型1100可以包括:卷积块1101、卷积块1102、 卷积块1103、反卷积算子1104、卷积块1106、加和算子1107、反卷积算子1108、卷积块1105、加和算子1109、卷积块1110、卷积块1111和卷积块1112。其中,OCR业务的AI模型1100按照以如图11所示的数据流入各个算子或者卷积块的箭头对应的方向对应的处理数据的逻辑处理OCR业务的数据。
其中,图11所示的卷积块中包括多个卷积层。例如,以卷积块1101为例。如图12中的(a)所示,卷积块1101可以包括卷积层1、卷积层2和卷积层N等卷积层。每个卷积层可以包括卷积算子、反卷积算子、批标准化算子和激活函数算子等。例如,如图12中的(b)所示,卷积层1可以包括卷积算子、反卷积算子、批标准化算子和激活函数算子等。
开发平台200生成图11所示的OCR业务的AI模型1100后,调用华为Mate10的模拟器组件运行OCR业务的AI模型1100执行OCR业务处理数据(如一行文本)可以得到如下第一运行参数:小于处理速度800毫秒(ms),运行占用存储空间8MB,识别文本的召回率91%,识别文本的准确率90%。由于800ms<1s,8MB<10MB,91%>90%,90%=90%;因此,图11所示的OCR业务的AI模型1100是目标AI模型。开发平台200可以生成OCR业务的AI模型1100的模型代码。
可以理解的是,上述开发平台200为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
本申请实施例可以根据上述方法示例对上述开发平台200进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用集成的单元的情况下,图13示出了上述实施例中所涉及的开发平台的一种可能的结构示意图。该开发平台1300包括:处理器1301、存储器1302和多个模拟器组件(如模拟器组件1303和模拟器组件1304)。其中,模拟器组件1303是平台指示信息指示的运行平台的模拟器组件。模拟器组件1304是其他运行平台的模拟器组件。存储器1302、模拟器组件1303与处理器1301耦合。存储器1302用于存储计算机程序代码;该计算机程序代码包括计算机指令,当处理器1301执行上述计算机指令时,处理器1301用于支持开发平台1300执行上述方法实施例中的S301-S304、S306-S310、S312-S314、S801-S803、S901-S906、S908-912、S914-S916,和/或用于本文所描述的技术的其它过程。模拟器组件1303用于响应于处理器1301的调用,支持开发平台1300执行上述方法实施例中的S305、S311、S907、S913,和/或用于本文所描述的技术的其它过程。
其中,上述模拟器组件1303可以模拟运行平台的运行环境。上述处理器1301可以是中央处理器(Central Processing Unit,CPU),通用处理器,数字信号处理器(Digital Signal Processor,DSP),专用集成电路(Application-Specific Integrated Circuit,ASIC),现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。上述处理器1301还可以包括NPU。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等等。通信模块可以是收发器、收发电路或通信接口等。
可选的,上述存储器1302中可以保存上述实施例中所述的算子数据库和标杆模型数据库。上述存储器1302中还可以保存标杆模型执行第一业务处理测试数据的运行参数,即第三运行参数。
当然,开发平台1300中的单元模块包括但不限于处理器1301、存储器1302和多个模拟器组件。例如,开发平台1300中还可以包括通信接口(如射频模块、Wi-Fi模块和蓝牙模块等通信模块)、显示器、音频模块(包括麦克风、扬声器、受话器和耳机接口)。其中,上述存储器1302、多个模拟器组件、通信接口、显示器、麦克风、受话器和扬声器可以通过总线(图13所示的粗黑线)与处理器1301耦合在一起。
本申请实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机程序代码,当上述处理器1301执行该计算机程序代码时,开发平台1300执行图3、图8B或图9任一附图中的相关方法步骤实现上述实施例中的方法。
本申请实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行图3、图8B或图9任一附图中的相关方法步骤实现上述实施例中的方法。
其中,本申请实施例提供的开发平台1300、计算机存储介质或者计算机程序产品均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成 的单元既可以使用硬件的形式实现,也可以使用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (31)

  1. 一种人工智能AI模型的开发方法,其特征在于,包括:
    开发平台获取待生成的AI模型的平台指示信息、业务指示信息和参数要求信息,所述平台指示信息用于指示运行所述待生成的AI模型的运行平台,所述业务指示信息用于指示所述待生成的AI模型所要执行的第一业务,所述参数要求信息用于指示对所述待生成的AI模型的性能参数的要求;
    所述开发平台从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,所述算子数据库中保存有多个用于生成AI模型的算子;
    所述开发平台从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成;
    所述开发平台对所述第一候选策略进行样本训练,得到第一候选AI模型;
    所述开发平台调用所述运行平台的模拟器组件,运行所述第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;
    若所述第一运行参数与所述参数要求信息匹配,所述开发平台确定所述第一候选AI模型为目标AI模型。
  2. 根据权利要求1所述的AI模型的开发方法,其特征在于,在所述开发平台确定所述第一候选AI模型为目标AI模型之后,所述方法还包括:
    所述开发平台根据所述第一候选AI模型,生成能够在所述运行平台运行的模型代码。
  3. 根据权利要求1或2所述的AI模型的开发方法,其特征在于,所述开发平台从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,包括:
    所述开发平台根据所述第一业务,确定所述待生成的AI模型的策略结构,所述策略结构用于表征所述待生成的AI模型处理数据的逻辑;
    所述开发平台按照所述处理数据的逻辑,从所述算子数据库中选择出与所述运行平台对应的所述多个可用算子;
    所述开发平台从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成,包括:
    所述开发平台从所述多个可用算子中选择算子,在所述策略结构中填入选择的算子,完成选择的算子的参数设置,生成所述第一候选策略。
  4. 根据权利要求1-3中任意一项所述的AI模型的开发方法,其特征在于,所述方法还包括:
    若所述第一运行参数与所述参数要求信息不匹配,所述开发平台获取第一差异信息,所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;
    所述开发平台根据所述第一差异信息,调整所述第一候选策略中的算子,得到第二候选策略;
    所述开发平台对所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述开发平台调用所述模拟器组件,运行所述第二候选AI模型,得到第二运行参数;
    若所述第二运行参数与所述参数要求信息匹配,所述开发平台确定所述第二候选AI模型为目标AI模型。
  5. 根据权利要求1-3中任意一项所述的AI模型的开发方法,其特征在于,在所述开发平台从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略之前,所述方法还包括:
    所述开发平台确定所述第一业务的标杆模型,所述标杆模型是用于处理所述第一业务的AI模型;其中,所述待生成的AI模型的策略结构为所述标杆模型的策略结构,所述策略结构用于表征所述标杆模型处理数据的逻辑;
    所述开发平台从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:
    所述开发平台按照所述标杆模型的策略结构从所述多个可用算子中随机选择算子,采用随机选择的算子替换所述标杆模型中、与所述运行平台不对应的算子,并调整各个算子的参数,得到所述第一候选策略。
  6. 根据权利要求1-3或5中任意一项所述的AI模型的开发方法,其特征在于,所述方法还包括:
    若所述第一运行参数与所述参数要求信息不匹配,所述开发平台获取第一差异信息和第二差异信息;所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;所述第二差异信息用于指示所述第一运行参数和第三运行参数的差异,所述第三运行参数是标杆模型执行所述第一业务处理所述测试数据得到的运行参数;
    所述开发平台根据所述第一差异信息和所述第二差异信息,调整所述第一候选策略中的算子,得到第二候选策略;
    所述开发平台对所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述开发平台调用所述模拟器组件,运行所述第二候选AI模型,得到第二运行参数;
    若所述第二运行参数与所述参数要求信息匹配,所述开发平台确定所述第二候选AI模型为目标AI模型。
  7. 根据权利要求1-6中任意一项所述的AI模型的开发方法,其特征在于,在所述生成第一候选策略之后,所述方法还包括:
    所述开发平台采用压缩算法压缩所述第一候选策略,得到压缩后的第一候选策略;
    其中,所述开发平台对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述开发平台对压缩后的第一候选策略进行样本训练,得到所述第一候选AI模型。
  8. 根据权利要求1-7中任意一项所述的AI模型的开发方法,其特征在于,在所述生成第一候选策略之后,所述方法还包括:
    所述开发平台对所述第一候选策略进行编码,得到所述第一候选策略的二进制数串;
    其中,所述开发平台对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述开发平台对所述第一候选策略的二进制数串进行样本训练,得到所述第一候 选AI模型。
  9. 根据权利要求1-8中任意一项所述的AI模型的开发方法,其特征在于,所述参数要求信息包括:对所述运行平台运行所述待生成的AI模型的功耗的要求、对所述运行平台运行所述待生成的AI模型处理数据的准确率的要求、对所述运行平台运行所述待生成的AI模型处理数据的速度的要求,对所述待生成的AI模型占用存储空间的要求,以及对所述运行平台运行所述待生成的AI模型所需要的存储空间的要求中的至少一项。
  10. 根据权利要求9所述的AI模型的开发方法,其特征在于,所述参数要求信息至少包括:对所述待生成的AI模型占用存储空间的要求;
    在所述开发平台对所述第一候选策略进行样本训练,得到第一候选AI模型之前,所述方法还包括:
    所述开发平台判断所述第一候选策略是否满足预设条件;所述预设条件包括:所述第一候选策略所需的存储空间满足所述参数要求信息对所述待生成的AI模型占用存储空间的要求;
    其中,所述开发平台对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    若所述第一候选策略满足所述预设条件,所述开发平台对所述第一候选策略进行样本训练,得到所述第一候选AI模型。
  11. 一种开发平台,其特征在于,所述开发平台包括:处理器、存储器和多个模拟器组件;所述存储器、所述多个模拟器组件与所述处理器耦合;所述多个模拟器组件中包括运行平台的模拟器组件,所述存储器用于存储计算机程序代码;所述计算机程序代码包括计算机指令,当所述处理器执行上述计算机指令时,
    所述处理器,用于获取待生成的人工智能AI模型的平台指示信息、业务指示信息和参数要求信息,所述平台指示信息用于指示运行所述待生成的AI模型的运行平台,所述业务指示信息用于指示所述待生成的AI模型所要执行的第一业务,所述参数要求信息用于指示对所述待生成的AI模型的性能参数的要求;从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,所述算子数据库中保存有多个用于生成AI模型的算子;从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成;对所述第一候选策略进行样本训练,得到第一候选AI模型;
    所述处理器,还用于调用所述多个模拟器组件中、所述运行平台的模拟器组件,运行所述第一候选AI模型执行所述第一业务处理测试数据,得到第一运行参数;若所述第一运行参数与所述参数要求信息匹配,确定所述第一候选AI模型为目标AI模型。
  12. 根据权利要求11所述的开发平台,其特征在于,所述处理器,还用于在确定所述第一候选AI模型为所述目标AI模型之后,根据所述第一候选AI模型,生成能够在所述运行平台运行的模型代码。
  13. 根据权利要求11或12所述的开发平台,其特征在于,所述处理器,用于从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,包括:
    所述处理器,用于根据所述第一业务,确定所述待生成的AI模型的策略结构,所述策略结构用于表征所述待生成的AI模型处理数据的逻辑,所述策略结构中按照所述处理数据的逻辑填充算子生成所述第一候选策略;按照所述处理数据的逻辑,从所述算子数据库中选择出与所述运行平台对应的所述多个可用算子;
    所述处理器,用于从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成,包括:
    所述处理器,用于从所述多个可用算子中选择算子,在所述策略结构中填入选择的算子,完成选择的算子的参数设置,生成所述第一候选策略。
  14. 根据权利要求11-13中任意一项所述的开发平台,其特征在于,所述处理器,还用于若所述第一运行参数与所述参数要求信息不匹配,获取第一差异信息,所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;根据所述第一差异信息,调整所述第一候选策略中的算子,得到第二候选策略;对所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述处理器,还用于调用所述运行平台的模拟器组件,运行所述第二候选AI模型,得到第二运行参数;若所述第二运行参数与所述参数要求信息匹配,确定所述第二候选AI模型为目标AI模型。
  15. 根据权利要求11-13中任意一项所述的开发平台,其特征在于,所述处理器,还用于在从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略之前,确定所述第一业务的标杆模型,所述标杆模型是用于处理所述第一业务的AI模型;其中,所述待生成的AI模型的策略结构为所述标杆模型的策略结构,所述策略结构用于表征所述标杆模型处理数据的逻辑;
    所述处理器,用于从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:
    所述处理器,用于按照所述标杆模型的策略结构从所述多个可用算子中随机选择算子,采用随机选择的算子替换所述标杆模型中、与所述运行平台不对应的算子,并调整各个算子的参数,得到所述第一候选策略。
  16. 根据权利要求11-13或15中任意一项所述的开发平台,其特征在于,所述处理器,还用于若所述第一运行参数与所述参数要求信息不匹配,获取第一差异信息和第二差异信息;所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;所述第二差异信息用于指示所述第一运行参数和第三运行参数的差异,所述第三运行参数是标杆模型执行所述第一业务处理所述测试数据得到的运行参数;根据所述第一差异信息和所述第二差异信息,调整所述第一候选策略中的算子,得到第二候选策略;对所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述处理器,还用于调用所述运行平台的模拟器组件,运行所述第二候选AI模型,得到第二运行参数;若所述第二运行参数与所述参数要求信息匹配,确定所述第二候选AI模型为目标AI模型。
  17. 根据权利要求11-16中任意一项所述的开发平台,其特征在于,所述处理器,还用于在生成所述第一候选策略之后,采用压缩算法压缩所述第一候选策略,得到压缩后的第一候选策略;
    所述处理器,用于对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述处理器,用于对压缩后的第一候选策略进行样本训练,得到所述第一候选AI模型。
  18. 根据权利要求11-17中任意一项所述的开发平台,其特征在于,所述处理器,还用于在生成所述第一候选策略之后,对所述第一候选策略进行编码,得到所述第一候选策略的二进制数串;
    所述处理器,用于对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述处理器,用于对所述第一候选策略的二进制数串进行样本训练,得到所述第一候选AI模型。
  19. 根据权利要求11-18中任意一项所述的开发平台,其特征在于,所述参数要求信息包括:对所述运行平台运行所述待生成的AI模型的功耗的要求、对所述运行平台运行所述待生成的AI模型处理数据的准确率的要求、对所述运行平台运行所述待生成的AI模型处理数据的速度的要求,对所述待生成的AI模型占用存储空间的要求,以及对所述运行平台运行所述待生成的AI模型所需要的存储空间的要求中的至少一项。
  20. 根据权利要求19所述的开发平台,其特征在于,所述参数要求信息至少包括:对所述待生成的AI模型占用存储空间的要求;
    所述处理器,还用于在对所述第一候选策略进行样本训练,得到第一候选AI模型之前,判断所述第一候选策略是否满足预设条件;所述预设条件包括:所述第一候选策略所需的存储空间满足所述参数要求信息对所述待生成的AI模型所占用存储空间的要求;
    所述处理器,用于对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述处理器,用于若所述第一候选策略满足所述预设条件,对所述第一候选策略进行样本训练,得到所述第一候选AI模型。
  21. 一种开发平台,其特征在于,包括:约束库、策略生成器、人工智能AI模型生成器、评价器、代码生成器和多个模拟器组件;
    所述约束库,用于提供待生成的AI模型的平台指示信息、业务指示信息和参数要求信息,所述平台指示信息用于指示运行所述待生成的AI模型的运行平台,所述业务指示信息用于指示所述待生成的AI模型所要执行的第一业务,所述参数要求信息用于指示对所述待生成的AI模型的性能参数的要求;
    所述策略生成器,用于根据所述约束库提供的所述平台指示信息和所述业务指示信息,从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,所述算子数据库中保存有多个用于生成AI模型的算子;从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成;
    所述AI模型生成器,用于对所述策略生成器生成的所述第一候选策略进行样本训 练,得到第一候选AI模型;
    所述评价器,用于调用所述运行平台的模拟器组件,运行所述AI模型生成器生成的所述第一候选AI模型执行第一业务处理测试数据,得到第一运行参数;判断所述第一运行参数是否与所述约束库提供的所述参数要求信息匹配;所述运行平台的模拟器组件是多个模拟器组件中的一个;
    所述代码生成器,用于若所述评价器判断得到所述第一运行参数与所述参数要求信息匹配,则根据所述AI模型生成器生成的所述第一候选AI模型,生成能够在所述运行平台运行的模型代码。
  22. 根据权利要求21所述的开发平台,其特征在于,所述策略生成器,用于从算子数据库中选择出与所述运行平台对应,且用于执行所述第一业务的多个可用算子,包括:
    所述策略生成器,用于根据所述第一业务,确定所述待生成的AI模型的策略结构,所述策略结构用于表征所述待生成的AI模型处理数据的逻辑;按照所述处理数据的逻辑,从所述算子数据库中选择出与所述运行平台对应的所述多个可用算子;
    所述策略生成器,用于从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略;所述第一候选策略由多个算子组成,包括:
    所述策略生成器,用于从所述多个可用算子中选择算子,在所述策略结构中填入选择的算子,完成选择的算子的参数设置,生成所述第一候选策略。
  23. 根据权利要求21或22所述的开发平台,其特征在于,所述评价器,还用于若所述第一运行参数与所述参数要求信息不匹配,获取第一差异信息,所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;
    所述策略生成器,还用于根据所述第一差异信息,调整所述第一候选策略中的算子,得到第二候选策略;
    所述AI模型生成器,还用于对所述策略生成器生成的所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述评价器,还用于调用所述运行平台的模拟器组件,运行所述AI模型生成器生成的所述第二候选AI模型,得到第二运行参数;判断所述第二运行参数是否与所述参数要求信息匹配;所述运行平台的模拟器组件是多个模拟器组件中的一个;
    所述代码生成器,还用于若所述评价器判断得到所述第二运行参数与所述参数要求信息匹配,则根据所述AI模型生成器生成的所述第二候选AI模型,生成能够在所述运行平台运行的模型代码。
  24. 根据权利要求21-23中任意一项所述的开发平台,其特征在于,所述策略生成器,还用于在从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略之前,从标杆模型数据库中选择出所述第一业务的标杆模型,所述标杆模型是用于处理所述第一业务的AI模型;其中,所述待生成的AI模型的策略结构为所述标杆模型的策略结构,所述策略结构用于表征所述标杆模型处理数据的逻辑;所述标杆模型数据库中保存有多个AI模型;
    所述策略生成器,用于从所述多个可用算子中选择算子,并完成选择的算子的参数设置,生成第一候选策略,包括:
    所述策略生成器,用于按照所述标杆模型的策略结构从所述多个可用算子中随机选择算子,采用随机选择的算子替换所述标杆模型中、与所述运行平台不对应的算子,并调整各个算子的参数,得到所述第一候选策略。
  25. 根据权利要求21、22或24中任意一项所述的开发平台,其特征在于,所述评价器,还用于若所述第一运行参数与所述参数要求信息不匹配,获取第一差异信息和第二差异信息,所述第一差异信息用于指示所述第一运行参数和所述参数要求信息的差异;所述第二差异信息用于指示所述第一运行参数和第三运行参数的差异,所述第三运行参数是标杆模型执行所述第一业务处理所述测试数据得到的运行参数;
    所述策略生成器,还用于根据所述第一差异信息和所述第二差异信息,调整所述第一候选策略中的算子,得到第二候选策略;
    所述AI模型生成器,还用于对所述策略生成器生成的所述第二候选策略进行样本训练,得到第二候选AI模型;
    所述评价器,还用于调用所述运行平台的模拟器组件,运行所述AI模型生成器生成的所述第二候选AI模型,得到第二运行参数;判断所述第二运行参数是否与所述参数要求信息匹配;所述运行平台的模拟器组件是多个模拟器组件中的一个;
    所述代码生成器,还用于若所述评价器判断得到所述第二运行参数与所述参数要求信息匹配,则根据所述AI模型生成器生成的所述第二候选AI模型,生成能够在所述运行平台运行的模型代码。
  26. 根据权利要求21-25中任意一项所述的开发平台,其特征在于,所述策略生成器,还用于在生成所述第一候选策略之后,采用压缩算法压缩所述第一候选策略,得到压缩后的第一候选策略;
    所述AI模型生成器,用于对所述策略生成器压缩后的第一候选策略进行样本训练,得到所述第一候选AI模型。
  27. 根据权利要求21-26中任意一项所述的开发平台,其特征在于,所述策略生成器,还用于在生成所述第一候选策略之后,对所述第一候选策略进行编码,得到所述第一候选策略的二进制数串;
    所述AI模型生成器,用于对所述第一候选策略的二进制数串进行样本训练,得到所述第一候选AI模型。
  28. 根据权利要求21-27中任意一项所述的开发平台,其特征在于,所述参数要求信息包括:对所述运行平台运行所述待生成的AI模型的功耗的要求、对所述运行平台运行所述待生成的AI模型处理数据的准确率的要求、对所述运行平台运行所述待生成的AI模型处理数据的速度的要求,对所述待生成的AI模型占用存储空间的要求,以及对所述运行平台运行所述待生成的AI模型所需要的存储空间的要求中的至少一项。
  29. 根据权利要求28所述的开发平台,其特征在于,所述参数要求信息至少包括:对所述待生成的AI模型占用存储空间的要求;
    所述AI模型生成器,还用于在对所述第一候选策略进行样本训练,得到所述第一候选AI模型之前,判断所述第一候选策略是否满足预设条件;所述预设条件包括:所述第一候选策略所需的存储空间满足所述参数要求信息对所述待生成的AI模型占用 存储空间的要求;
    所述AI模型生成器,用于对所述第一候选策略进行样本训练,得到第一候选AI模型,包括:
    所述AI模型生成器,用于若所述第一候选策略满足所述预设条件,对所述第一候选策略进行样本训练,得到所述第一候选AI模型。
  30. 一种计算机存储介质,其特征在于,所述计算机存储介质包括计算机指令,当所述计算机指令在开发平台上运行时,使得所述开发平台执行如权利要求1-10中任意一项所述的AI模型的开发方法。
  31. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-10中任意一项所述的AI模型的开发方法。
PCT/CN2018/106566 2018-09-19 2018-09-19 一种ai模型的开发方法及装置 WO2020056647A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201880074664.9A CN111357014B (zh) 2018-09-19 2018-09-19 一种ai模型的开发方法及装置
PCT/CN2018/106566 WO2020056647A1 (zh) 2018-09-19 2018-09-19 一种ai模型的开发方法及装置
EP18933825.4A EP3836021B1 (en) 2018-09-19 2018-09-19 Ai model development method and device
US17/276,949 US20220036236A1 (en) 2018-09-19 2018-09-19 Ai model development method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/106566 WO2020056647A1 (zh) 2018-09-19 2018-09-19 一种ai模型的开发方法及装置

Publications (1)

Publication Number Publication Date
WO2020056647A1 true WO2020056647A1 (zh) 2020-03-26

Family

ID=69888118

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/106566 WO2020056647A1 (zh) 2018-09-19 2018-09-19 一种ai模型的开发方法及装置

Country Status (4)

Country Link
US (1) US20220036236A1 (zh)
EP (1) EP3836021B1 (zh)
CN (1) CN111357014B (zh)
WO (1) WO2020056647A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112101529A (zh) * 2020-10-14 2020-12-18 杭州海康威视数字技术股份有限公司 一种用于神经网络模型推理跨平台的部署方法及架构
WO2022021199A1 (zh) * 2020-07-30 2022-02-03 华为技术有限公司 一种神经网络模型构建方法及其设备
CN114444338A (zh) * 2022-04-11 2022-05-06 北京瑞莱智慧科技有限公司 Ai模型组合快速轻量级验证的方法、装置及存储介质
CN112101529B (zh) * 2020-10-14 2024-06-21 杭州海康威视数字技术股份有限公司 一种用于神经网络模型推理跨平台的部署方法及架构

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112949061B (zh) * 2021-03-01 2023-11-10 北京清华同衡规划设计研究院有限公司 基于可复用算子的村镇发展模型构建方法和系统
CN113723437B (zh) * 2021-04-02 2022-06-07 荣耀终端有限公司 一种ai模型的自动化训练方法及ai模型训练系统
CN115222025B (zh) * 2021-04-16 2024-06-07 广东高云半导体科技股份有限公司 人工智能模型部署和人工智能运算方法、系统
CN116634553A (zh) * 2022-02-10 2023-08-22 维沃移动通信有限公司 信息处理方法及通信设备
US11815934B1 (en) * 2022-04-21 2023-11-14 Microsoft Technology Licensing, Llc. Coding activity task (CAT) evaluation for source code generators
CN117751563A (zh) * 2022-07-22 2024-03-22 北京小米移动软件有限公司 异构人工智能ai框架的模型交互方法、装置及系统
CN117908847A (zh) * 2024-01-19 2024-04-19 北京三维天地科技股份有限公司 一种可编程式ai开发平台

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120077158A1 (en) * 2010-09-28 2012-03-29 Government Of The United States, As Represented By The Secretary Of The Air Force Predictive Performance Optimizer
CN106547871A (zh) * 2016-10-31 2017-03-29 北京百度网讯科技有限公司 基于神经网络的搜索结果的召回方法和装置
CN106548210A (zh) * 2016-10-31 2017-03-29 腾讯科技(深圳)有限公司 机器学习模型训练方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10261760B1 (en) * 2013-12-05 2019-04-16 The Mathworks, Inc. Systems and methods for tracing performance information from hardware realizations to models
WO2018033137A1 (zh) * 2016-08-19 2018-02-22 北京市商汤科技开发有限公司 在视频图像中展示业务对象的方法、装置和电子设备
US10157045B2 (en) * 2016-11-17 2018-12-18 The Mathworks, Inc. Systems and methods for automatically generating code for deep learning systems
CN108229267B (zh) * 2016-12-29 2020-10-16 北京市商汤科技开发有限公司 对象属性检测、神经网络训练、区域检测方法和装置
CN107562875A (zh) * 2017-08-31 2018-01-09 北京麒麟合盛网络技术有限公司 一种模型的更新方法、装置及系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120077158A1 (en) * 2010-09-28 2012-03-29 Government Of The United States, As Represented By The Secretary Of The Air Force Predictive Performance Optimizer
CN106547871A (zh) * 2016-10-31 2017-03-29 北京百度网讯科技有限公司 基于神经网络的搜索结果的召回方法和装置
CN106548210A (zh) * 2016-10-31 2017-03-29 腾讯科技(深圳)有限公司 机器学习模型训练方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3836021A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022021199A1 (zh) * 2020-07-30 2022-02-03 华为技术有限公司 一种神经网络模型构建方法及其设备
CN112101529A (zh) * 2020-10-14 2020-12-18 杭州海康威视数字技术股份有限公司 一种用于神经网络模型推理跨平台的部署方法及架构
CN112101529B (zh) * 2020-10-14 2024-06-21 杭州海康威视数字技术股份有限公司 一种用于神经网络模型推理跨平台的部署方法及架构
CN114444338A (zh) * 2022-04-11 2022-05-06 北京瑞莱智慧科技有限公司 Ai模型组合快速轻量级验证的方法、装置及存储介质

Also Published As

Publication number Publication date
US20220036236A1 (en) 2022-02-03
CN111357014A (zh) 2020-06-30
EP3836021A4 (en) 2021-08-25
EP3836021B1 (en) 2024-05-15
EP3836021A1 (en) 2021-06-16
CN111357014B (zh) 2023-07-11

Similar Documents

Publication Publication Date Title
WO2020056647A1 (zh) 一种ai模型的开发方法及装置
CN111132234B (zh) 一种数据传输方法及对应的终端
CN111742539B (zh) 一种语音控制命令生成方法及终端
CN111371849A (zh) 数据处理的方法和电子设备
CN114996168B (zh) 一种多设备协同测试方法、测试设备及可读存储介质
CN112532145A (zh) 马达振动控制方法及电子设备
CN111078376A (zh) 一种进程管理方法及设备
CN113490291B (zh) 数据下载方法、装置和终端设备
WO2022022319A1 (zh) 一种图像处理方法、电子设备、图像处理系统及芯片系统
CN114444000A (zh) 页面布局文件的生成方法、装置、电子设备以及可读存储介质
WO2023071441A1 (zh) 通信录字母的显示方法、装置和终端设备
WO2022007757A1 (zh) 跨设备声纹注册方法、电子设备及存储介质
CN116795435A (zh) 兼容性管控方法及相关设备
CN117130765B (zh) 计算资源的配置方法和电子设备
CN116095219B (zh) 通知显示方法和终端设备
CN116993619B (zh) 图像处理方法及相关设备
WO2023051056A1 (zh) 内存管理方法、电子设备、计算机存储介质和程序产品
WO2022188812A1 (zh) 设备之间同步软件特性的方法及电子设备
CN116821399A (zh) 照片处理方法及相关设备
CN117156260A (zh) 拍照方法及电子设备
CN115619628A (zh) 图像处理方法和终端设备
CN117666861A (zh) 服务卡片分发方法、系统和电子设备
CN117726929A (zh) 图像处理方法及装置
CN113760239A (zh) 应用程序开发方法、装置、终端设备及可读存储介质
CN117992154A (zh) 一种应用图标显示方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18933825

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2018933825

Country of ref document: EP

Effective date: 20210309

NENP Non-entry into the national phase

Ref country code: DE