A real-time model calling method and device
By converting the model into a preset file and generating an interface address, the problem of complex model release process and difficult update is solved, rapid model release and hot deployment are achieved, efficiency and management are improved, and costs are reduced.
Patent Information
- Application Number
- CN201911121086.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-15
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2039-11-15
AI Technical Summary
The model release process in the existing technology is complex, difficult to update, and difficult to manage, resulting in high development and operation and maintenance costs, a long project launch cycle, and the inability to achieve hot deployment.
By receiving the uploaded model, converting it into a preset file and generating an interface address, loading the file according to user requests to obtain prediction results, using cloud storage and service clusters for unified management and version compatibility control of the model, and using the application container engine Quickly install and deploy the environment.
It achieves rapid release and hot deployment of models, reduces repeated development, improves efficiency, saves costs, and supports unified management and version compatibility of models.
Smart Images

Figure CN112817737B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a real-time model calling method and device. Background Art
[0002] At present, algorithm models need to operate in a certain environment from processing data, training models, to deploying models. A complex deployment process is required when going online. Real-time model services need to be provided to external users through secondary development, and cooperation between algorithm and engineering-related personnel is required, which invisibly wastes a lot of manpower and material resources.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] In order to launch the model, it is necessary to apply for servers, domain names, storage and other resources to deploy the model. At the same time, the operation of the algorithm model depends on the specific environment. Every algorithm project needs to install the corresponding algorithm environment, which not only increases the development and later operation and maintenance costs, but also increases the project launch cycle. In addition, when releasing a new model, it is necessary to recompile, submit an online application, restart the service, and release the model, and hot deployment cannot be achieved. In addition, the models are scattered and deployed in various systems, which is not conducive to the unified management of the model and there are also problems with the version compatibility of the model software package. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a model real-time calling method and device, which can solve the problems of complex model publishing process, difficult updating, and difficult management.
[0006] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a real-time model calling method is provided, including receiving an uploaded model, converting the model into a preset file, and generating an interface address; sending the interface address to load the file according to a user request, and then obtaining a prediction result based on the model.
[0007] Optionally, receiving the uploaded model and converting the model into a preset file includes:
[0008] Receiving an uploaded model, and saving the model to cloud storage;
[0009] The model conversion interface is called to download the model from the cloud storage, and then the model is loaded to generate a preset file, and the file is saved to the cloud storage.
[0010] Optionally, receiving the uploaded model and converting the model into a preset file further includes:
[0011] According to the type of the model, a message is sent to the corresponding service cluster, so that each node on the service cluster downloads the file from the cloud storage to the local path after receiving the message.
[0012] Optionally, loading the file according to a user request to obtain a prediction result based on the model includes:
[0013] Receive a user request and read the locally stored file through a file loading interface;
[0014] Calling the model prediction interface, passing in the model sample features in the request, and then obtaining the prediction results;
[0015] Based on the prediction results, determine whether the model prediction interface is abnormal. If so, call the abnormal statistics interface of the monitoring component to record the abnormal data; otherwise, call the performance statistics interface of the monitoring component to record the time consumed by the current request.
[0016] Optionally, before loading the interface via file, include:
[0017] Receive a user request, obtain the model type in the request, and route the request to a corresponding service cluster;
[0018] The request is routed to a node by load balancing the nodes in the service cluster.
[0019] Optionally, after obtaining the prediction result based on the model, the following steps are included:
[0020] According to a preset timed task, a prediction result based on the model within a preset time period is obtained, and then an object in the prediction result is extracted to search for execution data of the object in a target system;
[0021] Based on the prediction results and execution data, the evaluation interface is called to calculate the corresponding indicators.
[0022] Optionally, it also includes:
[0023] Using the application container engine, write a text document for building an image to install a software package in the image of the application container engine.
[0024] In addition, according to one aspect of an embodiment of the present invention, a real-time model calling device is provided, including a conversion module for receiving an uploaded model, converting the model into a preset file, and generating an interface address; a sending module for sending the interface address to load the file according to a user request, and then obtain a prediction result based on the model.
[0025] Optionally, the conversion module receives the uploaded model and converts the model into a preset file, including:
[0026] Receiving an uploaded model, and saving the model to cloud storage;
[0027] The model conversion interface is called to download the model from the cloud storage, and then the model is loaded to generate a preset file, and the file is saved to the cloud storage.
[0028] Optionally, the conversion module receives the uploaded model and converts the model into a preset file, further comprising:
[0029] According to the type of the model, a message is sent to the corresponding service cluster, so that each node on the service cluster downloads the file from the cloud storage to the local path after receiving the message.
[0030] Optionally, the sending module loads the file according to a user request, and then obtains a prediction result based on the model, including:
[0031] Receive a user request and read the locally stored file through a file loading interface;
[0032] Calling the model prediction interface, passing in the model sample features in the request, and then obtaining the prediction results;
[0033] Based on the prediction results, determine whether the model prediction interface is abnormal. If so, call the abnormal statistics interface of the monitoring component to record the abnormal data; otherwise, call the performance statistics interface of the monitoring component to record the time consumed by the current request.
[0034] Optionally, before the sending module loads the file through the interface, the sending module includes:
[0035] Receive a user request, obtain the model type in the request, and route the request to a corresponding service cluster;
[0036] The request is routed to a node by load balancing the nodes in the service cluster.
[0037] Optionally, after the sending module obtains the prediction result based on the model, it includes:
[0038] According to a preset timed task, a prediction result based on the model within a preset time period is obtained, and then an object in the prediction result is extracted to search for execution data of the object in a target system;
[0039] Based on the prediction results and execution data, the evaluation interface is called to calculate the corresponding indicators.
[0040] Optionally, the conversion module is further used to:
[0041] Using the application container engine, write a text document for building an image to install a software package in the image of the application container engine.
[0042] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0043] one or more processors;
[0044] a storage device for storing one or more programs,
[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above model calling embodiments.
[0046] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any of the above model-based calling embodiments is implemented.
[0047] One embodiment of the above invention has the following advantages or beneficial effects: the present invention receives an uploaded model, converts the model into a preset file, and generates an interface address; sends the interface address to load the file according to a user request, and then obtains a prediction result based on the model. Therefore, the present invention can realize rapid model release, and does not need to repeatedly develop for different models, thereby improving efficiency and saving costs.
[0048] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0050] Figure 1 Schematic diagram of the main process of the real-time model calling method according to the first embodiment of the present invention
[0051] Figure 2 is a schematic diagram of the main process of the real-time model calling method according to the second embodiment of the present invention;
[0052] Figure 3 It is a schematic diagram of the main process of the foreground model real-time calling method according to the present invention;
[0053] Figure 4 is a schematic diagram of main modules of a model real-time calling device according to an embodiment of the present invention;
[0054] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0055] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0057] Figure 1 : is a schematic diagram of the main process of the real-time model calling method according to the first embodiment of the present invention. The real-time model calling method may include:
[0058] Step S101, receiving an uploaded model, converting the model into a preset file, and generating an interface address.
[0059] Preferably, the uploaded model is received and saved to cloud storage, then the model conversion interface is called to download the model from the cloud storage, and then the model is loaded to generate a preset file, and the file is saved to the cloud storage.
[0060] Furthermore, after the file is saved in the cloud storage, a message can be sent to the corresponding service cluster according to the type of the model, so that each node on the service cluster downloads the file from the cloud storage to a local path after receiving the message.
[0061] Step S102, sending the interface address to load the file according to the user request, and then obtaining the prediction result based on the model.
[0062] Preferably, a user request is received, and the locally stored file is read through a file loading interface. Then, the model prediction interface is called, and the model sample features in the request are passed in to obtain the prediction result. Based on the prediction result, it is determined whether the model prediction interface is abnormal. If so, the abnormal statistics interface of the monitoring component is called to record the abnormal data; otherwise, the performance statistics interface of the monitoring component is called to record the time consumption of the current request.
[0063] Furthermore, after receiving a user request, the model type in the request may be obtained to route the request to a corresponding service cluster, and then the request may be routed to a node by load balancing each node in the service cluster.
[0064] It is also worth noting that after executing step S102, the prediction results based on the model within a preset time period can be obtained according to the preset timed task, and then the objects in the prediction results can be extracted to find the execution data of the objects in the target system. Based on the prediction results and the execution data, the evaluation interface is called to calculate the corresponding indicators.
[0065] As a preferred embodiment, the present invention adopts an application container engine to write a text document for building an image to install a software package in the image of the application container engine. That is to say, to solve various environmental problems that the operation depends on, the present invention adopts the application container engine (Docker) technology to write a text document (Dockerfile) for building an image, and installs various software packages such as Anaconda, LightGBM, XGBoost, Flask, Keras, TensorFlow, ONNX, JAVA, Tomcat, Nginx, etc. in the application container engine image to achieve rapid installation of the deployment environment.
[0066] Therefore, the present invention proposes a method for real-time model calling, which can quickly publish models without repeatedly developing systems for different models, thereby achieving the effect of improving efficiency and saving costs, and further realizing that users only need to upload models, and the system automatically generates HTTP or RPC services that can be called in real time, that is, the user experience of uploading and using them. At the same time, the present invention supports hot deployment of models, and directly publishes or upgrades models without restarting the service.
[0067] Figure 2 : is a schematic diagram of the main process of the real-time model calling method according to the second embodiment of the present invention. The real-time model calling method may include:
[0068] Step S201, receiving the uploaded model and saving the model to cloud storage.
[0069] Preferably, the model upload function is implemented through Spring's CommonsMultipartResolver technology. Among them, Spring is a lightweight inversion of control (IoC) and aspect-oriented (AOP) container framework. CommonsMultipartResolver implements the file upload function based on Apache's Commons FileUpload.
[0070] Step S202, calling the model conversion interface, downloading the model from the cloud storage, and then loading the model to generate a preset file, saving the file to the cloud storage, and generating an interface address.
[0071] Preferably, define the interface Model2ONNXService for converting models to Open Neural Network Exchange (ONNX) files. Based on the Open Neural Network Exchange technology, for different models, implement SKlearn2ONNX, XGBoost2ONNX, LightGBM 2ONNX, Keras2ONNX, PyTorch2ONNX, SparkML2ONNX, TensorFlow2ONNX and other methods. For different models, call different implementation methods to convert the model into a neural network exchange file and upload it to the cloud storage.
[0072] Among them, ONNX, Open Neural Network Exchange, is an open file format designed for machine learning and used to store trained models. It enables different artificial intelligence frameworks (such as Pytorch, LightGBM, MXNet) to store model data in the same format and interact with each other.
[0073] Step S203, according to the type of the model, a message is sent to the corresponding service cluster, so that each node on the service cluster downloads the file from the cloud storage to the local path after receiving the message.
[0074] Preferably, according to the type of model (such as XGBoost algorithm or LightGBM algorithm, etc.), an MQ message is sent to the corresponding algorithm service cluster. After receiving the message, each node on the algorithm service cluster downloads the open neural network exchange file from the cloud storage to the local path. When a real-time request is received, the open neural network exchange file is directly loaded, reducing the steps of downloading files from the cloud storage and improving the interface response time.
[0075] Step S204, sending the interface address to load the file according to the user request, and then obtaining the prediction result based on the model. The specific implementation process includes: Figure 3 As shown:
[0076] Step S301: receiving a user request, obtaining a model type in the request, and routing the request to a corresponding service cluster.
[0077] Preferably, after starting a web service through Flask, user requests are received. For HTTP requests, a RESTful style link form is adopted: http(s) / / domain / algorithm type / algorithm name / algorithm version / sample feature value. Flask is a lightweight web application framework written in Python and based on the MVC design pattern.
[0078] For example, the XGBoost (extreme gradient boosting) algorithm for predicting the type of iris flowers, the algorithm name is xgboost-iris, the version number is 1, and the generated http link is http: / / domian / xgboost / xgboost-iris / 1 / .
[0079] When predicting the type of iris flowers using sample features 6.3, 2.3, 4.4, and 1.3, visit http: / / domian / xgboost / xgboost-iris / 1 / 6.3,2.3,4.4,1.3 to get the results.
[0080] It is also worth mentioning that the model type can be obtained according to the URL (Uniform Resource Locator) in the request.
[0081] Step S302: Routing the request to a node by load balancing the nodes in the service cluster.
[0082] Preferably, on each node of the service cluster, the load is allocated to one of the servers through the load balancing configuration of Nginx, which is a high-performance HTTP and reverse proxy web server.
[0083] In addition, after receiving the request, the node server first calls the call count interface of the monitoring component and records the call count. Further, the model monitoring layer calls the call count interface of the monitoring component, and the storage layer records the call count.
[0084] Step S303: The node reads the locally stored file through a file loading interface.
[0085] Preferably, the locally existing open neural network exchange file is read through the open neural network exchange file loading interface LoadONNXService.
[0086] Step S304: the node calls the model prediction interface, passes in the model sample features in the request, and obtains the prediction result.
[0087] Preferably, the model prediction interface PredictService is called, sample features are passed in, and the results are predicted.
[0088] Step S305: The node determines whether the model prediction interface is abnormal based on the prediction result. If so, the abnormal statistics interface of the monitoring component is called to record the abnormal data; otherwise, the performance statistics interface of the monitoring component is called to record the time consumed by the current request.
[0089] Preferably, the prediction results can be encapsulated.
[0090] Step S205, according to the preset timed task, obtain the prediction result based on the model within the preset time period.
[0091] Step S206: extract the object in the prediction result to search for execution data of the object in the target system.
[0092] For example, to predict whether a user will place an order, the user ID in the prediction sample is used to query the order system to determine whether the user has placed an order.
[0093] Step S207: Based on the prediction results and execution data, the evaluation interface is called to calculate corresponding indicators.
[0094] In an embodiment, the evaluation interface may include interfaces for calculating precision, accuracy, recall, etc., and may be capable of multi-threaded concurrent calculations. In addition, the calculation results may be stored in MySql.
[0095] It is worth noting that steps S201 to S207 are all based on the following image environment, and an application container engine can be used to write a text document for building an image to install a software package in the image of the application container engine.
[0096] As an embodiment of the present invention, a model call hierarchical framework is designed, which is divided into 6 layers: service interface layer (Service), core control layer (Control), model conversion layer (Transition), model monitoring layer (Monitor), model evaluation layer (Evaluation) and storage layer (Storage).
[0097] Among them, the service interface layer (Service) is related to the actual business. According to the business of the model provider and the model caller, the corresponding interface and implementation are designed. For example, for the model provider, the model upload, release, offline and other interfaces are designed. For the model caller, two API calling methods, HTTP and RPC (Remote Procedure Call) are provided.
[0098] The core control layer (Control) encapsulates the routing and load balancing of multiple model service providers. It parses the requests transmitted from the service interface layer and routes different model requests to the corresponding service clusters.
[0099] The model conversion layer (Transition) can automatically convert various models uploaded by the model provider into ONNX files.
[0100] The model monitoring layer (Monitor) is responsible for monitoring the number of model calls, number of exceptions, TPS (Transactions Per Second) performance, etc. It handles problematic models in a timely manner, such as those with no calls for a long time, frequent errors, and excessive TPS.
[0101] The model evaluation layer (Evaluation) can define evaluation formulas for indicators such as accuracy, precision, and recall based on business classification. The model is scored and ranked by statistically analyzing the prediction results and execution data of the model over a period of time.
[0102] The storage layer (Storage) is responsible for interacting with various data sources and provides interfaces and implementations for communicating with cloud storage systems, NoSQL databases, and relational databases.
[0103] In a specific embodiment, the model real-time calling method of the present invention is directed to the background: the service interface layer receives the uploaded model, and the storage layer saves the model to the cloud storage. Then the model conversion layer calls the model conversion interface, the storage layer downloads the model from the cloud storage, and then the model conversion layer loads the model to generate a preset file, and the storage layer saves the file to the cloud storage.
[0104] Furthermore, after the storage layer saves the file to the cloud storage, the model conversion layer can send a message to the corresponding service cluster according to the type of the model, so that after each node on the service cluster receives the message, it downloads the file from the cloud storage to the local path through the storage layer.
[0105] It is also worth noting that when the model real-time call method is used to evaluate the model, the service interface layer can obtain the prediction results based on the model within a preset time period according to the preset timed tasks, and then extract the objects in the prediction results. The service interface layer searches for the execution data of the objects in the target system. The model evaluation layer calls the evaluation interface based on the prediction results and execution data to calculate the corresponding indicators.
[0106] In addition, the real-time model calling method described in the present invention is aimed at the foreground: the service interface layer receives the user request, and the core control layer routes the request to a node by load balancing the nodes of the service cluster. The core control layer reads the locally stored file through the file loading interface. And calls the model prediction interface, passes in the model sample features in the request, and then obtains the prediction result. Based on the prediction result, the core control layer determines whether the model prediction interface is abnormal. If so, the model monitoring layer calls the abnormal statistics interface of the monitoring component, and the storage layer records the abnormal data; otherwise, the model monitoring layer calls the performance statistics interface of the monitoring component, and the storage layer records the time consumed by the current request.
[0107] Figure 4 Schematic diagram of main modules of the real-time model calling device according to the first embodiment of the present invention. Figure 4 As shown, the model real-time calling device 400 includes a conversion module 401 and a sending module 402. The conversion module 401 receives the uploaded model, converts the model into a preset file, and generates an interface address. The sending module 402 sends the interface address to load the file according to the user request, thereby obtaining the prediction result based on the model.
[0108] Preferably, the conversion module 401 receives the uploaded model and converts the model into a preset file, including:
[0109] Receive the uploaded model and save the model to cloud storage. Then, call the model conversion interface, download the model from cloud storage, load the model to generate a preset file, and save the file to cloud storage.
[0110] Furthermore, the conversion module 401 receives the uploaded model and converts the model into a preset file, and further includes:
[0111] According to the type of the model, a message is sent to the corresponding service cluster, so that each node on the service cluster downloads the file from the cloud storage to the local path after receiving the message.
[0112] As another preferred embodiment, the sending module 402 loads the file according to the user request, and then obtains the prediction result based on the model, including:
[0113] Receive user requests and read the locally stored file through the file loading interface. Call the model prediction interface, pass in the model sample features in the request, and then obtain the prediction result. Based on the prediction result, determine whether the model prediction interface is abnormal. If so, call the abnormal statistics interface of the monitoring component to record the abnormal data; otherwise, call the performance statistics interface of the monitoring component to record the time consumed by the current request.
[0114] Furthermore, before the sending module 402 passes through the file loading interface, it includes:
[0115] Receive a user request, obtain the model type in the request, and route the request to a corresponding service cluster. Route the request to a node by load balancing each node in the service cluster.
[0116] As another embodiment of the present invention, after the sending module 402 obtains the prediction result based on the model, it can obtain the prediction result based on the model within a preset time period according to the preset timed task, and then extract the object in the prediction result to find the execution data of the object in the target system. Based on the prediction result and the execution data, the evaluation interface is called to calculate the corresponding index.
[0117] It is also worth noting that the conversion module 401 can use an application container engine to write a text document for building an image, so as to install various required software packages in the image of the application container engine.
[0118] It should be noted that the model real-time calling method and the model real-time calling device described in the present invention have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.
[0119] Figure 5 An exemplary system architecture 500 is shown to which the real-time model calling method or the real-time model calling device according to the embodiment of the present invention can be applied.
[0120] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0121] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0122] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0123] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0124] It should be noted that the real-time model calling method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the real-time model calling device is generally set in the server 505 .
[0125] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0126] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device 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.
[0127] like Figure 6 As shown, the computer system 800 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0128] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0129] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0130] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0131] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0132] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, it may be described as follows: a processor includes a conversion module and a sending module. The names of these modules do not, in some cases, limit the modules themselves.
[0133] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving an uploaded model, converting the model into a preset file, and generating an interface address; sending the interface address to load the file according to a user request, and then obtaining a prediction result based on the model.
[0134] The technical solution according to the embodiment of the present invention can solve the problems that the existing model publishing process is complicated, updating is difficult, and management is not easy.
[0135] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A real-time model calling method, characterized in that: include: Receive the uploaded model, identify the type of the model, call the corresponding implementation method, convert the model into a preset file, and generate an interface address; Sending the interface address to load the file according to a user request, thereby obtaining a prediction result based on the model; According to a preset timed task, a prediction result based on the model within a preset time period is obtained, and then an object in the prediction result is extracted to search for execution data of the object in a target system; Based on the prediction results and execution data, the evaluation interface is called to calculate the corresponding indicators.
2. The method according to claim 1, characterized in that Receiving an uploaded model and converting the model into a preset file, including: Receiving an uploaded model, and saving the model to cloud storage; The model conversion interface is called to download the model from the cloud storage, and then the model is loaded to generate a preset file, and the file is saved to the cloud storage.
3. The method according to claim 2, characterized in that Receiving an uploaded model and converting the model into a preset file also includes: According to the type of the model, a message is sent to the corresponding service cluster, so that each node on the service cluster downloads the file from the cloud storage to the local path after receiving the message.
4. The method according to claim 1, characterized in that: The file is loaded according to a user request, and then a prediction result based on the model is obtained, including: Receive a user request and read the locally stored file through a file loading interface; Calling the model prediction interface, passing in the model sample features in the request, and then obtaining the prediction results; Based on the prediction results, determine whether the model prediction interface is abnormal. If so, call the abnormal statistics interface of the monitoring component to record the abnormal data; otherwise, call the performance statistics interface of the monitoring component to record the time consumed by the current request.
5. The method according to claim 4, characterized in that Before loading the interface via file, include: Receive a user request, obtain the model type in the request, and route the request to a corresponding service cluster; The request is routed to a node by load balancing the nodes in the service cluster.
6. The method according to any one of claims 1 to 5, characterized in that: Also includes: Using the application container engine, write a text document for building an image to install a software package in the image of the application container engine.
7. A model real-time calling device, characterized in that: A conversion module, used to receive the uploaded model, identify the type of the model, call the corresponding implementation method, convert the model into a preset file, and generate an interface address; A sending module is used to send the interface address to load the file according to a user request, thereby obtaining a prediction result based on the model; according to a preset timed task, obtaining a prediction result based on the model within a preset time period, and then extracting the object in the prediction result to search for the execution data of the object in the target system; based on the prediction result and the execution data, calling an evaluation interface to calculate corresponding indicators.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Model online monitoring method and system
CN109978062A
