Universal automated model transplantation and service encapsulation method and system

By employing automated model porting and service encapsulation methods, we have solved the compatibility and complexity issues of deploying AI models across hardware platforms, achieving efficient and standardized end-to-end deployment and improving the deployment efficiency and reliability of AI models.

CN121785658APending Publication Date: 2026-04-03SUZHOU MIWEI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, the deployment of AI models across hardware platforms suffers from problems such as incompatible model formats, differences in operator support, reliance on specific libraries for pre- and post-processing code, and complex service-oriented deployments. These issues result in low efficiency, long cycles, high skill requirements for engineers, and a high risk of introducing errors, while also lacking end-to-end automation solutions.

Method used

This paper provides a general automated model porting and service encapsulation method and system. By receiving the source model file and the target hardware platform identifier, the system automatically converts the model into a format executable by the target platform and generates adapted inference engineering code. Based on the predefined service abstraction interface, the system automatically generates service templates and logic code and automatically encapsulates them into a service package that conforms to the standard specifications.

Benefits of technology

It enables end-to-end automated deployment of AI models across hardware platforms, improving deployment efficiency and standardization. It solves the problems of low efficiency, long cycle, and easy introduction of errors in manual conversion tools, and provides a complete automation solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785658A_ABST
    Figure CN121785658A_ABST
Patent Text Reader

Abstract

The invention discloses a universal automatic model transplantation and service encapsulation method and system, and relates to the technical field of artificial intelligence model deployment and application service. The method comprises the steps that a source model file and a target hardware platform identifier are received, a source model is automatically converted into a target model capable of being executed by a target hardware platform, and a reasoning engineering code matched with the target hardware platform is generated; and based on a predefined service abstract interface, automatically packaging the target model and the adapted reasoning engineering code into a service package conforming to a standard specification. The method solves the problems that current model transplantation mostly depends on manual operation, that is, an engineer manually uses a conversion tool provided by a manufacturer to carry out model format conversion and manually modifies a pre-processing code and a post-processing code to adapt to a target platform; the method has the problems of low efficiency, long period, high requirements on skills of engineers, easiness in error introduction, difficulty in maintenance and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence model deployment and application service technology, and in particular to a general automated model porting and service encapsulation method and system. Background Technology

[0002] With the rapid development of artificial intelligence technology, AI models are widely used in various fields such as image recognition, speech processing, and data analysis. Typically, high-performance GPUs are used for training and initial inference during the development phase. However, in actual production environments, due to considerations such as cost, power consumption, supply chain security, or specific performance requirements, it is often necessary to deploy models on diverse hardware platforms, such as domestically produced Ascend and Cambricon processors.

[0003] Currently, porting a model trained on one hardware platform to another presents significant challenges. Key issues include: Model format incompatibility: Different hardware platforms typically require specific model formats (e.g., Cambricon from Cambricon), making it impossible to directly run models in their original formats (e.g., PyTorch's .pt or TensorFlow's .pb). Operator support differences: Inference engines from different hardware vendors vary in their support for neural network operators and their implementation methods, leading to some models being unconvertible or experiencing reduced accuracy and performance after conversion. Pre- and post-processing code dependencies on specific libraries: The model's pre- and post-processing code may depend on libraries from the original hardware platform, requiring rewriting on the target platform. Complex service-oriented deployment: Encapsulating the converted model into a manageable, schedulable, and highly available service is a tedious task, requiring handling resource initialization, lifecycle management, communication, load balancing, etc., which is inefficient and error-prone when implemented manually.

[0004] In existing technologies, model porting often relies on manual processes, where engineers manually use vendor-provided conversion tools to convert model formats and manually modify pre- and post-processing code to adapt to the target platform. This method suffers from problems such as low efficiency, long cycle time, high skill requirements for engineers, susceptibility to errors, and difficulty in maintenance. Furthermore, although some model conversion tools exist, they are usually isolated and fail to effectively integrate with subsequent service-oriented deployment processes, thus failing to provide end-to-end automated solutions. Summary of the Invention

[0005] Purpose of the invention: To provide a general automated model porting and service encapsulation method and system, so as to at least solve one of the problems existing in the prior art.

[0006] Technical solution: A general method for porting and encapsulating automation models and services, including: Receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform; Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package that conforms to standard specifications.

[0007] Preferably, the system receives a source model file and a target hardware platform identifier, automatically converts the source model into a target model executable by the target hardware platform, and generates inference engineering code adapted to the target hardware platform, including: Automatically identify the model framework based on the type and structure of the source model; Automatically generate preprocessing and postprocessing code corresponding to the model; The model conversion toolchain is invoked to convert the model into a model format that can be recognized by the target computing platform, and model accuracy alignment and operator optimization are completed. The inference engine adaptation module generates the inference engineering code for the target platform.

[0008] Preferably, based on a predefined service abstraction interface, the target model and the adapted inference engineering code include: The service template, which includes four interfaces—initialization, business processing, resource recycling, and parameter update—is automatically generated based on the service abstraction specification. Automatically generate corresponding service logic code based on a preset mapping table or rule base; The generated model is bound to the service logic to form a service entity.

[0009] Preferably, the service is automatically packaged into a service package that conforms to standard specifications, including: Automatically integrate model files, dependency libraries, and service configuration files; Compile and link according to different target platforms; Generate a standard service compressed package with a unified format.

[0010] Preferably, after automatically encapsulating the target model and the adapted inference engineering code into a service package conforming to standard specifications based on a predefined service abstraction interface, the package further includes: The SDK automatically identifies the target hardware environment and loads the matching service package. Run the service and implement dynamic parameter updates and indicator monitoring.

[0011] As a preferred feature, automatic pre- and post-processing adaptation includes: Match the pre- and post-processing logic of template based on the tensor dimensions and data types of the model's input and output; The code generation module automatically generates processing functions in the corresponding language; The preprocessing output is mapped one-to-one with the model inference input interface to ensure data compatibility.

[0012] Preferably, the corresponding service logic code is automatically generated based on a preset mapping table or rule base, including: Based on a pre-defined function mapping table, the GPU API functions called by the source service are replaced to generate a target platform-compatible API; or, By using semantic recognition and template matching, the system automatically infers the next operation and generates reasoning, preprocessing, or postprocessing code.

[0013] To achieve the above objectives, according to another aspect of this application, a general automated model porting and service encapsulation system is provided.

[0014] The general automation model porting and service encapsulation system according to this application includes: The automated model porting module is used to receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform. The service abstraction and encapsulation module is used to automatically encapsulate the target model and the adapted inference engineering code into a service package that conforms to standard specifications, based on a predefined service abstraction interface.

[0015] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the general automation model porting and service encapsulation method according to any one of the present invention.

[0016] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, wherein computer instructions are stored therein, the computer instructions being configured to cause a processor to execute and implement the general automation model porting and service encapsulation method according to any one of the present invention.

[0017] Beneficial Effects: In this embodiment, a general automated model porting and service encapsulation approach is adopted. By receiving the source model file and the target hardware platform identifier, the source model is automatically converted into a target model executable by the target hardware platform, and inference engineering code adapted to the target hardware platform is generated. Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package conforming to standard specifications, achieving end-to-end automation of model deployment across hardware platforms. This improves the deployment efficiency and standardization of AI models, thereby solving the problem that model porting often relies on manual processes, i.e., engineers manually use conversion tools provided by vendors to convert model formats and manually modify pre- and post-processing code to adapt to the target platform. This method suffers from problems such as low efficiency, long cycle, high skill requirements for engineers, susceptibility to errors, and difficulty in maintenance. Furthermore, although some model conversion tools exist, they are usually isolated and fail to effectively connect with subsequent service-oriented deployment processes, thus failing to provide an end-to-end automated solution. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating the general automation model porting and service encapsulation method according to an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a general automated model porting and service encapsulation system according to embodiments of this application; and Figure 3 This is a schematic diagram of the structure of an electronic device according to the general automation model porting and service encapsulation method in the embodiments of this application. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0021] Furthermore, the terms "installation," "setup," "equipped with," "connection," "linking," and "socketing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral structure; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium, or an internal connection between two devices, components, or parts. Those skilled in the art can understand the specific meaning of these terms in this invention based on the specific circumstances.

[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0023] like Figure 1 As shown in the embodiment of the present invention, a general automation model porting and service encapsulation method is provided, the method comprising the following steps S101 to S102: Step S101: Receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform; It can achieve automated model porting and can analyze and transform source models.

[0024] According to an embodiment of the present invention, preferably, receiving a source model file and a target hardware platform identifier, automatically converting the source model into a target model executable by the target hardware platform, and generating inference engineering code adapted to the target hardware platform includes: Automatically identify the model framework based on the type and structure of the source model; Automatically generate preprocessing and postprocessing code corresponding to the model; The model conversion toolchain is invoked to convert the model into a model format that can be recognized by the target computing platform, and model accuracy alignment and operator optimization are completed. The inference engine adaptation module generates the inference engineering code for the target platform.

[0025] According to an embodiment of the present invention, preferably, the automatic adaptation between pre- and post-processing includes: Match the pre- and post-processing logic of template based on the tensor dimensions and data types of the model's input and output; The code generation module automatically generates processing functions in the corresponding language; The preprocessing output is mapped one-to-one with the model inference input interface to ensure data compatibility.

[0026] According to an embodiment of the present invention, preferably, the automatic model format conversion includes: selecting a conversion toolchain based on the model type to achieve automatic conversion from GPU training frameworks (PyTorch, TensorFlow) to formats supported by domestic chips (Ascend, Cambricon, Yulong (Orbital)); Perform precision alignment to ensure that the output of the converted model is numerically consistent with the original model; Perform computational efficiency optimization operations to reduce redundant computations through model pruning, quantization, or operator fusion.

[0027] For example, taking the YOLOv5 model as an example, the system automatically identifies the model structure, generates pre- and post-processing templates, and automatically converts the PyTorch model into an offline model format supported by Cambrian MLU, completing precision alignment and inference acceleration.

[0028] Step S102: Based on the predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package that conforms to the standard specifications.

[0029] It can achieve the effect of service abstraction and encapsulation, thereby obtaining standardized service packages.

[0030] According to an embodiment of the present invention, preferably, based on a predefined service abstraction interface, the target model and the adapted inference engineering code include: The service template, which includes four interfaces—initialization, business processing, resource recycling, and parameter update—is automatically generated based on the service abstraction specification. Automatically generate corresponding service logic code based on a preset mapping table or rule base; The generated model is bound to the service logic to form a service entity.

[0031] Through the automated service encapsulation steps described above, the transformed model can be encapsulated into a standardized, callable service.

[0032] According to an embodiment of the present invention, preferably, the automated service encapsulation step includes: Automatically generate service template files and CMake dependency configuration files based on service abstraction specifications; Based on the model type and business logic, a service definition file (JSON format) is automatically generated. This file includes: service type name, version number, input and output data types, list of supported devices and dependent function libraries. Generate service source code files and a directory of dependency files based on the service definition file.

[0033] According to an embodiment of the present invention, preferably, automatically generating corresponding service logic code based on a preset mapping table or rule base includes: Based on a pre-defined function mapping table, the GPU API functions called by the source service are replaced to generate a target platform-compatible API; or, By using semantic recognition and template matching, the system automatically infers the next operation and generates reasoning, preprocessing, or postprocessing code.

[0034] According to an embodiment of the present invention, preferably, the automatic packaging into a service package conforming to standard specifications includes: Automatically integrate model files, dependency libraries, and service configuration files; Compile and link according to different target platforms; Generate a standard service compressed package with a unified format.

[0035] It can generate and package standard services, thus forming a service compressed package that can run across platforms.

[0036] According to an embodiment of the present invention, preferably, in the standard service generation and packaging step: The generated service source code, dependency libraries, description files, and model files are automatically compressed into a .tar.gz format service package. Each service package contains multiple platform runtime images (CPU version, MLU version, NPU version, etc.). During system runtime, the system automatically selects and executes an image that matches the current environment through hardware detection.

[0037] For example, the system reads the model definition file, automatically generates the inference service template, and generates the SDK standard service through build_service.sh.

[0038] The service includes automatically implemented functions such as Init() and Process(), eliminating the need for manual writing of underlying logic.

[0039] The system will cross-compile the generated service code for multiple target platforms (such as Cambricon MLU270 and MLU370 at the same time) to generate multiple executable files or dynamic libraries.

[0040] Subsequently, the compilation artifacts, target model files, configuration files, dependency libraries, etc., are organized according to a predetermined directory structure and compressed into a standard service package (such as a .tar.gz file). This package is similar to an Android APK, storing the binary files for the corresponding platform. During deployment, the service runtime environment will automatically detect the current hardware and select the correct binary file to execute.

[0041] According to an embodiment of the present invention, preferably, after automatically encapsulating the target model and the adapted inference engineering code into a service package conforming to standard specifications based on a predefined service abstraction interface, the method further includes: The SDK automatically identifies the target hardware environment and loads the matching service package. Run the service and implement dynamic parameter updates and indicator monitoring.

[0042] It can achieve the effect of service operation and parameter management.

[0043] As can be seen from the above description, this application achieves the following technical effects: In this embodiment, a general automated model porting and service encapsulation approach is adopted. By receiving the source model file and the target hardware platform identifier, the source model is automatically converted into a target model executable by the target hardware platform, and inference engineering code adapted to the target hardware platform is generated. Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package conforming to standard specifications, achieving end-to-end automation of model deployment across hardware platforms. This improves the deployment efficiency and standardization of AI models, thereby solving the problem that model porting often relies on manual processes, i.e., engineers manually use conversion tools provided by vendors to convert model formats and manually modify pre- and post-processing code to adapt to the target platform. This method suffers from problems such as low efficiency, long cycle, high skill requirements for engineers, susceptibility to errors, and difficulty in maintenance. Furthermore, although some model conversion tools exist, they are usually isolated and fail to effectively connect with subsequent service-oriented deployment processes, thus failing to provide an end-to-end automated solution.

[0044] like Figure 2 As shown, to achieve the above objectives, according to another aspect of this application, a general automation model porting and service encapsulation system is provided. This general automation model porting and service encapsulation system includes: The model automated porting module 201 is used to receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform. It can achieve automated model porting and can analyze and transform source models.

[0045] The service abstraction and encapsulation module 202 is used to automatically encapsulate the target model and the adapted inference engineering code into a service package that conforms to the standard specifications based on a predefined service abstraction interface.

[0046] It can achieve the effect of service abstraction and encapsulation, thereby obtaining standardized service packages.

[0047] As can be seen from the above description, this application achieves the following technical effects: In this embodiment, a general automated model porting and service encapsulation approach is adopted. By receiving the source model file and the target hardware platform identifier, the source model is automatically converted into a target model executable by the target hardware platform, and inference engineering code adapted to the target hardware platform is generated. Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package conforming to standard specifications, achieving end-to-end automation of model deployment across hardware platforms. This improves the deployment efficiency and standardization of AI models, thereby solving the problem that model porting often relies on manual processes, i.e., engineers manually use conversion tools provided by vendors to convert model formats and manually modify pre- and post-processing code to adapt to the target platform. This method suffers from problems such as low efficiency, long cycle, high skill requirements for engineers, susceptibility to errors, and difficulty in maintenance. Furthermore, although some model conversion tools exist, they are usually isolated and fail to effectively connect with subsequent service-oriented deployment processes, thus failing to provide an end-to-end automated solution.

[0048] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0049] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0050] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the general automation model porting and service encapsulation method.

[0051] In some embodiments, the general automation model porting and service encapsulation method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the general automation model porting and service encapsulation method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the general automation model porting and service encapsulation method by any other suitable means (e.g., by means of firmware).

[0052] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0053] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

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

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

[0056] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LA), wide area networks (WA), blockchain networks, and the Internet.

[0057] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0058] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

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

Claims

1. A general automation model porting and service encapsulation method, characterized in that, include: Receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform; Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are automatically encapsulated into a service package that conforms to standard specifications.

2. The general automation model porting and service encapsulation method according to claim 1, characterized in that, The system receives a source model file and a target hardware platform identifier, automatically converts the source model into a target model executable by the target hardware platform, and generates inference engineering code adapted to the target hardware platform, including: Automatically identify the model framework based on the type and structure of the source model; Automatically generate preprocessing and postprocessing code corresponding to the model; The model conversion toolchain is invoked to convert the model into a model format that can be recognized by the target computing platform, and model accuracy alignment and operator optimization are completed. The inference engine adaptation module generates the inference engineering code for the target platform.

3. The general automation model porting and service encapsulation method according to claim 1, characterized in that, Based on a predefined service abstraction interface, the target model and the adapted inference engineering code are included, including: The service template, which includes four interfaces—initialization, business processing, resource recycling, and parameter update—is automatically generated based on the service abstraction specification. Automatically generate corresponding service logic code based on a preset mapping table or rule base; The generated model is bound to the service logic to form a service entity.

4. The general automation model porting and service encapsulation method according to claim 1, characterized in that, Automatically packaged into service packages conforming to standard specifications, including: Automatically integrate model files, dependency libraries, and service configuration files; Compile and link according to different target platforms; Generate a standard service compressed package with a unified format.

5. The general automation model porting and service encapsulation method according to claim 1, characterized in that, Based on a predefined service abstraction interface, after automatically encapsulating the target model and the adapted inference engineering code into a service package conforming to standard specifications, it also includes: The SDK automatically identifies the target hardware environment and loads the matching service package. Run the service and implement dynamic parameter updates and indicator monitoring.

6. The general automation model porting and service encapsulation method according to claim 2, characterized in that, Automatic pre- and post-processing adaptation includes: Match the pre- and post-processing logic of template based on the tensor dimensions and data types of the model's input and output; The code generation module automatically generates processing functions in the corresponding language; The preprocessing output is mapped one-to-one with the model inference input interface to ensure data compatibility.

7. The general automation model porting and service encapsulation method according to claim 3, characterized in that, Automatically generate corresponding service logic code based on a preset mapping table or rule base, including: Based on a pre-defined function mapping table, the GPU API functions called by the source service are replaced to generate a target platform-compatible API; or, By using semantic recognition and template matching, the system automatically infers the next operation and generates reasoning, preprocessing, or postprocessing code.

8. A general automation model porting and service encapsulation system, characterized in that, include: The automated model porting module is used to receive the source model file and the target hardware platform identifier, automatically convert the source model into a target model executable by the target hardware platform, and generate inference engineering code adapted to the target hardware platform. The service abstraction and encapsulation module is used to automatically encapsulate the target model and the adapted inference engineering code into a service package that conforms to standard specifications, based on a predefined service abstraction interface.

9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the general automation model porting and service encapsulation method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the general automated model porting and service encapsulation method according to any one of claims 1 to 7.