Method and system for deploying model service
Through model file-based model mirroring and visual editing technology, combined with seldon core, the problem of inconvenient modification of node parameters in service orchestration is solved, and the flexible deployment and high availability of model services in Kubernetes clusters are achieved.
Patent Information
- Application Number
- CN202410626188.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-08-30
AI Technical Summary
Existing service orchestration technologies, such as ooize, define model service processes and logic through XML configuration files, which makes it inconvenient to modify model service node parameters and affects the flexibility and maintainability of deployment.
Using the model image based on the model file, dragging, pulling, and dragging the process nodes through visual editing operations, and deploying the model service in the Kubernetes cluster using seldon core, the model service node parameters can be flexibly modified and arranged.
It simplifies the process of modifying the model service node parameters, improves the flexibility and maintainability of deployment, and ensures the stable operation of the model service in the Kubernetes cluster.
Smart Images

Figure CN118567663A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method and system for deploying model services. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, the deployment of model services has become the focus of many enterprises and organizations. The deployment of model services aims to effectively integrate trained and optimized machine learning models into production environments to solve various practical problems and provide practical solutions. This process involves everything from selecting a suitable model to deploying it to appropriate hardware or cloud platforms and ensuring that it can provide stable services at runtime.
[0003] Among them, service orchestration, as a key link in deploying model services, has received extensive attention and research in recent years. Among them, one of the main service orchestration technologies is Ooize. Ooize provides a flexible and powerful way to manage the deployment process of model services by defining XML to build service processes. In this technology, model services are usually called by Python scripts, and the process and logic of the service are defined through the XML configuration file provided by Ooize. This approach makes the deployment of model services simpler and more controllable, while improving the maintainability and flexibility of the deployment process.
[0004] However, although service orchestration technologies such as Ooize have made significant progress in simplifying model service deployment, there are still some challenges in practical applications. In particular, since XML is used to define the service process, it is very inconvenient to modify the node parameters of the model service. Summary of the invention
[0005] The embodiments of the present invention provide a method and system for deploying a model service, so as to at least solve the problem in the related art that it is very inconvenient to modify the node parameters of the model service.
[0006] According to an embodiment of the present invention, a method for deploying a model service is provided, comprising:
[0007] Get the model image based on the model file;
[0008] Based on the model image, in response to a visualized editing operation on a process node, a model service is orchestrated;
[0009] Call seldon core to deploy the model service in the Kubernetes cluster.
[0010] Optionally, the method further comprises:
[0011] Establishing editable operations of input parameters and output parameters of the process node based on first preset parameters, wherein the input parameters and the output parameters are used to infer the model service;
[0012] The input parameters are adjusted based on the inference state of the model service, wherein the input parameters include at least one of the following: number of instances, CPU, and memory.
[0013] Optionally, the method further comprises:
[0014] Constructing related classes based on the input parameters;
[0015] Use the Kubernetes cluster to deploy services corresponding to the relevant classes.
[0016] Optionally, a model image is obtained based on the model file, including:
[0017] Get model files, environment, and related files;
[0018] The model image is obtained based on the model file, the environment, and the related files.
[0019] Optionally, the method further comprises:
[0020] Obtain the image creation instructions through the Java end and send the image packaging instructions;
[0021] Generate and process asynchronous tasks based on the image packaging instructions through the Python side;
[0022] Obtain the model file through the Python terminal and generate an executable source code file;
[0023] Based on the source code file, the model file, the environment, and the related files are packaged into a reference image through a source to image tool to obtain the model image;
[0024] Upload the model image to the artifact repository.
[0025] Optionally, based on the model image, in response to a visualized editing operation on a process node, a model service is orchestrated, including:
[0026] Building a visual editing interface based on the second preset parameters, wherein the visual editing interface allows operations of dragging, pulling, and dropping process nodes;
[0027] Providing options or parameters for each of the process nodes in the visual orchestration interface, so as to configure the process nodes based on the options or the parameters;
[0028] Providing an interactive editing function based on a third preset parameter, and modifying and adjusting the process node based on the interactive editing function;
[0029] The model service is orchestrated based on the modified and adjusted process nodes.
[0030] Optionally, the method further comprises:
[0031] Calling the model service based on the input parameters and output table information;
[0032] Inferring the model service based on the input parameters, and storing the inference process in the output table corresponding to the output table information;
[0033] When a signal that the model service inference ends is identified, the model service inference is stopped.
[0034] According to another embodiment of the present invention, a system for deploying a model service is also provided, including:
[0035] Image making module, used to obtain model image based on model file;
[0036] An orchestration module, configured to orchestrate a model service based on the model image and in response to a visual editing operation on a process node;
[0037] The deployment module is used to call seldon core to deploy the model service in the Kubernetes cluster.
[0038] Optionally, the system is also used to:
[0039] Establishing editable operations of input parameters and output parameters of the process node based on first preset parameters, wherein the input parameters and the output parameters are used to infer the model service;
[0040] The input parameters are adjusted based on the inference state of the model service, wherein the input parameters include at least one of the following: number of instances, CPU, and memory.
[0041] Optionally, the system is also used to:
[0042] Constructing related classes based on the input parameters;
[0043] Use the Kubernetes cluster to deploy services corresponding to the relevant classes.
[0044] Optionally, a model image is obtained based on the model file, the system is used to:
[0045] Get model files, environment, and related files;
[0046] The model image is obtained based on the model file, the environment, and the related files.
[0047] Optionally, the system is also used to:
[0048] Obtain the image creation instructions through the Java end and send the image packaging instructions;
[0049] Generate and process asynchronous tasks based on the image packaging instructions through the Python side;
[0050] Obtain the model file through the Python terminal and generate an executable source code file;
[0051] Based on the source code file, the model file, the environment, and the related files are packaged into a reference image through a source to image tool to obtain the model image;
[0052] Upload the model image to the artifact repository.
[0053] Optionally, based on the model image, in response to a visualized editing operation on a process node, a model service is orchestrated, the system being configured to:
[0054] Building a visual editing interface based on the second preset parameters, wherein the visual editing interface allows operations of dragging, pulling, and dropping process nodes;
[0055] Providing options or parameters for each of the process nodes in the visual orchestration interface, so as to configure the process nodes based on the options or the parameters;
[0056] Providing an interactive editing function based on a third preset parameter, and modifying and adjusting the process node based on the interactive editing function;
[0057] The model service is orchestrated based on the modified and adjusted process nodes.
[0058] Optionally, the system is also used to:
[0059] Calling the model service based on the input parameters and output table information;
[0060] Inferring the model service based on the input parameters, and storing the inference process in the output table corresponding to the output table information;
[0061] When a signal that the model service inference ends is identified, the model service inference is stopped.
[0062] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, wherein the computer program executes the steps in any of the above method embodiments when executed by a processor.
[0063] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0064] The present invention uses a model image based on a model file and responds to the editing operation of dragging, pulling, and dropping process nodes, which solves the problem of inconvenient modification of model service node parameters, and realizes the deployment of model services in Kubernetes clusters with the help of Seldon core. The combination of these technologies makes the deployment of model services simpler, more flexible, and more controllable. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0066] Figure 1 It is a structural schematic diagram of a computer terminal for executing a method for deploying a model service according to an embodiment of the present invention;
[0067] Figure 2 is a flowchart of a method for deploying a model service according to an embodiment of the present invention;
[0068] Figure 3 is a flow chart of a method for adjusting input parameters based on the inference state of a model service according to an embodiment of the present invention;
[0069] Figure 4 is a flowchart of a method for deploying services corresponding to related classes using a Kubernetes cluster according to an embodiment of the present invention;
[0070] Figure 5 is a flow chart of a method for obtaining a model image based on a model file, an environment, and related files according to an embodiment of the present invention;
[0071] Figure 6 is a flow chart of a method for making a model image according to an embodiment of the present invention;
[0072] Figure 7 is a flow chart of a method for orchestrating model services based on modified and adjusted process nodes according to an embodiment of the present invention;
[0073] Figure 8 is a flowchart of a method for stopping an inference model service according to an embodiment of the present invention;
[0074] Fig. 9 4 is a schematic diagram of the structure of a system for deploying model services according to an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0076] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0077] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 is a schematic diagram of the structure of a computer terminal for executing a method for deploying a model service according to an embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0078] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for deploying model services in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0079] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a gateway so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0080] In this embodiment, a method for deploying a model service is provided. Figure 2 is a flowchart of a method for deploying a model service according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0081] Step S201, obtaining a model image based on the model file;
[0082] In an exemplary implementation, the following method may be used:
[0083] The computer terminal calls Docker. If Docker is not detected, run the Docker installation command suitable for the operating system.
[0084] Create a Dockerfile based on the format and requirements of the model file. This file contains a series of instructions starting from the base image to build the model image.
[0085] In the computer terminal, use the Docker command to execute the build command to convert the Dockerfile into a model image. For example, run the docker build-t model-image:tag. command, where "model-image" is the name of the model image, "tag" is the version tag, and "." represents the current directory of the Dockerfile.
[0086] Step S202, based on the model image, in response to the visual editing operation on the process node, the model service is orchestrated;
[0087] In an exemplary implementation, the following method may be used:
[0088] The service orchestration tool installed and configured on the computer terminal is called.
[0089] Define the flow and logic of the model service according to the specifications and syntax of the service orchestration tool. This may involve creating and editing XML configuration files or using interface operations provided by other selected tools.
[0090] Use the visual editing operations provided by the service orchestration tool (for example, dragging, dropping, and dropping process nodes) to edit and re-orchestrate the model service according to needs. This can include operations such as adding, deleting, modifying nodes, and connecting nodes.
[0091] Step S203, call seldon core to deploy the model service in the Kubernetes cluster.
[0092] In an exemplary implementation, the following method may be used:
[0093] Call the seldon core tool installed and configured on the computer terminal.
[0094] In the computer terminal, use the command line tool or API provided by Seldon Core to create a deployment description file for the model service as needed. This description file contains the configuration information and parameters of the service.
[0095] Use the command line tools or APIs provided by seldon core to submit the model image and deployment description file to the Kubernetes cluster to complete the deployment of the model service. For the specific command or API call format, refer to the seldoncore documentation.
[0096] Through the above steps S201 to S203, compared with traditional service orchestration technologies (such as ooize), the present invention solves the problem of inconvenient modification of model service node parameters by using a model image based on a model file. Specifically, the method of the present invention uses a model file to create a model image, which contains complete configuration information and parameters of the model service. Then, by responding to the editing operation of dragging, pulling, and dropping the process node, the model service can be flexibly edited and rearranged.
[0097] In traditional service orchestration technology, the process and logic of the service are defined through XML configuration files. Modifying node parameters requires manual editing of XML files, which may be very inconvenient in practical applications. In the method of the present invention, by responding to the editing operation of dragging, pulling, and dropping process nodes, the model service can be edited and rearranged intuitively without manually editing complex XML files. This greatly simplifies the node parameter modification process of the model service and improves the maintainability and flexibility of the deployment process.
[0098] In addition, the method of the present invention also calls seldon core to deploy the model service in the Kubernetes cluster. Seldon core is an open source project for deploying and managing machine learning models. It provides a set of powerful tools and platforms to manage the life cycle of model services. By calling seldon core, the model service can be effectively deployed to the Kubernetes cluster to achieve high availability and scalability.
[0099] In summary, the present invention solves the problem of inconvenient modification of model service node parameters by using model images based on model files and responding to the editing operations of dragging, pulling, and dropping process nodes, and realizes the deployment of model services in Kubernetes clusters with the help of Seldon core. The combination of these technologies makes the deployment of model services simpler, more flexible, and more controllable.
[0100] Figure 3 is a flow chart of a method for adjusting input parameters based on the inference state of a model service according to an embodiment of the present invention. In one implementation, Figure 3 As shown, the method also includes:
[0101] Step S301, establishing editable operations of input parameters and output parameters of a process node based on first preset parameters, wherein the input parameters and output parameters are used for reasoning model services;
[0102] In an exemplary implementation, the following method may be used:
[0103] Define the process nodes of the model service and the input and output parameters of each node according to the specifications and syntax of the service orchestration tool. This can involve creating and editing XML configuration files or using the interface operations provided by other selected tools.
[0104] Using the editing function provided by the service orchestration tool, you can edit the input parameters and output parameters of the node. This can include setting the parameter's data type, name, default value, etc.
[0105] Depending on the specific parameters, the required input parameters and output parameters can be defined for each node for use when inferring the model service.
[0106] Step S302: adjust input parameters based on the inference state of the model service, wherein the input parameters include at least one of the following: number of instances, CPU, and memory.
[0107] In an exemplary implementation, the following method may be used:
[0108] Use the deployment tool to create a deployment descriptor file for the model service, which can specify the input parameters for inference state adjustment of the model service. This can include the number of instances, CPU, and memory.
[0109] Use your chosen configuration management tool, such as ConfigMap for Kubernetes or environment variables for Docker Swarm, to configure the inference state conditioning input parameters as values in environment variables or configuration files.
[0110] Depending on the specific parameters, you can adjust the value of the inference state input parameter according to the load and requirements of the model service. For example, you can increase or decrease the number of instances, adjust the allocation of CPU and memory, etc.
[0111] Figure 4 is a flowchart of a method for deploying services corresponding to related classes using a Kubernetes cluster according to an embodiment of the present invention. In one implementation, Figure 4 As shown, the method also includes:
[0112] Step S401, constructing related classes based on input parameters;
[0113] In an exemplary implementation, the following method may be used:
[0114] Create a new project or module in the programming language of your choice and define the relevant classes in the project.
[0115] Design and implement the structure and functionality of related classes based on the input parameter requirements. This may involve creating classes, methods, properties, etc. to meet the needs of the model service.
[0116] Add necessary business logic to the class, such as processing input parameters, calling model services, processing output results, etc.
[0117] Automatically compile or interpret code to ensure the correctness of related classes.
[0118] Step S402: Use the Kubernetes cluster to deploy services corresponding to related classes.
[0119] In an exemplary implementation, the following method may be used:
[0120] Create a Kubernetes deployment description file (Deployment) based on the parameters to define the deployment specifications of the service corresponding to the relevant class. The file should specify information such as container image, container port, resource requirements, etc.
[0121] In the deployment descriptor, set the container image to the container image of the application that contains the relevant classes. You can use Docker to package the relevant classes into a container image and then publish it to the image repository in the Kubernetes cluster.
[0122] Configure other properties in the deployment descriptor, such as container ports, resource requirements (CPU, memory), etc. Based on the parameters, you can adjust the number of replicas of the container and other deployment settings.
[0123] Use Kubernetes command-line tools such as Kubectl to apply the deployment description file to the Kubernetes cluster and start the services corresponding to the relevant classes.
[0124] Use tools such as Kubectl to verify the running status and access method of the service. You can view the log output of related classes, the URL for accessing the service, etc.
[0125] Figure 5 is a flow chart of a method for obtaining a model image based on a model file, an environment, and related files according to an embodiment of the present invention. In one implementation, Figure 5 As shown, a model image is obtained based on the model file, including:
[0126] Step S501, obtaining model files, environment, and related files;
[0127] In an exemplary implementation, the following method may be used:
[0128] Run the terminal or command line interface and navigate to the directory where the file is stored or the project directory.
[0129] Use Git commands or other methods to obtain model files, environments, and other related files from the code repository. You can use the git clone command to clone the code repository, or download the corresponding files directly.
[0130] Check whether the obtained files contain the required model files, environment and other related files. According to the actual parameters, you can organize, rename or download the missing files.
[0131] Identify and confirm that the required model files, environments, and other related files are in the appropriate directories or locations for subsequent steps.
[0132] Step S502, obtaining a model image based on the model file, environment, and related files.
[0133] In an exemplary implementation, the following method may be used:
[0134] Compute Terminal Open a terminal or command line interface and navigate to the directory that contains the model files, environment, and other related files.
[0135] Create a Dockerfile file to define the build specifications of the model image. In the Dockerfile, you can specify the base image, install the required environment dependencies, copy the model files and other related files, etc.
[0136] In the Dockerfile, use the appropriate Docker command to build the image. For example, specify the path of the Dockerfile file and the image name through the docker build command to execute the build process. The command will build according to the instructions in the Dockerfile and include the model file, environment, and other related files in the generated image.
[0137] Wait for the Docker image build process to complete. This may take some time, depending on the size and complexity of your model files, environments, and other related files.
[0138] Automatically check the output of the build process to ensure there are no errors or warnings and verify that the model image was successfully generated.
[0139] Figure 6 is a flow chart of a method for making a model image according to an embodiment of the present invention. In one implementation, Figure 6 As shown, the method also includes:
[0140] Step S601, obtaining the image making instruction through the Java end, and sending the image packaging instruction;
[0141] In an exemplary implementation, the following method may be used:
[0142] Read the code written in the Java program to interact with the terminal and send image packaging instructions. You can use Java's ProcessBuilder class to execute terminal commands.
[0143] Build the command in the Java code, including specifying the path and parameters of the image packaging tool, and use them as parameters of ProcessBuilder.
[0144] Call Java's ProcessBuilder to start a command and get the output of the command.
[0145] Identify the output of a command and perform error checking and other follow-up operations.
[0146] Step S602, generating and processing asynchronous tasks based on the image packaging instructions through the Python side;
[0147] In an exemplary implementation, the following method may be used:
[0148] Reads code written in a Python program to generate asynchronous tasks and process image packaging instructions.
[0149] Select the appropriate Python asynchronous task processing tool based on the parameters, such as asyncio or Celery.
[0150] Define functions or methods in Python code to execute image packaging instructions.
[0151] Call the relevant functions or methods provided by the asynchronous task processing tool, submit the image packaging instruction as a task, and wait for the task to complete.
[0152] Identify the results of processing tasks, including error checking and other follow-up actions.
[0153] Step S603, obtaining the model file through the Python terminal and generating an executable source code file;
[0154] In an exemplary implementation, the following method may be used:
[0155] Identify code written in a Python program to take a model file and generate a runnable source code file.
[0156] Use appropriate Python libraries or modules, such as requests, urllib, etc., to download or retrieve model files.
[0157] Save the obtained model file to the specified directory or location.
[0158] According to the required model running environment, write code to generate an executable source code file, where the source code file can be a Python source code file, such as a py format file. This may include installing the required dependent libraries, configuring environment variables, setting startup scripts, etc.
[0159] Step S604: Pack the model file, environment, and related files into the reference image using the source to image tool to obtain the model image;
[0160] In an exemplary implementation, the following method may be used:
[0161] In a terminal or command line interface, navigate to the directory containing the model files, environments, and other related files.
[0162] Use the S2I (source to image) command to package the model files, environment, and other related files into the baseline image according to the specific S2I tools and requirements. Depending on the requirements of the tool, you may need to provide a Dockerfile, build context, and other parameters.
[0163] Wait for the S2I tool's build process to complete. This may take some time, depending on the size and complexity of your model files, environments, and other related files.
[0164] Check the output of the build process to ensure there are no errors or warnings, and verify that the model image was successfully generated.
[0165] Step S605: upload the model image to the product library.
[0166] In an exemplary implementation, the following method may be used:
[0167] In the terminal or command line interface, log in to the account of the target artifact repository (such as Docker Hub, private Docker Registry, etc.).
[0168] Execute the relevant commands to upload the model image to the artifact library. The specific commands and parameters depend on the artifact library used.
[0169] Wait for the upload process to complete to ensure that the model image has been successfully uploaded to the artifact library.
[0170] Check whether the uploaded model image exists in the artifact library and verify whether the uploaded model image is available.
[0171] Figure 7is a flow chart of a method for orchestrating model services based on modified and adjusted process nodes according to an embodiment of the present invention. In one implementation, Figure 7 As shown, based on the model image, in response to the visual editing operation of the process node, the model service is orchestrated, including:
[0172] Step S701, building a visual editing interface based on the second preset parameters, wherein the visual editing interface allows operations of dragging, pulling, and dropping process nodes;
[0173] In an exemplary implementation, the following method may be used:
[0174] Based on preset parameters, use front-end development technologies such as HTML, CSS, and JavaScript to create a visual orchestration interface. You can use open source tools such as React, Vue.js, etc.
[0175] Provide drag-and-drop functionality in the interface, allowing users to select nodes from a node library and drag and drop them onto the canvas.
[0176] Define the appearance and functionality of a node, and visualize it so that users can manipulate it.
[0177] Step S702, providing options or parameters for each process node in the visual arrangement interface, so as to configure the process node based on the options or parameters;
[0178] In an exemplary implementation, the following method may be used:
[0179] On the orchestration interface, a configuration panel is provided for each node to allow the user to set options or parameters of the node.
[0180] The configuration panel may include form elements such as text input boxes, drop-down menus, check boxes, etc., so that users can enter the required configuration.
[0181] Step S703, providing an interactive editing function based on the third preset parameter, and modifying and adjusting the process node based on the interactive editing function;
[0182] In an exemplary implementation, the following method may be used:
[0183] On the orchestration interface, users are provided with interactive editing functions for modifying and adjusting process nodes.
[0184] This can include dragging nodes to rearrange their positions, connecting nodes to define the flow of data between them, and adjusting a node's parameters or options.
[0185] Step S704: Orchestrate model services based on the modified and adjusted process nodes.
[0186] In an exemplary implementation, the following method may be used:
[0187] Generates the orchestration description or configuration file of the model service based on the user's edits on the orchestration interface.
[0188] These descriptions or configuration files can be parsed and executed using specific model serving frameworks or tools, such as TensorFlow Serving, Docker, etc.
[0189] Figure 8 is a flowchart of a method for stopping an inference model service according to an embodiment of the present invention. In one implementation, Figure 8 As shown, the method also includes:
[0190] Step S801, calling the model service based on input parameters and output table information;
[0191] In an exemplary implementation, the following method may be used:
[0192] First, prepare the model service interface or API, which should include the definition of input parameters and the return of output table information.
[0193] Based on the parameters, develop a client application or interface that can receive the input parameters and output table information and pass it to the model service.
[0194] In the client application, according to specific requirements and implementation methods, use the corresponding programming language and framework to initiate HTTP requests or call the API of the model service, pass input parameters, and wait for the response of the model service.
[0195] After receiving the response from the model service, you can process or store the output table information for subsequent use.
[0196] Step S802, inferring the model service based on the input parameters, and storing the inference process in the output table corresponding to the output table information;
[0197] In an exemplary implementation, the following method may be used:
[0198] Input parameters are passed to the model service in response to a request constructed on a computer terminal using a client application or interface.
[0199] Send the request to the model service API and wait for the model service to perform inference.
[0200] The model service performs inference based on the input parameters and generates inference results.
[0201] The inference results are stored in the output table corresponding to the output table information, and the results can be written to a database, file, or other data storage medium.
[0202] Step S803, stop the inference model service when the signal indicating the end of model service inference is identified.
[0203] In an exemplary implementation, the following method may be used:
[0204] In model service, a signal or flag is introduced to indicate whether the reasoning process is completed.
[0205] During inference in model serving, this signal or flag is checked periodically.
[0206] When the inference end signal is detected, the model service stops the inference process and returns the corresponding result.
[0207] According to another embodiment of the present invention, a system for deploying model services is also provided. Fig. 9 is a schematic diagram of the structure of a system for deploying model services according to an embodiment of the present invention. Fig. 9 As shown, the system includes:
[0208] An image making module 91 is used to obtain a model image based on a model file;
[0209] An orchestration module 92, configured to orchestrate a model service based on the model image and in response to a visual editing operation on a process node;
[0210] The deployment module 93 is used to call the seldon core to deploy the model service in the Kubernetes cluster.
[0211] In one embodiment, the system is also used to:
[0212] Establishing editable operations of input parameters and output parameters of a process node based on the first preset parameters, wherein the input parameters and output parameters are used for the inference model service;
[0213] The input parameters are adjusted based on the inference state of the model service, where the input parameters include at least one of the following: number of instances, CPU, and memory.
[0214] In one embodiment, the system is also used to:
[0215] Build related classes based on input parameters;
[0216] Use the Kubernetes cluster to deploy services corresponding to related classes.
[0217] In one embodiment, the system is used to obtain a model image based on the model file:
[0218] Get model files, environment, and related files;
[0219] Get the model image based on the model file, environment, and related files.
[0220] In one embodiment, the system is also used to:
[0221] Obtain the image creation instructions through the Java end and send the image packaging instructions;
[0222] Generate and process asynchronous tasks based on image packaging instructions through the Python side;
[0223] Get the model file through Python and generate an executable source code file;
[0224] Use the source to image tool to package the model file, environment, and related files into the baseline image to obtain the model image;
[0225] Upload the model image to the artifact repository.
[0226] In one embodiment, based on the model image, in response to a visual editing operation on a process node, a model service is orchestrated, and the system is used to:
[0227] A visual editing interface is formed based on the second preset parameters, wherein the visual editing interface allows operations of dragging, pulling, and dropping process nodes;
[0228] Providing options or parameters for each process node in the visual orchestration interface to configure the process node based on the options or parameters;
[0229] Providing an interactive editing function based on a third preset parameter, and modifying and adjusting a process node based on the interactive editing function;
[0230] Orchestrate model services based on modified and adjusted process nodes.
[0231] In one embodiment, the system is also used to:
[0232] Call model services based on input parameters and output table information;
[0233] Infer the model service based on the input parameters and store the inference process in the output table corresponding to the output table information;
[0234] Stop the inference model service when the signal of the end of model service inference is recognized.
[0235] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0236] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above method embodiments are executed.
[0237] In one implementation, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0238] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0239] In one implementation manner, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment will not be described in detail herein.
[0240] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0241] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for deploying a model service, characterized in that: include: Get the model image based on the model file; Based on the model image, in response to a visualized editing operation on a process node, a model service is orchestrated; Call seldon core to deploy the model service in the Kubernetes cluster.
2. The method according to claim 1, characterized in that Also includes: Establishing editable operations of input parameters and output parameters of the process node based on first preset parameters, wherein the input parameters and the output parameters are used to infer the model service; The input parameters are adjusted based on the inference state of the model service, wherein the input parameters include at least one of the following: number of instances, CPU, and memory.
3. The method according to claim 2, characterized in that Also includes: Constructing related classes based on the input parameters; Use the Kubernetes cluster to deploy services corresponding to the relevant classes.
4. The method according to claim 1, characterized in that: Get the model image based on the model file, including: Get model files, environment, and related files; The model image is obtained based on the model file, the environment, and the related files.
5. The method according to claim 4, characterized in that Also includes: Obtain the image creation instructions through the Java end and send the image packaging instructions; Generate and process asynchronous tasks based on the image packaging instructions through the Python side; Obtain the model file through the Python terminal and generate an executable source code file; Based on the source code file, the model file, the environment, and the related files are packaged into a reference image through a source to image tool to obtain the model image; Upload the model image to the artifact repository.
6. The method according to claim 1, characterized in that Based on the model image, in response to a visual editing operation on a process node, a model service is orchestrated, including: Building a visual editing interface based on the second preset parameters, wherein the visual editing interface allows operations of dragging, pulling, and dropping process nodes; Providing options or parameters for each of the process nodes in the visual orchestration interface, so as to configure the process nodes based on the options or the parameters; Providing an interactive editing function based on a third preset parameter, and modifying and adjusting the process node based on the interactive editing function; The model service is orchestrated based on the modified and adjusted process nodes.
7. The method according to claim 1, characterized in that Also includes: Calling the model service based on the input parameters and output table information; Inferring the model service based on the input parameters, and storing the inference process in the output table corresponding to the output table information; When a signal that the model service inference ends is identified, the model service inference is stopped.
8. A system for deploying a model service, characterized in that: include: Image making module, used to obtain model image based on model file; An orchestration module, configured to orchestrate a model service based on the model image and in response to a visual editing operation on a process node; The deployment module is used to call seldon core to deploy the model service in the Kubernetes cluster.
9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program executes the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
