Deep learning model data processing method and processing device, and electronic equipment
By separating the model structure and weights in the compiler model of the deep learning model, ignoring the compile-time attribute data, and only converting the run-time attribute data, the compatibility problem caused by the model structure data modification of the deep learning model is solved, reducing maintenance costs and improving loading speed.
Patent Information
- Application Number
- CN202411480237.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-03-21
AI Technical Summary
Compatibility problems caused by modification of model structure data during execution of deep learning models lead to model loading failure and maintenance costs.
By separating the model structure and weights in the compiler model of the deep learning model, the compile-time attribute data in the model structure data is ignored, and only the run-time attribute data is converted to obtain the run-time model structure data, and the run-time model structure data and weight data are saved respectively.
It solves the compatibility problem caused by the modification of model structure data during execution of deep learning models, reduces the size and maintenance cost of the model, and improves the loading speed of the model.
Smart Images

Figure CN119668615A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning models, and in particular, to a method and device for processing deep learning model data, an electronic device, and a non-transitory computer-readable storage medium. Background Art
[0002] With the rapid development of deep learning, the execution efficiency of deep learning models is increasingly required. At present, the traditional method is to use front-end languages (such as Python) to write models and interpret and execute them during the inference process, which is inefficient and its performance is increasingly unable to meet the requirements.
[0003] Using a method similar to that of traditional compilers, the deep learning model is optimized by the deep learning compiler and then converted into NPU (Neural-network Processing Unit)-specific hardware code. It is then executed on specific NPU hardware, which can effectively improve the efficiency of model execution and has become a common choice in the industry.
[0004] Figure 1 A flowchart of a method for executing a deep learning model in the prior art is shown. Figure 1 As shown in the figure, the deep learning compiler persists the converted deep learning model, and then the runtime program loads the persisted model and performs model reasoning on the NPU. Among them, the compiler and the runtime program use the same data structure definition to ensure that the saved and loaded models are consistent and can be correctly executed on the NPU. In the traditional model generation and execution method, the compiler and the runtime program use the same data structure, and the graph structure at compile time is tightly coupled with the model structure of the runtime program. Since in the traditional model generation and execution method, the model structure and the saved model data are fixed, any modification of the model structure by the compiler (for example, adding certain operators and attributes, deleting certain data structure definitions) will cause the model data to be misaligned, which will affect the runtime program, resulting in model loading failure, and all previously compiled models can no longer be used. The model must be regenerated with the latest compiler; the runtime program also needs to integrate the latest model structure, and recompile and publish it. At the same time, since the model compiler and the runtime program share the same model structure data, the model data generated by the model compiler contains a large amount of information and data that the compiler needs only during compilation, and the runtime program does not need this data. These redundant data and structures increase the size of the model, increase the cost of model maintenance, and reduce the loading speed of the model. Summary of the invention
[0005] The present invention aims to propose a deep learning model data processing method and processing device, an electronic device and a non-transitory computer-readable storage medium to solve the compatibility problem caused by the modification of model structure data during the execution of the deep learning model.
[0006] According to one aspect of the present invention, a method for processing deep learning model data is proposed, comprising: in response to a data processing instruction of the deep learning model, separating the model structure and weight in a compiler model corresponding to the deep learning model to obtain model structure data and weight data, wherein the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model; ignoring the compile-time attribute data in the model structure data, and transforming the runtime attribute data to obtain runtime model structure data; and separately saving the runtime model structure data and the weight data, so that a runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
[0007] According to some embodiments, the compile-time attribute data in the model structure data is ignored, and the runtime attribute data is transformed to obtain the runtime model structure data, including: converting the model structure data into a text format to obtain text format model data, wherein the text format model data adopts a dictionary format of key-value pairs to meet the expansion requirements of the text format model data; ignoring the compile-time attribute data, and converting the runtime attribute data in the text format model data into runtime model structure data to reduce the redundancy of data when running the deep learning model.
[0008] According to some embodiments, converting the runtime attribute data in the text format model data into runtime model structure data includes: converting the existing runtime attribute data in the text format model data to obtain the runtime model structure data.
[0009] According to some embodiments, the runtime attribute data in the text format model data is converted into runtime model structure data, including: adding new runtime attribute data to the text format model data; converting the existing runtime attribute data and the newly added runtime attribute data in the text format model data to obtain the runtime model structure data.
[0010] According to some embodiments, before the runtime model structure data and the weight data are saved separately, the method further includes: segmenting the runtime model structure data to obtain segmented runtime model structure data.
[0011] According to some embodiments, after respectively saving the runtime model structure data and the weight data, the method further includes: loading the weight data.
[0012] According to some embodiments, after the runtime model structure data and the weight data are saved separately, the method further includes: loading the runtime model structure data in segments; and decrypting and deserializing the segmented loaded runtime model structure data according to the weight data.
[0013] According to some embodiments, segmenting the runtime model structure data to obtain segmented runtime model structure data includes:
[0014] The runtime model structure data is segmented according to the layer structure of the deep learning model to obtain segmented runtime model structure data.
[0015] According to one aspect of the present invention, a processing device for deep learning model data is proposed, comprising: a data separation unit, for separating the model structure and weight in a compiler model corresponding to the deep learning model in response to a data processing instruction of the deep learning model, to obtain model structure data and weight data, wherein the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model; a data conversion unit, for ignoring the compile-time attribute data in the model structure data, and converting the runtime attribute data to obtain runtime model structure data; a data storage unit, for separately storing the runtime model structure data and the weight data, so that a runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
[0016] According to one aspect of the present invention, an electronic device is provided, comprising: a processor; and a memory storing a computer program, wherein when the computer program is executed by the processor, the processor executes the processing method as described in any of the preceding embodiments.
[0017] According to one aspect of the present invention, a non-transitory computer-readable storage medium is provided, on which computer-readable instructions are stored. When the instructions are executed by a processor, the processor executes the processing method described in any of the previous embodiments.
[0018] According to an embodiment of the present invention, by separating the model structure and weight in the compiler model corresponding to the deep learning model, and ignoring the compile-time attribute data in the model structure data, only the runtime attribute data is converted to reduce the redundancy of data when running the deep learning model. This not only solves the compatibility problem caused by the modification of the model structure data during the execution of the deep learning model, but also meets the subsequent expansion requirements.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. By describing the exemplary embodiments in detail with reference to the drawings, the above and other objectives, features and advantages of the present invention will become more apparent.
[0021] Figure 1 A flow chart of an execution method of a deep learning model in the prior art is shown.
[0022] Figure 2a A schematic diagram showing the storage of traditional deep learning model structure data in memory before modification.
[0023] Figure 2b A schematic diagram showing the storage of a modified traditional deep learning model structure data in memory is shown.
[0024] Figure 3 A flow chart of a method for processing deep learning model data according to an example embodiment of the present invention is shown.
[0025] Figure 4 A schematic diagram of a process of separating model structure data and weight data according to an exemplary embodiment of the present invention is shown.
[0026] Figure 5 A schematic diagram of a conversion process of model structure data according to an exemplary embodiment of the present invention is shown.
[0027] Figure 6 A flow chart of another method for processing deep learning model data according to an exemplary embodiment of the present invention is shown.
[0028] Figure 7 A schematic diagram of a deep learning model segmentation method according to an example embodiment of the present invention is shown.
[0029] Figure 8 A flow chart of another method for processing deep learning model data according to an exemplary embodiment of the present invention is shown.
[0030] Fig. 9 A block diagram of a device for processing deep learning model data according to an example embodiment of the present invention is shown.
[0031] Fig.10 An electronic device according to an exemplary embodiment of the present invention is shown. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same figures in the drawings represent the same or similar parts, and thus their repeated description will be omitted.
[0033] The described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of these specific details, or other modes, components, materials, devices or operations may be adopted. In these cases, known structures, methods, devices, implementations, materials or operations will not be shown or described in detail.
[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0035] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0036] As mentioned earlier, in the traditional model generation and execution method, the model structure is saved in binary form, and the model structure and the saved model data are in a fixed relationship. Any modification of the model structure by the compiler (for example, adding certain operators and attributes, deleting certain data structure definitions) will cause the model data to be misaligned, which will affect the runtime program and cause the model to fail to load. In addition, all previously compiled models can no longer be used and the model must be regenerated using the latest compiler; the runtime program also needs to integrate the latest model structure and be recompiled and released.
[0037] like Figure 2a and Figure 2b Figure 1 shows a schematic diagram of the storage of traditional deep learning model structure data in memory, where Figure 2aA schematic diagram of the storage of traditional deep learning model structure data in memory before modification is shown, Figure 2b A schematic diagram showing the storage of a modified traditional deep learning model structure data in memory is shown.
[0038] like Figure 2a As shown, the model structure data is saved in binary order. Since the model structure data saved in binary mode only has binary data, it does not have the meaning of the data. Therefore, only the runtime program corresponding to the version of the model compiler can identify the specific meaning of each saved piece of data.
[0039] For example, data segments 0 to 99: data1, corresponding to the attribute model name, the data type is string; data segments 100 to 199: data2, corresponding to the attribute model version, the data type is string; data segments 200 to 4199: data3, corresponding to the data structure layer, including the following data: 1 to 4 Bytes: corresponding to layer index, 4 to 8 Bytes: corresponding to weight size, ..., X to 400 Bytes: corresponding to weight data, 4200 to 6199: data4, corresponding to the data structure layer, ..., mn: data n, ...
[0040] like Figure 2b As shown in Figure 2b, when the compiler is updated, a new field datax is added to the model, which is saved between 200 and 299. The saved model data is shown in Figure 2b. When the old runtime program reads the new model structure data, after reading 100-199, it will continue to read 200-4199 and parse it into layer as data2. However, in fact, the data read is datax + part of data3, and the parsed data is all wrong. Including the data read and parsed after 4300, all will be wrong.
[0041] Only when the runtime program is updated to match the compiled version of the generated model can 200-299 be correctly identified as datax, 300-4299 as data3 and other data segments corresponding to the data, and the new version of the model can be correctly loaded. The runtime program is generally released and deployed to the formal environment in use. Updating the runtime program may involve downtime and updates of the production environment, which has a large impact and needs to be avoided as much as possible.
[0042] Therefore, in the traditional model generation and execution method, since the compiler and the runtime program use the same model data structure, the graph structure during model compilation is tightly coupled with the model structure of the runtime program. At the same time, since the compiler and the runtime program share the same data structure, the model generated by the compiler contains a large amount of information and data that the compiler only needs during compilation, and the runtime program does not need this data. These redundant data and structures increase the size of the model, increase the cost of model maintenance, and also reduce the loading speed of the model.
[0043] According to an embodiment of the present invention, by separating the model structure and weights in the compiler model corresponding to the deep learning model, ignoring the compile-time attribute data in the model structure data, and only converting the runtime attribute data, not only the compatibility problem caused by the modification of the model structure data during the execution of the deep learning model is solved, but also the subsequent expansion requirements are met. At the same time, the segmented loading method is adopted, which not only improves the loading speed of the model, but also avoids the problem of insufficient memory that may exist when the model is too large.
[0044] The specific embodiments according to the present invention are described in detail below with reference to the accompanying drawings.
[0045] Figure 3 A flow chart of a method for processing deep learning model data according to an exemplary embodiment of the present invention is shown. Figure 3 The processing method shown includes steps S301, S303 and S305.
[0046] like Figure 3 As shown, in step S301, in response to the data processing instruction of the deep learning model, the model structure and weight in the compiler model corresponding to the deep learning model are separated to obtain model structure data and weight data.
[0047] In an embodiment of the present invention, the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model.
[0048] In practice, a deep learning model is generally composed of the basic attributes of the model and the multi-layer results of the model. The layer structure of the model includes the configuration items of the layer and the weights of the corresponding layer. In a specific embodiment, the model structure data includes the basic attribute data of the model and the configuration item data of each layer, wherein the basic attribute data of the model and the configuration item data of each layer respectively include compile-time attribute data and runtime attribute data.
[0049] In an embodiment of the present invention, Figure 4 As shown, the weights of each layer are separated from each layer into a separate file, and the model structure data is composed of another file.
[0050] In step S303, the compile-time attribute data in the model structure data is ignored, and the runtime attribute data is transformed to obtain runtime model structure data.
[0051] As mentioned above, in the traditional model generation and execution method, since the compiler and the runtime program use the same model data structure, the graph structure of the model during compilation is tightly coupled with the model structure of the runtime program. At the same time, since the compiler and the runtime program share the same data structure, the model generated by the compiler contains a large amount of information and data that the compiler only needs during compilation, and the runtime program does not need this data. These redundant data and structures increase the size of the model, increase the cost of model maintenance, and also reduce the loading speed of the model. Therefore, in the embodiment of the present invention, only the runtime attribute data is converted, and the compile-time attribute data is not converted, thereby solving the defects of the traditional model loading method.
[0052] In a specific embodiment, Figure 5 As shown, in step S303, first, the model structure data is converted into a text format to obtain text format model data; then, the compile-time attribute data is ignored, and the runtime attribute data in the text format model data is converted into runtime model structure data. According to an embodiment of the present invention, the text format model data is saved in a dictionary format of key-value pairs, that is, saved in a Key-Value format.
[0053] Through step S303, the model structure data and the runtime model structure data are no longer in a fixed correspondence. If the model structure generated by the compiler changes, some Key-Value model structure data will be added. For the old runtime program, these newly added keys are not parsed and used, and only the Key-Value data agreed upon in the previous version is loaded. For the new runtime program, these newly added keys are parsed and used. That is, after the model structure data is updated, since it does not exist in the old model, the Key that cannot be found in the model during the loading process can be set to the default value. Therefore, the newly added model structure data does not affect the execution of the old model. It can be seen that the embodiment of the present invention effectively improves the compatibility of the model and meets the subsequent expansion requirements.
[0054] According to an embodiment of the present invention, when converting runtime attribute data in text format model data into runtime model structure data, the existing runtime attribute data in the text format model data can be converted to obtain the runtime model structure data, or new runtime attribute data can be added to the text format model data, and the existing runtime attribute data and the new runtime attribute data in the text format model data can be converted to obtain the runtime model structure data.
[0055] In step S305, the runtime model structure data and the weight data are saved respectively, so that the runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
[0056] In practice, the runtime program can be loaded according to the runtime model structure data and weight data saved in step S305, and inference can be performed on the NPU to obtain the execution result.
[0057] according to Figure 3 The illustrated embodiment separates the model structure and weights in the compiler model corresponding to the deep learning model, ignores the compile-time attribute data in the model structure data, and only converts the runtime attribute data. This not only solves the compatibility problem caused by the modification of the model structure data during the execution of the deep learning model, but also meets the subsequent expansion requirements.
[0058] Figure 6 A flowchart of another method for processing deep learning model data according to an exemplary embodiment of the present invention is shown, and Figure 3 compared to, Figure 6 The processing method shown also includes steps S304 and S306. Step S304 is performed before step S305, and step S306 is performed after step S305. For simplicity, this embodiment only describes Figure 3 The differences are not repeated here, and the similarities are not repeated here.
[0059] like Figure 6 As shown, in step S304, the runtime model structure data is segmented to obtain segmented runtime model structure data.
[0060] like Figure 7 As shown, the runtime model structure data is split into multiple segments of preset length according to the layer structure of the deep learning model, and is saved separately in each segment.
[0061] In step S306, the structural data of the model is loaded in sections.
[0062] According to an embodiment of the present invention, before step S306, weight data needs to be loaded.
[0063] In a specific embodiment, in step S306, first, the runtime model structure data is loaded in segments; then, the runtime model structure data loaded in segments is decrypted and deserialized according to the weight data.
[0064] For example, the runtime program loads each segment generated in step S304. In practice, each time a segment file is loaded, decrypted and deserialized, the next segment file is loaded after the currently loaded segment file is released. Compared with the traditional one-time loading of all the data of the model into the memory, and then decryption and deserialization and other operations, the embodiment of the present invention only occupies a small amount of memory each time, which can effectively save the memory size required for model loading and avoid the problem of insufficient memory that may exist when the model is too large.
[0065] according to Figure 6 In the illustrated embodiment, not only the loading speed of the model is improved, but also the problem of insufficient memory that may exist when the model is too large is avoided.
[0066] Figure 8 A flowchart of another method for processing deep learning model data according to an exemplary embodiment of the present invention is shown. Figure 8 As shown, after the deep learning model is compiled and optimized using the deep learning compiler, the compiler model format data is obtained; then, the compiler model format data is converted into a model and the model is loaded, inferred, and executed using the runtime program. The model conversion process includes steps S1 to S5 to obtain the runtime model format; the runtime program loading process includes steps S6 to S8 to load the deep learning model for subsequent inference and execution.
[0067] like Figure 8 As shown, in step S1, model structure data and weight data are separated from the compiler model.
[0068] In practice, a deep learning model is generally composed of the basic attributes of the model and the multi-layer results of the model. The layer structure of the model includes the configuration items of the layer and the weights of the corresponding layer. In a specific embodiment, the model structure data includes the basic attribute data of the model and the configuration item data of each layer, wherein the basic attribute data of the model and the configuration item data of each layer respectively include compile-time attribute data and runtime attribute data.
[0069] In an embodiment of the present invention, Figure 4 As shown, the weights of each layer are separated from each layer into a separate file, and the model structure data is composed of another file.
[0070] In step S2, the model structure data is converted into a text format.
[0071] In step S3, the text format of the compiler model is converted into the text format of the runtime program.
[0072] like Figure 5As shown, first, the model structure data is converted into a text format to obtain text format model data; then, the compile-time attribute data is ignored, and the runtime attribute data in the text format model data is converted into runtime model structure data. Wherein, the text format model data is saved in a Key-Value format.
[0073] In step S4: the runtime program format of the model is segmented into fixed sizes.
[0074] In step S5, the weight data obtained in S1 and the data in the runtime program format of the model are saved respectively.
[0075] like Figure 7 As shown, the runtime model structure data is split into multiple segments of preset length according to the layer structure of the deep learning model, and is saved separately in each segment.
[0076] In step S6, the weight data of the model is loaded.
[0077] In step S7, the structural data of the model is loaded in sections.
[0078] In practice, each time a segment file is loaded, decrypted and deserialized, the next segment file is loaded after the currently loaded segment file is released. Compared with the traditional method of loading all the data of the model into the memory at one time and then performing operations such as decryption and deserialization, the embodiment of the present invention only occupies a small amount of memory each time, which can effectively save the memory size required for model loading and avoid the problem of insufficient memory that may exist when the model is too large.
[0079] In step S8, it is determined whether all model segment data have been loaded. If all segments have been loaded, subsequent reasoning and execution are performed; otherwise, step S7 is repeated.
[0080] The above mainly introduces the embodiments of the present invention from the perspective of methods. Those skilled in the art should easily appreciate that, in combination with the operations or steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Those skilled in the art may use different ways to implement the described functions for each specific operation or method, and such implementation should not be considered to exceed the scope of the present invention.
[0081] The following describes the device embodiment of the present invention. For details not described in the device embodiment of the present invention, reference can be made to the method embodiment of the present invention.
[0082] Fig. 9 A block diagram of a processing device for deep learning model data according to an exemplary embodiment of the present invention is shown. Fig. 9The processing device shown includes a data separation unit 901, a data conversion unit 903 and a data storage unit 905. The data separation unit 901 is used to separate the model structure and weight in the compiler model corresponding to the deep learning model in response to the data processing instruction of the deep learning model, and obtain model structure data and weight data, wherein the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model; the data conversion unit 903 is used to ignore the compile-time attribute data in the model structure data, and convert the runtime attribute data to obtain the runtime model structure data; the data storage unit 905 is used to save the runtime model structure data and the weight data respectively, so that the runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
[0083] Fig.10 An electronic device according to an exemplary embodiment of the present invention is shown. Fig.10 The electronic device 200 according to this embodiment of the present invention will be described. Fig.10 The electronic device 200 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0084] like Fig.10 As shown, the electronic device 200 is in the form of a general computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including the storage unit 220 and the processing unit 210), a display unit 240, etc.
[0085] The storage unit stores program codes, which can be executed by the processing unit 210, so that the processing unit 210 executes the methods according to various exemplary embodiments of the present invention described in this specification. For example, the processing unit 210 can execute the following Figure 1 The method shown in .
[0086] The storage unit 220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2201 and / or a cache memory unit 2202 , and may further include a read-only memory unit (ROM) 2203 .
[0087] The storage unit 220 may also include a program / utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0088] Bus 230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0089] The electronic device 200 may also communicate with one or more external devices 300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and / or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 250. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0090] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. The technical solution according to the implementation method of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation method of the present invention.
[0091] The software product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0092] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0093] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0094] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the aforementioned functions.
[0095] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0096] According to an embodiment of the present invention, a computer program is provided, including a computer program or an instruction. When the computer program or the instruction is executed by a processor, the method described above can be executed.
[0097] The embodiments of the present invention are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present invention, the specific implementation methods and application scope of the present invention, all belong to the scope of protection of the present invention. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for processing deep learning model data, characterized in that: include: In response to the data processing instruction of the deep learning model, the model structure and weight in the compiler model corresponding to the deep learning model are separated to obtain model structure data and weight data, wherein the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model; Ignore the compile-time attribute data in the model structure data, and transform the runtime attribute data to obtain runtime model structure data; The runtime model structure data and the weight data are saved separately so that a runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
2. The processing method according to claim 1, characterized in that: Ignore the compile-time attribute data in the model structure data, and transform the runtime attribute data to obtain runtime model structure data, including: Converting the model structure data into a text format to obtain text format model data, wherein the text format model data adopts a dictionary format of key-value pairs to meet the expansion requirements of the text format model data; The compile-time attribute data is ignored, and the runtime attribute data in the text format model data is converted into runtime model structure data to reduce the redundancy of data when running the deep learning model.
3. The processing method according to claim 2, characterized in that: Converting the runtime attribute data in the text format model data into runtime model structure data includes: The runtime attribute data existing in the text format model data is converted to obtain the runtime model structure data.
4. The processing method according to claim 2, characterized in that: Converting the runtime attribute data in the text format model data into runtime model structure data includes: Adding runtime attribute data to the text format model data; The existing runtime attribute data and the newly added runtime attribute data in the text format model data are converted to obtain the runtime model structure data.
5. The processing method according to claim 1, characterized in that: Before respectively saving the runtime model structure data and the weight data, the method further includes: The runtime model structure data is segmented to obtain segmented runtime model structure data.
6. The processing method according to claim 5, characterized in that: After respectively saving the runtime model structure data and the weight data, the method further includes: loading the weight data; after saving the runtime model structure data and the weight data respectively, further comprising: Loading the runtime model structure data in segments; The segmented loaded runtime model structure data is decrypted and deserialized according to the weight data.
7. The processing method according to claim 6, characterized in that: The runtime model structure data is segmented to obtain segmented runtime model structure data, including: The runtime model structure data is segmented according to the layer structure of the deep learning model to obtain segmented runtime model structure data.
8. A deep learning model data processing device, characterized in that: include: A data separation unit, configured to separate a model structure and a weight in a compiler model corresponding to the deep learning model in response to a data processing instruction of the deep learning model, to obtain model structure data and weight data, wherein the model structure data includes compile-time attribute data and runtime attribute data of the deep learning model; A data conversion unit, used to ignore the compile-time attribute data in the model structure data and convert the runtime attribute data to obtain runtime model structure data; A data storage unit is used to store the runtime model structure data and the weight data respectively, so that the runtime program uses the runtime model structure data and the weight data to perform inference execution on the deep learning model.
9. An electronic device, comprising: processor; as well as A memory storing a computer program, which, when executed by the processor, enables the processor to execute the processing method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having computer-readable instructions stored thereon, which, when executed by a processor, causes the processor to execute the processing method according to any one of claims 1 to 7.