Method and apparatus for generating a static graph model based on a deep learning framework

Through the method of generating static graph models based on the deep learning framework, the problem of dynamic graph model deployment is solved, and the rapid and convenient model deployment is achieved and the speed of inference is improved.

CN114863215BActive Publication Date: 2025-07-04BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210537092.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-17
Publication Date
2025-07-04
Estimated Expiration
2042-05-17

AI Technical Summary

Technical Problem

In the prior art, how to quickly and conveniently deploy dynamic graph models is an urgent problem that needs to be solved.

Method used

The method of generating static graph models based on the deep learning framework includes dynamic graph training, model transformation to determine network structure and parameters, and generate target static graph models in open neural network exchange format.

Benefits of technology

It realizes the rapid and convenient deployment of dynamic graph models, and improves the compatibility and inference speed of the model among different deep learning architectures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863215B_ABST
    Figure CN114863215B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and apparatus for generating a static graph model based on a deep learning framework, relating to the field of computer technologies, and particularly to artificial intelligence technologies such as natural language processing and deep learning. The specific implementation solution is as follows: based on the obtained target training corpus, a dynamic graph model corresponding to the target training corpus is generated through dynamic graph training; the dynamic graph model is converted to determine the network structure and network parameters corresponding to the dynamic graph model; according to the network structure and network parameters, a target static graph model in the open neural network exchange format corresponding to the target training corpus is generated. Thus, according to the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the open neural network exchange format is generated, so that the dynamic graph model can be deployed quickly and conveniently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and in particular, to artificial intelligence technology fields such as natural language processing and deep learning. Specifically, it relates to a method and device for generating a static graph model based on a deep learning framework. Background Art

[0002] With the continuous development and improvement of artificial intelligence technologies, they have played an extremely important role in various fields related to human daily life. For example, artificial intelligence technologies have made remarkable progress in the field of deep learning technologies. Currently, most of the models trained using deep learning frameworks are dynamic graph models. How to quickly and conveniently deploy dynamic graph models is an urgent problem to be solved currently. Summary of the Invention

[0003] The present disclosure provides a method and device for generating a static graph model based on a deep learning framework.

[0004] According to a first aspect of the present disclosure, there is provided a method for generating a static graph model based on a deep learning framework, including:

[0005] Based on the obtained target training corpus, through dynamic graph training, to generate a dynamic graph model corresponding to the target training corpus;

[0006] Convert the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model;

[0007] According to the network structure and network parameters, generate a target static graph model in the open neural network exchange format corresponding to the target training corpus.

[0008] According to a second aspect of the present disclosure, there is provided a device for generating a static graph model based on a deep learning framework, including:

[0009] A first generation module, configured to generate a dynamic graph model corresponding to the target training corpus through dynamic graph training based on the obtained target training corpus;

[0010] A first determination module, configured to convert the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model;

[0011] A second generation module, configured to generate a target static graph model in the open neural network exchange format corresponding to the target training corpus according to the network structure and network parameters.

[0012] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0013] At least one processor; and

[0014] A memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method for generating a static graph model based on a deep learning framework as described in the first aspect.

[0016] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to cause the computer to execute the method for generating a static graph model based on a deep learning framework as described in the first aspect.

[0017] According to a fifth aspect of the present disclosure, there is provided a computer program product including computer instructions, and when the computer instructions are executed by a processor, the steps of the method for generating a static graph model based on a deep learning framework as described in the first aspect are implemented.

[0018] The method and apparatus for generating a static graph model based on a deep learning framework provided by the present disclosure have the following beneficial effects:

[0019] In the embodiments of the present disclosure, first, based on the obtained target training corpus, through dynamic graph training, a dynamic graph model corresponding to the target training corpus is generated, and then the dynamic graph model is converted to determine the network structure and network parameters corresponding to the dynamic graph model, and finally, according to the network structure and network parameters, a target static graph model in the open neural network exchange format corresponding to the target training corpus is generated. Thus, according to the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the open neural network exchange format can be generated, and the dynamic graph model can be deployed quickly and conveniently.

[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:

[0022] Figure 1 is a schematic flowchart of a method for generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure;

[0023] Figure 2 is a schematic flowchart of a method for generating a static graph model based on a deep learning framework according to another embodiment of the present disclosure;

[0024] Figure 3It is a schematic structural diagram of an apparatus for generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure;

[0025] Figure 4 It is a block diagram of an electronic device for implementing the method of generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure. Specific Embodiments

[0026] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.

[0027] Embodiments of the present disclosure relate to the fields of artificial intelligence technologies such as computer vision and deep learning.

[0028] Artificial Intelligence (AI) is an abbreviation for Artificial Intelligence. It is a new technical science that studies, develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence.

[0029] Deep learning is to learn the internal laws and representation levels of sample data, and the information obtained during these learning processes is very helpful for the interpretation of data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have the ability to analyze and learn like humans, and be able to recognize data such as text, images, and sounds.

[0030] Natural language processing is to use a computer to process, understand, and apply human languages (such as Chinese, English, etc.). It is an interdisciplinary field of computer science and linguistics, and is often referred to as computational linguistics. Since natural language is the fundamental sign that distinguishes humans from other animals. Without language, human thinking would be impossible to talk about. Therefore, natural language processing reflects the highest task and realm of artificial intelligence. That is to say, only when a computer has the ability to process natural language can the machine be considered to have achieved true intelligence.

[0031] The following describes the method and apparatus for generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0032] It should be noted that the execution subject of the method for generating a static graph model based on a deep learning framework in this embodiment is an apparatus for generating a static graph model based on a deep learning framework. This apparatus can be implemented in software and / or hardware, and this apparatus can be configured in an electronic device. The electronic device can include, but is not limited to, a terminal, a server, etc.

[0033] Figure 1 It is a schematic flowchart of a method for generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure.

[0034] As Figure 1 shown, the method for generating a static graph model based on a deep learning framework includes:

[0035] S101: Based on the obtained target training corpus, through dynamic graph training, to generate a dynamic graph model corresponding to the target training corpus.

[0036] It should be noted that, in order to obtain a better programming experience, more user-friendly interfaces, and a more friendly debugging interaction mechanism. When developing a model using the PaddlePaddle deep learning framework, it is recommended to use dynamic graph programming, that is, dynamic graph training, to obtain a dynamic graph model.

[0037] Optionally, the target training corpus may include any one of the following: first text data and corresponding audio data, second text data and corresponding third text data, first image data and corresponding second image data, third image data and corresponding recognition result data.

[0038] Among them, the third text data may be a translated text corresponding to the second text data.

[0039] Among them, the second image data may be an image corresponding to the target object included in the first image data.

[0040] Among them, the recognition result data may be the category of the target object included in the third image data, etc. The present disclosure does not limit this.

[0041] Optionally, if the target training corpus is the first text data and corresponding audio data, the generated dynamic graph model may be a speech synthesis model; if the target training corpus is the second text data and corresponding third text data, the generated dynamic graph model may be a translation model; if the target training corpus is the first image data and corresponding second image data, the generated dynamic graph model may be a target extraction model; if the target training corpus is the third image data and corresponding recognition result data, the generated dynamic graph model may be a target recognition model. The present disclosure does not limit this.

[0042] S102: Convert the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model.

[0043] In the embodiments of the present disclosure, after generating the dynamic graph model corresponding to the target training corpus, it is necessary to first convert the dynamic graph model to obtain the network structure and network parameters corresponding to the dynamic graph model. Thus, further based on the network structure and network parameters of the dynamic graph model, a model corresponding to the dynamic graph model and applicable to any other deep learning architecture can be generated.

[0044] Among them, the network structure can be a convolutional neural network structure, a recurrent neural network structure, a generative adversarial neural network structure, etc., and the present disclosure does not limit this.

[0045] Among them, the network parameters can include the number of layers of the neural network, the number of neurons, the types of neuron activation functions, the learning rate, the regularization parameter, etc. The present disclosure does not limit this.

[0046] S103: Generate a target static graph model in the Open Neural Network Exchange format corresponding to the target training corpus according to the network structure and network parameters.

[0047] It should be noted that the Open Neural Network Exchange (ONNX) format is an open file format designed for machine learning and is used to store trained models. It enables different artificial intelligence frameworks (such as PaddlePaddle, Pytorch, TensorFllow) to store model data in the same format and interact. Thus, the model can be transferred between different frameworks.

[0048] Among them, the target static graph model still contains the network parameters and network structure corresponding to the dynamic graph model. The target static graph model can be a model corresponding to the dynamic graph model and applicable to any other deep learning architecture, that is, the dynamic graph model can be migrated to an intermediate expression model of any other deep learning architecture, so that the model can be deployed quickly and conveniently.

[0049] In the embodiments of the present disclosure, first, based on the obtained target training corpus, through dynamic graph training, a dynamic graph model corresponding to the target training corpus is generated. Then, the dynamic graph model is converted to determine the network structure and network parameters corresponding to the dynamic graph model. Finally, according to the network structure and network parameters, a target static graph model in the Open Neural Network Exchange format corresponding to the target training corpus is generated. Thus, according to the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the Open Neural Network Exchange format is generated, so that the dynamic graph model can be deployed quickly and conveniently.

[0050] Figure 2 It is a schematic flowchart of a method for generating a static graph model based on a deep learning framework according to another embodiment of the present disclosure;

[0051] As Figure 2 shown, the method for generating a static graph model based on a deep learning framework includes:

[0052] S201: Based on the obtained target training corpus, through dynamic graph training, to generate a dynamic graph model corresponding to the target training corpus.

[0053] Among them, for the specific implementation form of step S201, reference can be made to the detailed descriptions in other embodiments of the present disclosure, and no specific description will be given here.

[0054] S202: Based on the dynamic graph model file, call the model conversion interface in the deep learning framework to obtain the network structure and network parameters corresponding to the dynamic graph model.

[0055] In the embodiments of the present disclosure, after generating the dynamic graph model, the model conversion interface in the current deep learning framework can be called, that is, the model conversion function is called to process the dynamic graph model to obtain the network structure and network parameters corresponding to the dynamic graph model. Thus, the efficiency of obtaining the network structure and network parameters corresponding to the dynamic graph model is improved.

[0056] Among them, the dynamic graph model file can be a file for storing the dynamic graph model. Optionally, under the PaddlePaddle deep learning framework, the storage format of the dynamic graph model file can be a *.pdz format model. The present disclosure does not limit this.

[0057] S203: Determine a reference static graph model according to the network structure and network parameters.

[0058] Optionally, the reference static graph model includes two files, one file for storing the network structure corresponding to the dynamic graph model and one file for storing the network parameters corresponding to the dynamic graph model.

[0059] Optionally, under the PaddlePaddle deep learning framework, the storage format of the file for storing the network structure in the reference static graph model can be a *.pdmodel format, and the storage format of the file for storing the network parameters can be a *.pdiparams format. The present disclosure does not limit this.

[0060] S204: Input the input data in the target training corpus into the reference static graph model to obtain the prediction data output by the reference static graph model.

[0061] It should be noted that after determining the reference static graph model, it is necessary to further verify the accuracy of the reference static graph model, that is, to perform inference on the reference static graph model to determine whether the reference static graph model is accurate. Specifically: input the input data in the target training corpus into the reference static graph model to obtain the predicted data output by the reference static graph model, and then determine whether the reference static graph model is accurate according to whether the predicted data matches the labeled data in the target training corpus.

[0062] Optionally, if the target training corpus is the first text data and the corresponding audio data, the input data is the first text data and the labeled data is the first audio data. Or, if the target training corpus is the second text data and the corresponding third text data, the input data is the second text data and the labeled data is the third text data. Or, if the target training corpus is the first image data and the corresponding second image data, the input data is the first image data and the labeled data is the second image data. If the target training corpus is the third image data and the corresponding recognition result data, the input data is the third image data and the labeled data is the recognition result data. The present disclosure does not limit this.

[0063] Optionally, if the predicted data matches the labeled data in the target training corpus, it is determined that the reference static graph model is accurate. If the predicted data does not match the labeled data in the target training corpus, it is determined that the reference static graph model is inaccurate.

[0064] Optionally, under the PaddlePaddle deep learning framework, the PaddleInference engine can be used to perform inference on the reference static graph model. The present disclosure does not limit this.

[0065] S205: In response to the predicted data matching the labeled data in the target training corpus, generate a file of the target static graph model in the Open Neural Network Exchange format according to the network structure and network parameters.

[0066] It can be understood that when the predicted data matches the labeled data in the target training corpus, that is, when the reference static graph model is accurate, further generate a file of the target static graph model in the Open Neural Network Exchange format according to the network structure and network parameters, so as to avoid the generated target static graph model being unable to accurately implement the functions of the dynamic graph model, which not only saves resources but also ensures the accuracy of the target static graph model.

[0067] Optionally, the file of the target static graph model is used to store the target static graph model, and its storage format can be expressed as the *.onnx format.

[0068] S206: Use an Open Neural Network Exchange (ONNX) format engine to perform inference on the target static graph model, so as to deploy the target static model on a terminal device.

[0069] In the embodiments of the present disclosure, after generating a file of the target static graph model in the Open Neural Network Exchange (ONNX) format, an ONNX format engine can be used to deploy the target static model in any deep learning framework, and then the functions of the dynamic graph model can be implemented under any deep learning framework. Thus, not only can the target static graph model be deployed under any deep learning framework, but also the inference speed of the model is improved.

[0070] Optionally, the Open Neural Network Exchange (ONNX) format engine can be an ONNX engine or an ONNX Runtime engine. The present disclosure does not limit this.

[0071] Among them, the terminal device can be a computer, a tablet, a mobile phone, etc. The present disclosure does not limit this.

[0072] In the embodiments of the present disclosure, first, based on the obtained target training corpus, a dynamic graph model corresponding to the target training corpus is generated through dynamic graph training. Then, based on the dynamic graph model file, the model conversion interface in the deep learning framework is called to obtain the network structure and network parameters corresponding to the dynamic graph model. Next, according to the network structure and network parameters, a reference static graph model is determined, and the input data in the target training corpus is input into the reference static graph model to obtain the prediction data output by the reference static graph model. When the prediction data matches the annotation data in the target training corpus, a file of the target static graph model in the Open Neural Network Exchange (ONNX) format is generated according to the network structure and network parameters. Finally, an ONNX format engine is used to perform inference on the target static graph model, so as to deploy the target static model on a terminal device. Thus, through the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the Open Neural Network Exchange (ONNX) format is generated, and an ONNX format engine is used to perform inference on the target static graph model, so as to deploy the target static model on a terminal device, thereby not only quickly and conveniently deploying the network model of the deep learning architecture on the terminal device, but also improving the inference speed of the network model.

[0073] Figure 3 It is a schematic structural diagram of a device for generating a static graph model based on a deep learning framework according to an embodiment of the present disclosure;

[0074] As Figure 3 shown, the device 300 for generating a static graph model based on a deep learning framework includes:

[0075] The first generation module 310 is configured to generate a dynamic graph model corresponding to the target training corpus through dynamic graph training based on the obtained target training corpus;

[0076] The first determination module 320 is configured to convert the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model;

[0077] The second generation module 330 is configured to generate a target static graph model in the open neural network exchange format corresponding to the target training corpus according to the network structure and network parameters.

[0078] In some embodiments of the present disclosure, the second generation module 330 is specifically configured to:

[0079] Determine a reference static graph model according to the network structure and network parameters;

[0080] Input the input data in the target training corpus into the reference static graph model to obtain the predicted data output by the reference static graph model;

[0081] In response to the predicted data matching the labeled data in the target training corpus, generate a file of the target static graph model in the open neural network exchange format according to the network structure and network parameters.

[0082] In some embodiments of the present disclosure, the first determination module 320 is specifically configured to:

[0083] Based on the dynamic graph model file, call the model conversion interface in the deep learning framework to obtain the network structure and network parameters corresponding to the dynamic graph model.

[0084] In some embodiments of the present disclosure, it further includes:

[0085] An inference module is configured to perform inference on the target static graph model by using an open neural network exchange format engine to deploy the target static model on a terminal device.

[0086] In some embodiments of the present disclosure, the target training corpus includes any one of the following: first text data and corresponding audio data, second text data and corresponding third text data, first image data and corresponding second image data, third image data and corresponding recognition result data.

[0087] It should be noted that the foregoing explanation of the method for generating a static graph model based on a deep learning framework also applies to the apparatus for generating a static graph model based on a deep learning framework in this embodiment, and will not be elaborated here.

[0088] In the embodiments of the present disclosure, first, based on the obtained target training corpus, a dynamic graph model corresponding to the target training corpus is generated through dynamic graph training. Then, the dynamic graph model is converted to determine the network structure and network parameters corresponding to the dynamic graph model. Finally, according to the network structure and network parameters, a target static graph model in the Open Neural Network Exchange format corresponding to the target training corpus is generated. Thus, according to the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the Open Neural Network Exchange format is generated, so that the dynamic graph model can be deployed quickly and conveniently.

[0089] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0090] Figure 4 FIG. shows a schematic block diagram of an exemplary electronic device 400 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0091] As Figure 4 shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0092] A plurality of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0093] The computing unit 401 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 executes the various methods and processes described above, such as generating a static graph model based on a deep learning framework. For example, in some embodiments, generating a static graph model based on a deep learning framework can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of generating a static graph model based on a deep learning framework described above can be executed. Alternatively, in other embodiments, the computing unit 401 can be configured to execute generating a static graph model based on a deep learning framework in any other suitable manner (e.g., by means of firmware).

[0094] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general-purpose programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0095] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, executed partially on the machine and partially on a remote machine as an independent software package, or executed entirely on a remote machine or server.

[0096] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0097] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0098] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), the Internet, and blockchain network.

[0099] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS" for short). The server may also be a server of a distributed system or a server combined with a blockchain.

[0100] In this embodiment, first, based on the obtained target training corpus, a dynamic graph model corresponding to the target training corpus is generated through dynamic graph training. Then, the dynamic graph model is converted to determine the network structure and network parameters corresponding to the dynamic graph model. Finally, according to the network structure and network parameters, a target static graph model in the Open Neural Network Exchange format corresponding to the target training corpus is generated. Thus, according to the network structure and network parameters corresponding to the dynamic graph model, a target static graph model in the Open Neural Network Exchange format is generated, so that the dynamic graph model can be deployed quickly and conveniently.

[0101] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.

[0102] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one such feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically defined. In the description of this disclosure, the words "if" and "when" can be interpreted as "when...", "when...", "in response to determining", or "in... case".

[0103] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A method for generating a static graph model based on a deep learning framework, comprising: Based on the obtained target training corpus, generating a dynamic graph model corresponding to the target training corpus through dynamic graph training; Converting the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model; Generating a target static graph model in Open Neural Network Exchange (ONNX) format corresponding to the target training corpus according to the network structure and network parameters, wherein the target static graph model is a model corresponding to the dynamic graph model and applicable to any other deep learning architecture; The step of generating a target static graph model in Open Neural Network Exchange (ONNX) format corresponding to the target training corpus according to the network structure and network parameters includes: Determining a reference static graph model according to the network structure and network parameters; Inputting the input data in the target training corpus into the reference static graph model to obtain prediction data output by the reference static graph model; In response to the prediction data matching the annotation data in the target training corpus, generating a file of the target static graph model in Open Neural Network Exchange (ONNX) format according to the network structure and network parameters.

2. The method according to claim 1, wherein The step of converting the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model includes: Based on the dynamic graph model file, calling a model conversion interface in the deep learning framework to obtain the network structure and network parameters corresponding to the dynamic graph model.

3. The method according to claim 1, wherein, After generating the target static graph model in Open Neural Network Exchange (ONNX) format corresponding to the target training corpus, it further includes: Using an engine in Open Neural Network Exchange (ONNX) format to perform inference on the target static graph model to deploy the target static model on a terminal device.

4. The method according to any one of claims 1-3, wherein, The target training corpus includes any one of the following: first text data and corresponding audio data, second text data and corresponding third text data, first image data and corresponding second image data, third image data and corresponding recognition result data.

5. A device for generating a static graph model based on a deep learning framework, comprising: A first generation module for generating a dynamic graph model corresponding to the target training corpus through dynamic graph training based on the obtained target training corpus; A first determination module for converting the dynamic graph model to determine the network structure and network parameters corresponding to the dynamic graph model; A second generation module for generating a target static graph model in Open Neural Network Exchange (ONNX) format corresponding to the target training corpus according to the network structure and network parameters, wherein the target static graph model is a model corresponding to the dynamic graph model and applicable to any other deep learning architecture; The second generation module is specifically used for: Determining a reference static graph model according to the network structure and network parameters; Inputting the input data in the target training corpus into the reference static graph model to obtain prediction data output by the reference static graph model; In response to the prediction data matching the labeled data in the target training corpus, a file of the target static graph model in the Open Neural Network Exchange (ONNX) format is generated according to the network structure and network parameters.

6. The device according to claim 5, wherein, The first determination module is specifically configured to: Based on the dynamic graph model file, call the model conversion interface in the deep learning framework to obtain the network structure and network parameters corresponding to the dynamic graph model.

7. The device according to claim 5, wherein, It further includes: An inference module, configured to use the Open Neural Network Exchange (ONNX) format engine to perform inference on the target static graph model, so as to deploy the target static model on the terminal device.

8. The device according to any one of claims 5 to 7, wherein, The target training corpus includes any one of the following: first text data and corresponding audio data, second text data and corresponding third text data, first image data and corresponding second image data, and third image data and corresponding recognition result data.

9. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-4.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-4.

11. A computer program product, comprising computer instructions, where when the computer instructions are executed by a processor, the steps of the method according to any one of claims 1-4 are implemented.

Citation Information

Patent Citations

  • Method and device for constructing deep learning network model, equipment and storage medium

    CN112270403A