A method and device for generating a neural network model

By acquiring and using node information and edge information in general -purpose configuration files, the neural network model is generated, and the neuronic network models in existing technologies have a complex and high -cost problem, and the more efficient and convenient model building process is achieved.

CN112686375BActive Publication Date: 2025-01-28LYNXI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110019667.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-07
Publication Date
2025-01-28
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

The existing neural network model is more complex and costly.

Method used

By obtaining general -purpose configuration files, the configuration file includes node information and edge information, which is used to describe the neural network units and data transmission relationships in neural network models, and generate neural network models according to this configuration file.

Benefits of technology

Simplified the construction process of neural network models, reducing the cost of manpower and learning, and improving the convenience of model building.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112686375B_ABST
    Figure CN112686375B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for generating a neural network model. The method for generating a neural network model includes: obtaining a general configuration file, the general configuration file includes node information and edge information, the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe the data transmission relationship in the neural network model; generating the neural network model according to the general configuration file. In this way, since the general configuration file includes edge information describing each neural network unit node of the neural network model and node information describing the data transmission relationship in the neural network model, the corresponding neural network model can be established according to the general configuration file, and there is no need to use a programming language to write code, which improves the convenience of establishing the neural network model and helps to reduce the cost of building the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for generating a neural network model. Background Art

[0002] There are many different types of neural network models in the related technology, and the construction methods of various types of neural network models are different. In order to build a neural network model, a specific model framework and programming language need to be used. If the model framework needs to be replaced, the staff needs to learn and use the new framework content. Therefore, the existing neural network model construction method is relatively complicated and costly. Summary of the invention

[0003] The embodiments of the present invention provide a method and device for generating a neural network model to solve the problem that the existing neural network model construction method is relatively complex and costly.

[0004] In a first aspect, an embodiment of the present invention provides a method for generating a neural network model, comprising the following steps:

[0005] Obtain a general configuration file, wherein the general configuration file includes node information and edge information, wherein the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe a data transmission relationship in the neural network model;

[0006] A neural network model is generated according to the general configuration file.

[0007] Optionally, the step of obtaining a common configuration file includes:

[0008] Obtain demand information written by users;

[0009] The general configuration file is generated according to the requirement information and the type of the model framework.

[0010] Optionally, the step of obtaining a common configuration file includes:

[0011] Obtain the established neural network model;

[0012] A file in a preset format is exported from the established neural network model as the general configuration file.

[0013] Optionally, obtaining a general configuration file includes:

[0014] Determine the type and sequence number of the neural network unit;

[0015] Determine a framework parameter of the neural network unit, wherein the framework parameter includes at least one of a tensor dimension and a value range;

[0016] Determine the node data accuracy of the neural network unit;

[0017] Node information is generated according to the type and serial number of the neural network unit, the framework parameters and the node data accuracy.

[0018] Optionally, obtaining a general configuration file includes:

[0019] Determine the starting and ending positions of the edge;

[0020] Determine the node outflow port and node inflow port of the edge;

[0021] Determine the data flow location of the edge;

[0022] Edge information is generated according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position.

[0023] Optionally, when the information value of the starting position of the target edge among the edges is less than 0, the input data of the target edge is external data of the neural network model;

[0024] When the information value of the starting position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in the neural network model, and the information value of the starting position is the sequence number of the neural network unit that inputs data to the target edge;

[0025] When the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;

[0026] When the information value of the end point position of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the end point position is the sequence number of the neural network unit to which the output data of the target edge is output;

[0027] When the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of the neural network model;

[0028] When the information value of the node outflow port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outflow port is the port number for data transmission between the neural network unit that inputs data to the target edge and the target edge;

[0029] When the information value of the node inflow port of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;

[0030] When the information value of the node inflow port of the target edge is greater than or equal to 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit receiving the output data of the target edge.

[0031] Optionally, before generating the neural network model according to the general configuration file, the method further includes:

[0032] Determine whether the model framework can completely parse the general configuration file;

[0033] If not, the unparseable part of the general configuration file is discarded to obtain a general configuration file that is fully compatible with the model framework.

[0034] Optionally, the format of the general configuration file is YAML serialization format.

[0035] Optionally, the model framework is at least one of the Tensorflow framework, the Pytorch framework, and the MXNet framework.

[0036] In a second aspect, an embodiment of the present invention provides a device for generating a neural network model, comprising:

[0037] An acquisition module, used to acquire a general configuration file, wherein the general configuration file includes node information and edge information, wherein the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe a data transmission relationship in the neural network model;

[0038] A generation module is used to generate a neural network model according to the general configuration file.

[0039] In a third aspect, an embodiment of the present invention provides a computer program product, which is stored on a computer-readable storage medium. When the computer program product is executed, it implements the steps of the method for generating a neural network model described in any one of the first aspects.

[0040] The embodiment of the present invention obtains a general configuration file, the general configuration file includes node information and edge information, the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe the data transmission relationship in the neural network model; the neural network model is generated according to the general configuration file. In this way, since the general configuration file includes the edge information describing each neural network unit node of the neural network model and the node information describing the data transmission relationship in the neural network model, the corresponding neural network model can be established according to the general configuration file, and there is no need to use a programming language to write code, which improves the convenience of establishing the neural network model and helps to reduce the cost of building the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0042] Figure 1 is a flow chart of a method for generating a neural network model provided by one embodiment of the present invention;

[0043] Figure 2 is a neural network connection diagram in one embodiment of the present invention;

[0044] Figure 3 is a schematic diagram of a scenario of a method for generating a neural network model in one embodiment of the present invention;

[0045] Figure 4 It is a structural diagram of a device for generating a neural network model provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0046] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0047] The invention provides a method for generating a neural network model.

[0048] In one embodiment, the method for generating the neural network model comprises the following steps:

[0049] Step 101: Obtain a general configuration file.

[0050] In this embodiment, the model framework refers to the framework for building a neural network model. There may be differences in the types of model frameworks, but the basic structure of the neural network model is the same. The neural network model includes neural network units (Operators, abbreviated as OP) for data processing and edges (Edge) for data transmission. The neural network units can also be called nodes (Node) of the neural network model.

[0051] Whether it is deep learning or brain-like computing, the underlying computing model is the neural network (NN). The main difference is that deep learning mainly uses artificial neural networks (ANN), while brain-like computing mainly uses spiking neural networks (SNN). The basic components of both are neurons, which are connected to each other by a large number of neurons. The connection between neurons can be regarded as a directed edge with weights. The output of the neuron will be weighted by the connection between neurons and then passed to the connected neurons. All the inputs received by each neuron will be accumulated for further processing to generate the output of the neuron. The main difference between ANN and SNN is that the neurons of ANN output numerical values, which are weighted by multiplying the edge weights; while the neurons of SNN output electric pulse signals, which are weighted to become current signals of different intensities; the neurons of ANN directly calculate the output value of the neurons through an activation function for the input of other neurons; and the neurons of SNN receive current signals input by other neurons, and will update their states according to their neuron models. When a specific state is reached, it will emit an electric pulse and reset the state.

[0052] The neural network connection graph is a directed graph. Each node in the graph represents a layer of neurons, and each edge represents the connection relationship between layers. In the case of ANN neural network application, the corresponding neural network connection graph is an acyclic directed graph. In the case of SNN neural network application, the corresponding neural network connection graph is a directed cyclic graph.

[0053] Since the basic units of different neural network models are the same, including nodes and edges, and most of the current model frameworks also generate neural network models based on the description of nodes and edges, therefore, in this embodiment, through a general configuration file including node information and edge information, the nodes and edges are described separately, which can be adapted to different model frameworks to generate specific neural network models, thereby realizing the construction of neural network models according to different frameworks based on the same general configuration file.

[0054] In some of the embodiments, the model framework may specifically be at least one of a Tensorflow framework, a Pytorch framework, and a MXNet framework.

[0055] During implementation, the applicable model framework is not limited to this. Obviously, this method can also be applied to other frameworks to build neural network models as needed.

[0056] In this embodiment, the general configuration file includes node information and edge information. The node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe the data transmission relationship in the neural network model.

[0057] Since the basic structures of neural network models are the same and include nodes and edges, different types of neural network models can be built based on a common configuration file including node information and edge information.

[0058] Step 102: Generate a neural network model according to the general configuration file.

[0059] After the general configuration file is determined, a script generator can be used to generate a corresponding neural network model according to the general configuration file.

[0060] In the embodiment of the present invention, since the general configuration file includes the edge information describing each neural network unit of the neural network model and the node information describing the data transmission relationship in the neural network model, the corresponding neural network model can be established according to the general configuration file without the need to write code using a programming language, which improves the convenience of establishing the neural network model and helps to reduce the labor cost and learning difficulty of building the neural network model.

[0061] In some embodiments, step 101 includes:

[0062] Obtain demand information written by users;

[0063] The general configuration file is generated according to the requirement information and the type of the model framework.

[0064] In this embodiment, the demand information can be obtained by directly writing by the user. For example, a specific template can be provided. The template can be provided in different ways, such as in software such as Excel (spreadsheet). When it is necessary to obtain a general configuration file, the user fills in the demand information in the template according to a certain format and requirements, and then inputs the filled-in demand information into the script generator, and uses the script generator to generate a corresponding general configuration file based on the demand information filled in by the user.

[0065] In this embodiment, the user only needs to fill in the required information according to certain format requirements to generate a configuration file and further build a neural network model, which improves the convenience of building a neural network model and reduces the requirements for the user's programming ability, helps to reduce the cost of building a neural network model for the user, and is more convenient to use.

[0066] In some other embodiments, the above step 101 includes:

[0067] Obtain the established neural network model;

[0068] A file in a preset format is exported from the established neural network model as the general configuration file.

[0069] The established neural network model in this embodiment refers to a neural network model that has been built. During implementation, a file that meets certain format requirements can be exported from the established neural network model as a general configuration file in accordance with certain format requirements, and the general configuration file can also be obtained.

[0070] In some other embodiments, the general configuration file may also be directly written and obtained according to the above-mentioned preset format.

[0071] In some of the embodiments, the format of the common configuration file is a YAML serialization format, which is easier to read and port.

[0072] The general configuration file includes node information and edge information, so the process of obtaining the general configuration file is actually the process of obtaining node information and edge information. In some embodiments, the general configuration file may also include a name, which may be set according to the user's habits and is mainly used to distinguish and mark the generated general configuration file, and does not affect the actual application process of the general configuration file.

[0073] In some embodiments, the general configuration file includes node information, and the above step 101 specifically includes:

[0074] Determine the type and sequence number of the neural network unit;

[0075] Determine a framework parameter of the neural network unit, wherein the framework parameter includes at least one of a tensor dimension and a value range;

[0076] Determine the node data accuracy of the neural network unit;

[0077] Node information is generated according to the type and serial number of the neural network unit, the framework parameters and the node data accuracy.

[0078] In this embodiment, node information is used to describe the neural network unit, wherein the type of the neural network unit is used to distinguish different neural network units, and the serial number is used to distinguish neural network units of the same type. For neural network units of the same type, sequential numbering starting from 1 can be used as their serial number.

[0079] The framework parameters are the main parameters of the model framework corresponding to the neural network unit, which may include tensor dimensions and value ranges.

[0080] Node data precision is used to limit the data precision of input data.

[0081] In one embodiment, the node information of a neural network unit can be represented in the following form:

[0082]

[0083] In the above node information, name represents the type of neural network unit, and the neural network unit can specifically be a neural network unit that performs different operations such as exponentiation operation and convolution operation. In this embodiment, it is specifically the exponentiation operation exp, and the sequence number sequence of the neural network unit is 2, which means that the neural network unit is the sequence number 2 among the same neural network units.

[0084] The framework parameters parameters include the tensor dimension tensor_in_shape, the maximum value_min and the minimum value_max of the value range.

[0085] The output state out is a parameter related to the model framework of this type in this embodiment. When the model framework is changed, it may not be necessary to set this parameter.

[0086] The node data precision in this embodiment is a 16-byte single-precision floating point number. When building other neural network models, the corresponding node data precision can obviously be set as needed.

[0087] In this way, by generating node information of each neural network unit, the parameters of each neural network unit can be described.

[0088] In some embodiments, the general configuration file includes side information, and the above step 101 specifically includes:

[0089] Determine the starting and ending positions of the edge;

[0090] Determine the node outflow port and node inflow port of the edge;

[0091] Determine the data flow location of the edge;

[0092] Edge information is generated according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position.

[0093] For example, in a specific implementation of this embodiment, the edge information describing a certain edge is as follows:

[0094]

[0095] Edge information is used to describe data transmission in the neural network model, where the starting position prev_node_seq and the end position next_node_seq of the edge are mainly used to distinguish whether a data transmission process is related to the external data of the neural network model.

[0096] In one embodiment, it is set that when the information value of the starting position of the target edge in the edge is less than 0, the input data of the target edge is external data of the neural network model; when the information value of the starting position of the target edge is greater than 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the starting position is the serial number of the neural network unit that inputs data to the target edge.

[0097] In this embodiment, the value of the starting position of the target edge can be -1 or a positive integer. When the information value of the starting position is -1, it means that the input data of the target edge is external data of the neural network model. When the information value of the starting position is a positive integer, the information represents the sequence number of the neural network unit that obtains data for the target edge. In this embodiment, it is specifically 1, that is, the neural network unit with the sequence number value of 1 inputs data to the target edge.

[0098] The parameter value of next_node_seq at the end position is similar to that of the starting position.

[0099] Specifically, when the information value at the end point of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model. For example, if the information value at the end point is -1, it means that the target edge outputs data to the outside of the neural network model. When the information value at the end point of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value at the end point is the sequence number of the neural network unit to which the output data of the target edge is output, which is specifically 2 in this embodiment, indicating that the target edge outputs data to the neural network unit with a sequence value of 2.

[0100] The node outflow port and node inflow port of the edge are specifically used to represent the port number for data transmission between the neural network unit and the target edge.

[0101] When the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is the external data of the neural network model; when the information value of the node inflow port of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model.

[0102] The node outflow port included in the edge information means that the data flows out from the node outflow port of the neural network unit and flows into the edge for data transmission through the edge. Therefore, the node outflow port of the edge actually corresponds to the data input to the edge; the node inflow port included in the edge information means that when the neural network unit receives the data transmitted by the edge, it flows into the corresponding neural network unit through the node inflow port of the neural network unit. In other words, the node inflow port actually corresponds to the data output by the edge.

[0103] The value range of the information value of the node outflow port and the node inflow port of the edge can be an integer greater than or equal to -1.

[0104] When the information value of the starting position of the target edge is less than 0, specifically -1 in this embodiment, the input information of the target edge comes from outside the neural network model, and accordingly, the value of the node outflow port of the target edge is also -1.

[0105] Similarly, when the information value of the end point of the target edge is -1, the output data of the target edge is output to the outside of the neural network model, and the information value of the node inflow port is also -1.

[0106] When the information value of the node outflow port and the information value of the node inflow port of the target edge are non-negative integers, the information value represents the corresponding port number, and the port numbers of the node outflow port and the node inflow port of each neural network unit are numbered sequentially starting from 0.

[0107] When the information value of the node outflow port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outflow port is the port number for data transmission between the neural network unit that inputs data to the target edge and the target edge.

[0108] When the information value of the node inflow port of the target edge is greater than or equal to 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit receiving the output data of the target edge.

[0109] For example, the node outflow port and the node inflow port in the above edge information are both port 0 of the neural network unit.

[0110] The edge information may also include the data location identifier data_file of the source or output location of the data. When the information value of the data location identifier of the target edge is None, it means that there is no data transmission between the target edge and the outside of the neural network model, that is, the data input to the target edge comes from the neural network unit in the neural network model, not external data, and the data of the target edge is output to the neural network unit in the neural network model, not to the outside of the neural network model.

[0111] When the information value of the data location identifier is not None, it means that there is data interaction between the target edge and the outside of the neural network model. At this time, combined with the above-mentioned parameters such as the starting position and the end position, it can be determined whether the target edge obtains external data or outputs data. At this time, the specific data source or data output address can be used as the information value of the data location identifier, so as to determine the data flow direction of the target edge.

[0112] As follows, a neural network model building process is given as an example.

[0113] like Figure 2 As shown, Figure 2 The neural network connection diagram of the neural network model can be specifically understood as a directed acyclic graph, including two nodes and four edges, wherein a neural network unit receives two copies of external data (Input date file), and the two copies of external input data are input to the neural network unit through different edges, and after being processed by the neural network unit, they are output to the next neural network unit through an edge, and after being processed by the next neural network unit, they are output through an edge to obtain an output file (Output data file).

[0114] As shown in Tables 1 to 3, when building the neural network model, first write the requirements file in Excel. Figure 1 is the requirement file corresponding to the edge information, Figure 2 and Figure 3 They are the requirement files corresponding to the two nodes respectively.

[0115] Table 1: Side information requirements

[0116]

[0117] Table 2: Requirements for the first node

[0118]

[0119] Table 3: Requirements for the second node

[0120] caseName extra_info opname tensor_in_shape value_min value_max out QA_exp_000001-Pytorch Pytorch exp [4,8,11,11] -1 1 None

[0121] The edge information requirement in Table 1 describes the edge information. For example, the feature feature of the requirement file is connection connect, the name casename of the requirement file is QA_SMOKE_connect_000001, a configuration file case_config_1 is QA_Conv2d_000001-Pytorch, and another configuration file case_config_2 is QA_exp_000001-Pytorch. One label case_template_1 corresponds to the convolution operation unit Conv2d, and another label case_template_2 corresponds to the power operation unit exp. The additional information Extra_info of the edge indicates that the edge is used to connect two nodes.

[0122] The requirement information of the two nodes in Table 2 and Table 3 describes the relevant parameters of the two nodes, such as the name of the requirement file caseName, the node type opname and the framework parameters such as the tensor dimension tensor_in_shape, and other required parameters.

[0123] Next, the general configuration file of the neural network model is obtained according to the above requirement file as follows, where the description in brackets represents the specific meaning of the relevant content and is not part of the general configuration file.

[0124]

[0125]

[0126]

[0127]

[0128] Optionally, before generating the neural network model according to the general configuration file, the method further includes:

[0129] Determine whether the model framework can completely parse the general configuration file;

[0130] If not, the unparseable part of the general configuration file is discarded to obtain a general configuration file that is fully compatible with the model framework.

[0131] In this embodiment, the compatibility of the general configuration file and the neural network model is also tested.

[0132] For example, if a universal configuration file is exported from a model built by a certain type of model framework, then the universal configuration file is unlikely to cause compatibility issues when used in the process of building a neural network model using the same type of model framework.

[0133] When the universal configuration file is used to build a neural network model in other types of model frameworks, incompatibility may occur due to the difference in model frameworks, which is manifested in that part of the universal configuration file cannot be parsed.

[0134] Exemplarily, the parameter out in the node information of the above neural network unit is a relevant parameter in the pytorch framework. When building a neural network model based on other model frameworks, this parameter does not need to be set. In this way, when the model framework used is not the pytorch framework, the parameter out cannot be parsed. Since the model framework used by the parameter out is irrelevant, when the general configuration file cannot be completely parsed, the part that cannot be parsed is discarded, such as the above parameter out. In this way, the obtained general configuration file is compatible with other frameworks and there is no compatibility file, that is, it can be completely parsed by other frameworks.

[0135] Obviously, generic configuration files generated in other ways may have similar problems.

[0136] Therefore, in this embodiment, the general configuration file and the type of the neural network model to be generated are parsed, and when there is a part in the general configuration file that cannot be parsed by the model framework, this part of the content is discarded, so that the general configuration file can be completely parsed, and the compatibility problem of the general configuration file for different model frameworks can be solved.

[0137] It should be understood that different types of neural network models are composed of neural network units and edges. Therefore, there is no need to adjust the overall architecture of the general configuration file. Only certain specific parameters need to be adaptively adjusted. Compared with re-structuring the neural network model, the technical solution of this embodiment effectively saves workload and reduces work difficulty.

[0138] Furthermore, if a fully compatible universal configuration file cannot be obtained after processing the universal configuration file and discarding the unparsed parts, it means that the model framework cannot support part of the content of the obtained universal configuration file, and the result of failure of neural network model generation is output.

[0139] If you need to continue to build a neural network model, you can regenerate the general configuration file to solve possible compatibility issues. For example, you can make adaptive adjustments to the written general configuration file according to the model framework used, or you can select the established neural network model according to the model framework used to export the general configuration file to adapt to the model framework, avoiding incompatibility of the general configuration file caused by different model frameworks.

[0140] like Figure 3As shown, the technical solution of this embodiment may include a process of obtaining a general configuration file and generating a neural network model according to the general configuration file.

[0141] The general configuration file can be generated by inputting the requirement file into a specific script generator, can be obtained by directly writing, and can also be exported from an already established neural network model.

[0142] After obtaining the general configuration file, the general configuration file is input into the model generation system to generate a neural network model.

[0143] The working principle of the model generation system can be summarized as generating models and data based on the general configuration file provided by the staff.

[0144] Then load the generated data to obtain the framework running results, load the generated model to obtain the model running results, compare the framework running results with the model running results, and return the comparison results to the staff.

[0145] The invention also provides a device for generating a neural network model.

[0146] like Figure 4 As shown, in one embodiment, the generating device 400 of the neural network model includes:

[0147] An acquisition module 401 is used to acquire a general configuration file, wherein the general configuration file includes node information and edge information, wherein the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe a data transmission relationship in the neural network model;

[0148] The generating module 402 is used to generate a neural network model according to the general configuration file.

[0149] Optionally, the acquisition module 401 includes:

[0150] The demand information acquisition submodule is used to obtain the demand information written by the user;

[0151] The generation submodule is used to generate the general configuration file according to the requirement information and the type of the model framework.

[0152] Optionally, the acquisition module 401 includes:

[0153] A model acquisition submodule is used to acquire the established neural network model;

[0154] The export submodule is used to export a file in a preset format from the established neural network model as the general configuration file.

[0155] Optionally, the acquisition module 401 includes:

[0156] A first determination submodule is used to determine the type and serial number of the neural network unit;

[0157] A second determination submodule is used to determine a framework parameter of the neural network unit, wherein the framework parameter includes at least one of a tensor dimension and a value range;

[0158] A third determination submodule is used to determine the node data accuracy of the neural network unit;

[0159] The node information generation submodule is used to generate node information according to the type and serial number of the neural network unit, the framework parameters and the node data accuracy.

[0160] Optionally, the acquisition module 401 includes:

[0161] The fourth determination submodule is used to determine the starting position and the end position of the edge;

[0162] A fifth determination submodule, used to determine a node outflow port and a node inflow port of an edge;

[0163] A sixth determination submodule, used to determine the data flow position of the edge;

[0164] The side information generation submodule is used to generate side information according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position.

[0165] Optionally, when the information value of the starting position of the target edge among the edges is less than 0, the input data of the target edge is external data of the neural network model;

[0166] When the information value of the starting position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in the neural network model, and the information value of the starting position is the sequence number of the neural network unit that inputs data to the target edge;

[0167] When the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;

[0168] When the information value of the end point position of the target edge is greater than or equal to 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the end point position is the sequence number of the neural network unit to which the output data of the target edge is output;

[0169] When the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is external data of the neural network model;

[0170] When the information value of the node outflow port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outflow port is the port number for data transmission between the neural network unit that inputs data to the target edge and the target edge;

[0171] When the information value of the node inflow port of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model;

[0172] When the information value of the node inflow port of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit receiving the output data of the target edge.

[0173] Optionally, also include:

[0174] A compatibility determination module, used to determine whether the type of the general configuration file is compatible with the type of the neural network model to be generated;

[0175] A compatibility processing module is used to convert the format of the general configuration file when the type of the general configuration file is incompatible with the type of the neural network model to be generated, so as to obtain a general configuration file that is compatible with the type of the neural network model to be generated.

[0176] Optionally, the format of the general configuration file is YAML serialization format.

[0177] Optionally, the model framework is at least one of the Tensorflow framework, the Pytorch framework, and the MXNet framework.

[0178] The device for generating the neural network model of this embodiment can implement the various steps of the above-mentioned embodiment of the generation method of the neural network model, and can achieve basically the same or similar technical effects, which will not be repeated here.

[0179] An embodiment of the present invention further provides a computer program product, which is stored on a computer-readable storage medium. When the computer program product is executed, it implements the steps of the method for generating a neural network model described in any one of the first aspects.

[0180] The computer program product in the computer-readable storage medium of this embodiment can implement the steps of any one of the above-mentioned methods for generating a neural network model when it is running, and thus can at least achieve all of the above-mentioned technical effects, which will not be repeated here.

[0181] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for generating a neural network model, characterized in that: The following steps are involved: Obtain a general configuration file, wherein the general configuration file includes node information and edge information, wherein the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe the data transmission relationship in the neural network model. The general configuration file is a file generated after the user inputs the demand information written based on the set template into the script generator, wherein the node information is generated according to the type and sequence number of the neural network unit, the framework parameters and the node data accuracy; the edge information is generated according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position, and the framework parameters include at least one of the tensor dimension and the value range; Generate a neural network model according to the general configuration file using a script generator; Wherein, when the information value of the starting position of the target edge in the edge is less than 0, the input data of the target edge is the external data of the neural network model; When the information value of the starting position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the starting position is the sequence number of the neural network unit that inputs data to the target edge; When the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model; When the information value of the end point position of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the end point position is the sequence number of the neural network unit to which the output data of the target edge is output; When the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is the external data of the neural network model; When the information value of the node outflow port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outflow port is the port number for data transmission between the neural network unit that inputs data to the target edge and the target edge; When the information value of the node inflow port of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model; When the information value of the node inflow port of the target edge is greater than or equal to 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit receiving the output data of the target edge.

2. The method according to claim 1, characterized in that The step of obtaining the general configuration file includes: Obtain the established neural network model; A file in a preset format is exported from the established neural network model as the general configuration file.

3. The method according to claim 1 or 2, characterized in that: The obtaining of the general configuration file includes: Determine the type and sequence number of the neural network unit; Determine the framework parameters of the neural network unit; Determine the node data accuracy of the neural network unit; Node information is generated according to the type and serial number of the neural network unit, the framework parameters and the node data accuracy.

4. The method according to claim 3, characterized in that The obtaining of the general configuration file includes: Determine the starting and ending positions of the edge; Determine the node outflow port and node inflow port of the edge; Determine the data flow location of the edge; Edge information is generated according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position.

5. The method according to claim 4, characterized in that Before generating a neural network model according to the general configuration file, the method further includes: Determine whether the model framework can completely parse the general configuration file; If not, the unparseable part of the general configuration file is discarded to obtain a general configuration file that is fully compatible with the model framework.

6. The method according to any one of claims 1 to 2, characterized in that The format of the general configuration file is YAML serialization format.

7. The method according to any one of claims 1 to 2, characterized in that The model framework is at least one of the Tensorflow framework, Pytorch framework, and MXNet framework.

8. A device for generating a neural network model, characterized in that: include: An acquisition module is used to acquire a general configuration file, wherein the general configuration file includes node information and edge information, wherein the node information is used to describe each neural network unit in the neural network model, and the edge information is used to describe the data transmission relationship in the neural network model. The general configuration file is a file generated by inputting the demand information written by the user based on a set template into a script generator, wherein the node information is generated according to the type and sequence number of the neural network unit, the framework parameters and the node data accuracy; the edge information is generated according to the starting position, the end position, the node inflow port, the node outflow port and the data flow position, and the framework parameters include at least one of the tensor dimension and the value range; A generation module, for generating a neural network model according to the general configuration file using a script generator; Wherein, when the information value of the starting position of the target edge in the edge is less than 0, the input data of the target edge is the external data of the neural network model; When the information value of the starting position of the target edge is greater than 0, the input data of the target edge comes from a neural network unit in a neural network model, and the information value of the starting position is the sequence number of the neural network unit that inputs data to the target edge; When the information value of the end point position of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model; When the information value of the end point position of the target edge is greater than 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the end point position is the sequence number of the neural network unit to which the output data of the target edge is output; When the information value of the node outflow port of the target edge is less than 0, the input data of the target edge is the external data of the neural network model; When the information value of the node outflow port of the target edge is greater than or equal to 0, the input data of the target edge comes from the neural network unit in the neural network model, and the information value of the node outflow port is the port number for data transmission between the neural network unit that inputs data to the target edge and the target edge; When the information value of the node inflow port of the target edge is less than 0, the output data of the target edge is output to the outside of the neural network model; When the information value of the node inflow port of the target edge is greater than or equal to 0, the output data of the target edge is output to the neural network unit in the neural network model, and the information value of the node inflow port is the port number of the neural network unit receiving the output data of the target edge.

9. A computer program product, characterized in that The computer program product is stored on a computer-readable storage medium, and when the computer program product is executed, the steps of the method for generating a neural network model according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Deep learning neural network deployment system and method

    CN110942139A

  • Neural network model conversion method and related device

    CN111797969A