A multi-format model loading and compatibility processing method and system
Patent Information
- Application Number
- CN202610627809.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-08
- Publication Date
- 2026-10-23
AI Technical Summary
然而,在实际应用中,模型转换过程往往涉及算子映射、图结构重构以及参数重排等操作,容易引入不确定性,并且在面对自定义算子、动态计算图、版本差异以及平台差异时,转换过程存在失败风险
[0017]本发明实施例提供的多格式模型加载与兼容性处理方法及系统,通过在模型加载请求触发后,对模型文件进行基础特征信息提取,并基于基础特征信息完成模型格式识别和模型解析处理,能够在模型加载早期阶段准确获取模型的结构信息、数据描述信息以及附加属性信息,从而为后续处理提供统一且完整的模型描述基础;通过构建与具体训练框架无关的统一数据表示结构,使模型的计算结构、数据表示以及元数据信息得到统一抽象,避免模型加载过程对特定模型格式或特定推理框架的直接依赖,使得不同来源、不同存储格式的模型能够在不依赖其原始训练框架的情况下完成加载处理。
Smart Images

Figure CN122964625A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a method and system for loading and compatibility processing of multi-format models. Background Technology
[0002] With the continuous development of artificial intelligence and deep learning technologies, models built based on different training frameworks are widely used in industry and scientific research. Current mainstream deep learning training frameworks include, but are not limited to, PyTorch, TensorFlow, Keras, and PaddlePaddle. These frameworks exhibit significant differences in model structure description methods, parameter storage formats, serialization rules, and runtime dependencies. Consequently, the resulting model files exhibit highly diverse characteristics in terms of storage format, internal organization, and loading methods. Common model file formats include, but are not limited to, .pth, .pt, .pb, .ckpt, .h5, .onnx, and various framework-defined binary or directory-type model files.
[0003] During the model deployment phase, especially in scenarios involving cross-platform deployment, hybrid cloud and edge deployment, and collaborative operation across multiple hardware environments, the diversity and heterogeneity of model formats are increasingly becoming significant factors restricting rapid model deployment and large-scale application. In existing technologies, model loading and inference typically rely on the same or highly coupled inference framework and runtime environment as the model training phase. Different models often require different runtime dependencies, library versions, and hardware adaptation components, leading to complex system architecture, high maintenance costs, and significant resource consumption.
[0004] To address the issue of inconsistent model formats, existing technologies have proposed several model format conversion tools or intermediate format solutions, such as converting models to a unified exchange format before deployment. However, in practical applications, the model conversion process often involves operations such as operator mapping, graph structure reconstruction, and parameter rearrangement, which can easily introduce uncertainties. Furthermore, the conversion process is prone to failure when dealing with custom operators, dynamic computation graphs, version differences, and platform differences. In addition, some solutions employ parallel deployment of multiple inference frameworks within the same system to support multi-format models. This approach has significant shortcomings in terms of resource consumption, startup time, and system complexity, making it difficult to meet the needs of resource-constrained environments or large-scale deployment scenarios.
[0005] Therefore, existing technologies lack a systematic solution that can automatically identify, uniformly represent, dynamically load, and complete compatibility processing for multiple model formats. In particular, they lack a general technical system that can achieve cross-framework and cross-platform loading and running of models without relying on the parallel deployment of multiple inference frameworks. Summary of the Invention
[0006] The purpose of this application is to provide a method and system for loading and compatibility handling of multi-format models.
[0007] In a first aspect, embodiments of the present invention provide a method for loading and compatibility handling of multi-format models, including: Upon receiving a model loading request, the system obtains the model data source information of the model to be loaded and accesses the model storage medium based on the model data source information to read the model file. Determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file; Based on the basic feature information, the model file is identified to obtain the model format type to which the model file belongs. Based on the model format type, the model file is parsed to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. A unified data representation structure is constructed based on the computational structure information, the data description information, and the additional description information, and the loading process of the model to be loaded is executed based on the unified data representation structure.
[0008] Optionally, the step of identifying the model format of the model file based on the basic feature information to obtain the model format type to which the model file belongs specifically includes: The basic feature information is preprocessed to convert it into a model feature vector. The model feature vector is input into a pre-built and trained model type recognition model to obtain the model format type of the model file output by the model type recognition model; The model type identification model includes an input layer, at least one feature extraction layer, and an output layer. The input layer receives the model feature vector. The feature extraction layer performs layer-by-layer calculations on the model feature vector to extract model format feature vectors related to the model format category. The output layer outputs the probability that the model file belongs to each model format based on the model format feature vectors.
[0009] Optionally, constructing a unified data representation structure based on the computational structure information, the data description information, and the additional description information specifically includes: The computational structure information is converted into a unified computational structure representation, the data description information is converted into a unified data representation, and the additional description information is converted into a unified metadata representation; The unified computing structure represents the type information of each computing node in the corresponding model, the connection relationship between nodes, and the execution order of nodes; the unified data represents the data type, dimension information, storage layout information, and access method description information of the parameters and intermediate data of the corresponding model; and the unified metadata represents the input and output structure information, model identification information, version description information, and other additional attribute information related to the model.
[0010] Optionally, the loading process of the model to be loaded based on the unified data representation structure specifically includes: Obtain the runtime environment information of the model to be loaded; the runtime environment information includes at least the hardware type description information of the platform that can support the operation of the model to be loaded, the required computing resource description information, the required storage resource description information, and the runtime software environment description information; The runtime environment information is correlated with the unified computing structure representation, unified data representation, and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded; the model loading path is used to indicate the processing method for converting the unified data representation structure into the executable model form of the target runtime environment; The loading process of the model to be loaded is executed based on the model loading path of the model to be loaded.
[0011] Optionally, the runtime environment information is correlated with the unified computing structure representation, unified data representation, and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded, specifically including: Based on the unified computing structure representation and the hardware type description information and runtime software environment description information in the runnable environment information, the target running platform type that matches the model computing structure of the model to be loaded is determined; Based on the unified data representation and the required computing resource description information and required storage resource description information in the target operating environment information, the target operating resource conditions required by the model to be loaded are determined. Based on the unified metadata representation and the runtime software environment description information in the target runtime environment information, the software dependencies required for the operation of the model to be loaded and the target software environment that satisfies the software dependencies are determined. Based on the target running platform type matching the model computation structure of the model to be loaded, the target running resource conditions required by the model to be loaded, the software dependencies required for the running of the model to be loaded, and the target software environment that satisfies the software dependencies, the target running environment of the model to be loaded is determined. Based on the target runtime environment of the model to be loaded, the model loading path of the model to be loaded is determined.
[0012] Optionally, the loading process of the model to be loaded based on the model loading path of the model to be loaded specifically includes: Determine the current state information of the target runtime environment of the model to be loaded; the state information includes the computational structures currently supported by the target runtime environment, the available operators, and the interface specifications adopted. Compatibility verification is performed based on the unified data representation structure and the current state information of the target operating environment, and the loading process of the model to be loaded is executed after the compatibility verification is passed.
[0013] Secondly, embodiments of the present invention provide a multi-format model loading and compatibility processing system, including: The model file reading unit is used to obtain the model data source information of the model to be loaded after receiving the model loading request, and access the model storage medium to read the model file based on the model data source information; The file feature extraction unit is used to determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file. The model format identification and parsing unit is used to identify the model format of the model file based on the basic feature information, obtain the model format type to which the model file belongs, and perform model parsing processing on the model file based on the model format type to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. A unified representation conversion and loading unit is used to construct a unified data representation structure based on the computational structure information, the data description information, and the additional description information, and to execute the loading process of the model to be loaded based on the unified data representation structure.
[0014] Optionally, the step of identifying the model format of the model file based on the basic feature information to obtain the model format type to which the model file belongs specifically includes: The basic feature information is preprocessed to convert it into a model feature vector. The model feature vector is input into a pre-built and trained model type recognition model to obtain the model format type of the model file output by the model type recognition model; The model type identification model includes an input layer, at least one feature extraction layer, and an output layer. The input layer receives the model feature vector. The feature extraction layer performs layer-by-layer calculations on the model feature vector to extract model format feature vectors related to the model format category. The output layer outputs the probability that the model file belongs to each model format based on the model format feature vectors.
[0015] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the multi-format model loading and compatibility processing method described in the first aspect.
[0016] Fourthly, embodiments of the present invention provide a storage medium storing computer program instructions thereon, characterized in that, when the computer program instructions are executed, they implement the multi-format model loading and compatibility processing method described in the first aspect.
[0017] The multi-format model loading and compatibility processing method and system provided in this invention extracts basic feature information from the model file after the model loading request is triggered, and completes model format identification and model parsing based on the basic feature information. This enables accurate acquisition of the model's structural information, data description information, and additional attribute information in the early stages of model loading, thereby providing a unified and complete model description foundation for subsequent processing. By constructing a unified data representation structure independent of specific training frameworks, the model's computational structure, data representation, and metadata information are uniformly abstracted, avoiding direct dependence on specific model formats or specific inference frameworks during the model loading process. This allows models from different sources and with different storage formats to complete loading processing without relying on their original training frameworks.
[0018] Furthermore, during the model loading stage, target runtime environment information is introduced and combined with a unified data representation structure to determine the model loading path, enabling the model loading process to be organized and controlled according to actual runtime environment conditions, thereby achieving controllable execution of the model loading process.
[0019] Furthermore, during the model loading process, the compatibility between the model and the target runtime environment is verified by incorporating the current state information of the target runtime environment. This ensures that the necessary matching and confirmation are completed before entering model construction and initialization, thereby guaranteeing the orderly progress of the model loading process under the constraints of a unified data representation structure and runtime environment. Through the coordination of the above overall process, collaborative processing between model format recognition, model parsing, unified representation construction, loading path determination, and loading process execution is achieved, providing complete technical support for loading multi-format models in different runtime environments. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly described below.
[0021] Figure 1 This is a flowchart illustrating the multi-format model loading and compatibility handling method provided by the present invention; Figure 2 This is a flowchart illustrating the model loading method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the multi-format model loading and compatibility processing system provided by the present invention; Figure 4 This is a schematic diagram of the physical structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0023] Similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0024] Figure 1 This is a flowchart illustrating the multi-format model loading and compatibility handling method provided by the present invention, as shown below. Figure 1 As shown, the method includes: Step 110: After receiving the model loading request, obtain the model data source information of the model to be loaded, and access the model storage medium based on the model data source information to read the model file; Step 120: Determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file. Step 130: Based on the basic feature information, the model file is identified to obtain the model format type to which the model file belongs, and the model file is parsed based on the model format type to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. Step 140: Construct a unified data representation structure based on the computational structure information, the data description information, and the additional description information; and execute the loading process of the model to be loaded based on the unified data representation structure.
[0025] Here, the model loading request can be issued by an upper-layer application, a model management system, or other callers. The request typically includes model identification information or model data source information indicating the model to be loaded. Upon receiving the model loading request, the model data source information of the model to be loaded is obtained, and the storage location of the model to be loaded is determined based on this information. The corresponding model storage medium is then accessed to read the model file. The model storage medium can be a local file system, a network file system, an object storage service, or other data storage medium capable of storing model files; this embodiment of the invention does not specifically limit this. The reading operation of the model file is completed based on the path description, access method description, or access credential information contained in the model data source information.
[0026] After reading the model file, basic feature information is parsed from it. This basic feature information characterizes the basic attributes and internal features of the model file. In this embodiment, the basic feature information includes at least the file extension, header features, the arrangement of data segments within the model file, and metadata information describing the model. Specifically, the file extension is obtained by parsing the model file's name or path information and reflects its surface format characteristics; the header features are obtained by reading several bytes or characters from the beginning of the model file and reflect its encoding method, version identifier, or specific format identifier; the arrangement of data segments within the model file is obtained by scanning and analyzing the overall structure of the model file and reflects the organization order, hierarchical relationship, or block division method of different data segments; and the metadata information is obtained by parsing data areas specifically used to describe model attributes. This metadata information may include model training framework description information, model structure description information, model version description information, model input / output description information, and other additional model-related information.
[0027] After obtaining the aforementioned basic feature information, model format identification processing is performed on the model file based on this information. In this embodiment of the invention, model format identification processing is used to determine the model format type to which the model file belongs. This model format type indicates the internal organization rules of the model file and the parsing logic to be used in subsequent model parsing processing. During the model format identification process, the file extension, file header features, internal data segment arrangement, and metadata information of the model file can be comprehensively analyzed. Based on the mapping relationship between these basic feature information and preset model format feature rules, or by using pre-trained model format identification models, the model format type to which the model file belongs can be determined. The model format type can correspond to a specific model training framework format, a general model exchange format, or other custom model formats.
[0028] In some embodiments, after acquiring the basic feature information of the model file, further preprocessing operations can be performed on the basic feature information to convert the raw basic feature information into a model feature vector suitable for input into the model type recognition model. The basic feature information may include different types of data in its raw state, such as character data, numerical data, and structured or semi-structured data. To ensure that features from different sources and of different types can be processed uniformly, the basic feature information can be standardized. For the file extension information of the model file, it is mapped to the corresponding numerical representation using preset encoding rules; for the file header features of the model file, fixed-length data segments are read and encoded to generate corresponding numerical features; for the arrangement of data segments within the model file, the number, order, and hierarchical relationship of the data segments are analyzed to convert them into structured numerical features; for the metadata information contained in the model file, the field content is parsed and corresponding feature representations are generated according to predefined feature extraction rules. After the above processing, features from different sources are combined to form a model feature vector in a unified format.
[0029] After constructing the model feature vector, it is input into a pre-built and trained model type recognition model. The model type recognition model includes an input layer, at least one feature extraction layer, and an output layer. The input layer receives the model feature vector and passes it to subsequent network layers for processing. The model feature vector exists in the input layer as a fixed-dimensional data structure to ensure structural consistency of the feature inputs from different model files. The feature extraction layer performs layer-by-layer computation on the input model feature vector. In some embodiments, the feature extraction layer can consist of one or more convolutional neural network structures. Each layer performs computation operations sequentially according to a preset connection method, gradually extracting model format feature vectors related to the model format category by mapping and transforming the model feature vector. During processing, the feature extraction layer performs weighted combination and nonlinear transformation on the input features to generate intermediate feature representations for distinguishing different model format categories. Next, the output layer performs probability calculations based on the model format feature vectors to generate probabilities representing the model file's category.
[0030] After determining the model format type of the model file, model parsing processing is performed on the model file based on that model format type. Specifically, key information describing the model structure and data can be extracted from the model file, including computational structure information describing the model's computational structure, data description information describing model parameters and intermediate data, and additional description information describing the model's additional attributes. The computational structure information reflects the type, connection relationships, and computation order of each computation node in the model, and can be used to describe the overall computational logic of the model. The data description information reflects the data type, dimensional information, and storage method of the model parameter data and intermediate data, and can be used to describe the data structures involved in the model's execution. The additional description information reflects the model's input / output interface description, model identifier description, version description, and other additional attribute information related to model operation.
[0031] Subsequently, a unified data representation structure is constructed based on computational structure information, data description information, and additional descriptive information. This unified data representation structure describes the model in a consistent manner, ensuring that the model no longer depends on its original training framework or storage format during subsequent loading processes. In some embodiments, the unified data representation structure includes a unified computational structure representation, a unified data representation, and a unified metadata representation. The unified computational structure representation, constructed based on computational structure information, describes the model's computational topology, including the type information of each computational node in the model, the connection relationships between nodes, and the execution order of nodes. The unified data representation, constructed based on data description information, describes the unified representation of model parameter data and intermediate data, including the data type, dimension information, storage layout information, and access method description information of the parameters and intermediate data. The unified metadata representation, constructed based on additional descriptive information, describes the model's input / output interfaces, model identification information, version description information, and other model-related additional attribute information.
[0032] Based on the aforementioned unified data representation structure, the loading process for the model to be loaded can be executed. In this process, the unified data representation structure serves as the core descriptive object of the model. Based on the information contained in the unified computational structure representation, unified data representation, and unified metadata representation, the model is constructed and initialized, generating a model loading result that can be used subsequently. During the execution of the model loading process, it is no longer necessary to directly rely on the original storage format of the model file; instead, the model loading-related processing logic is completed based on the unified data representation structure, thus achieving unified loading processing for multiple model formats.
[0033] In some embodiments, the loading process uses a unified data representation structure as the core description basis of the model, and combines this with the runtime environment information of the model to be loaded to organize and control the model loading process. For example... Figure 2 As shown, the specific loading process includes: Step 210: Obtain the runtime environment information of the model to be loaded; the runtime environment information includes at least the hardware type description information of the platform that can support the operation of the model to be loaded, the required computing resource description information, the required storage resource description information, and the runtime software environment description information. Step 220: Perform correlation analysis on the runtime environment information and the unified computing structure representation, unified data representation and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded; the model loading path is used to indicate the processing method of converting the unified data representation structure into the executable model form of the target runtime environment; Step 230: Execute the loading process of the model to be loaded based on the model loading path of the model to be loaded.
[0034] Specifically, the first step is to obtain the runtime environment information of the model to be loaded. Runtime environment information describes the target runtime conditions that support the operation of the model, and includes at least the platform's hardware type description, required computing resource description, required storage resource description, and runtime software environment description. Hardware type description information characterizes the processor type, accelerator type, or other hardware architecture features used by the target runtime platform; required computing resource description information characterizes the computing power configuration required during model operation; required storage resource description information characterizes the storage space requirements for model parameter data, intermediate data, and runtime data; and runtime software environment description information characterizes the software components, library files, and runtime support conditions that the model depends on. This runtime environment information can be obtained by reading system configuration, querying runtime environment interfaces, or parsing the environment parameters contained in the model loading request.
[0035] Subsequently, the runtime environment information is correlated with the unified computing structure representation, unified data representation, and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded. During the correlation analysis, firstly, the computing structure of the model to be loaded is analyzed based on the unified computing structure representation, identifying the type information of each computing node in the model, the connection relationships between nodes, and the overall organization of the computing structure. The results of the computing structure analysis are then correlated with the hardware type description information and runtime software environment description information contained in the runtime environment information to determine the target runtime platform type that matches the model computing structure of the model to be loaded. Simultaneously, the data type description information, dimension description information, and storage layout description information of the model parameter data and intermediate data are analyzed based on the unified data representation. The data representation analysis results are then correlated with the required computing resource description information and required storage resource description information contained in the runtime environment information to determine the target runtime resource conditions required by the model data. Furthermore, based on the unified metadata representation, the input and output structure description information, model identification information, version description information, etc. of the model are analyzed, and the metadata analysis results are compared with the runtime software environment description information contained in the runnable environment information to determine the software dependencies required for the model to be loaded to run and the target software environment that satisfies the above software dependencies.
[0036] Based on the target runtime platform type, target runtime resource conditions, and software dependencies required for the model to be loaded, as well as the target software environment that satisfies these dependencies, obtained from correlation analysis, the target runtime environment of the model to be loaded is determined. Based on this target runtime environment, the model loading path is then determined. The model loading path describes the processing methods used when converting the unified data representation structure to an executable model form in the target runtime environment, including data processing methods and the execution flow of each loading step. The loading process of the model to be loaded is executed based on the model loading path. During the model loading process, the model computation structure description information, data representation description information, and metadata description information contained in the unified data representation structure are processed according to the processing methods indicated by the model loading path. The model construction and initialization operations are completed step by step according to the execution order determined by the model loading path. It should be noted that in the model loading process, the unified data representation structure is used to guide the construction of the model execution structure and the configuration of model parameter data, thereby completing the conversion of the model to be loaded into an executable model form in the target runtime environment.
[0037] In other embodiments, before formally executing the loading process of the model to be loaded, the current state information of the target runtime environment of the model to be loaded can be determined. This state information includes the computing structures currently supported by the target runtime environment, the available operators, and the interface specifications adopted. Then, a compatibility check is performed based on the unified data representation structure and the current state information of the target runtime environment. After the compatibility check passes, the loading process of the model to be loaded is executed.
[0038] Specifically, before executing the loading process, the current state information of the target runtime environment for the model to be loaded is first determined. This current state information reflects the actual available capabilities and constraints of the target runtime environment at the time of model loading. It includes the computational structures currently supported by the target runtime environment, the available operators, and the interface specifications adopted. The computational structures characterize the types of computational nodes currently supported by the target runtime environment and their organization. Available operators characterize the set of operators implemented and callable in the target runtime environment. The interface specifications characterize the calling methods and data interface forms that the model must follow when interacting with the target runtime environment during runtime. This state information can be obtained by querying the runtime interface of the target runtime environment, reading the environment configuration description, or calling the underlying system information acquisition mechanism.
[0039] Subsequently, compatibility verification is performed based on the unified data representation structure and the current state information of the target runtime environment. The unified data representation structure, including the unified computational structure representation, unified data representation, and unified metadata representation, provides the structural and data description foundation for the model-side compatibility verification. During compatibility verification, the unified computational structure representation is compared with the computational structures currently supported by the target runtime environment to determine whether each computational node and its connection relationships in the model can be supported in the target runtime environment. Simultaneously, a correspondence analysis is performed based on the unified data representation and the data processing capabilities supported by the currently available operators in the target runtime environment to determine the matching between the model's data processing requirements and the currently available operators in the target runtime environment. Furthermore, a correspondence analysis is performed based on the unified metadata representation and the interface specifications currently used by the target runtime environment to determine whether the interface call methods required by the model during operation conform to the interface specification requirements of the target runtime environment. The above compatibility verification is completed before the model loading process and is used to confirm the matching relationship between the model and the current state of the target runtime environment.
[0040] After completing the compatibility verification process and confirming that the compatibility verification has passed, the loading process of the model to be loaded can be executed according to the previously determined model loading path. During the loading process, the system processes the model computation structure description information, data representation description information, and metadata description information in the unified data representation structure according to the processing method indicated by the model loading path, and completes the model construction and initialization operations step by step according to the execution order determined by the model loading path. If the compatibility verification fails, the model loading process will not enter the model construction and initialization stage.
[0041] In summary, the method provided by this invention extracts basic feature information from the model file after the model loading request is triggered, and completes model format identification and model parsing based on this basic feature information. This enables accurate acquisition of the model's structural information, data description information, and additional attribute information in the early stages of model loading, thus providing a unified and complete model description foundation for subsequent processing. By constructing a unified data representation structure independent of specific training frameworks, the model's computational structure, data representation, and metadata information are uniformly abstracted, avoiding direct dependence on specific model formats or inference frameworks during the model loading process. This allows models from different sources and with different storage formats to complete loading without relying on their original training frameworks. Furthermore, during the model loading stage, target runtime environment information is introduced and combined with the unified data representation structure to determine the model loading path, enabling the model loading process to be organized and controlled according to actual runtime environment conditions, thereby achieving controllable execution of the model loading process. Furthermore, during the model loading process, the compatibility between the model and the target runtime environment is verified by incorporating the current state information of the target runtime environment. This ensures that the necessary matching and confirmation are completed before entering model construction and initialization, thereby guaranteeing the orderly progress of the model loading process under the constraints of a unified data representation structure and runtime environment. Through the coordination of the above overall process, collaborative processing between model format recognition, model parsing, unified representation construction, loading path determination, and loading process execution is achieved, providing complete technical support for loading multi-format models in different runtime environments.
[0042] Based on any of the above embodiments Figure 3 This is a schematic diagram of the multi-format model loading and compatibility processing system provided by the present invention. This system can be referenced in conjunction with the method provided in the above embodiments. Figure 3 As shown, the system includes: The model file reading unit 310 is used to obtain the model data source information of the model to be loaded after receiving the model loading request, and access the model storage medium to read the model file based on the model data source information; The file feature extraction unit 320 is used to determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file. The model format recognition and parsing unit 330 is used to recognize the model format of the model file based on the basic feature information, obtain the model format type to which the model file belongs, and perform model parsing processing on the model file based on the model format type to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. The unified representation conversion and loading unit 340 is used to construct a unified data representation structure based on the computational structure information, the data description information, and the additional description information, and to execute the loading process of the model to be loaded based on the unified data representation structure.
[0043] Based on any of the above embodiments, the appendix Figure 4 The diagram illustrates the physical structure of an electronic device according to an embodiment of the present invention. This electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440. The processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions stored in the memory 430 to execute the following method: Step S1: Normalize the device data currently collected by the sensor to obtain normalized device data; Step S2: The normalized device data is input into three independent time-scale processing units, wherein the three time-scale processing units use a first smoothing factor, a second smoothing factor and a third smoothing factor to perform exponential moving average and exponential moving variance calculations, respectively, and the first smoothing factor is greater than the second smoothing factor, and the second smoothing factor is greater than the third smoothing factor. Step S3: Based on the exponential moving average and exponential moving variance output by the three time scale processing units, generate the first dynamic threshold interval, the second dynamic threshold interval and the third dynamic threshold interval respectively, and perform threshold fusion based on the first dynamic threshold interval, the second dynamic threshold interval and the third dynamic threshold interval to obtain the comprehensive dynamic threshold interval. Step S4: Based on the comprehensive dynamic threshold range, the normalized device data is mapped to a data state, and based on the exponential moving variance output by the three time-scale processing units, the normalized device data is mapped to a control state; wherein, the data state represents the operating state of the corresponding device, and the data state includes normal state, early warning state and abnormal state; the control state represents the confidence level of the data state.
[0044] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention embodiment, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this invention embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0045] On the other hand, embodiments of the present invention also provide a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments, including, for example: Step S1: Normalize the device data currently collected by the sensor to obtain normalized device data; Step S2: The normalized device data is input into three independent time-scale processing units, wherein the three time-scale processing units use a first smoothing factor, a second smoothing factor and a third smoothing factor to perform exponential moving average and exponential moving variance calculations, respectively, and the first smoothing factor is greater than the second smoothing factor, and the second smoothing factor is greater than the third smoothing factor. Step S3: Based on the exponential moving average and exponential moving variance output by the three time scale processing units, generate the first dynamic threshold interval, the second dynamic threshold interval and the third dynamic threshold interval respectively, and perform threshold fusion based on the first dynamic threshold interval, the second dynamic threshold interval and the third dynamic threshold interval to obtain the comprehensive dynamic threshold interval. Step S4: Based on the comprehensive dynamic threshold range, the normalized device data is mapped to a data state, and based on the exponential moving variance output by the three time-scale processing units, the normalized device data is mapped to a control state; wherein, the data state represents the operating state of the corresponding device, and the data state includes normal state, early warning state and abnormal state; the control state represents the confidence level of the data state.
[0046] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0047] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for loading and compatibility handling of multi-format models, characterized in that, include: Upon receiving a model loading request, the system obtains the model data source information of the model to be loaded and accesses the model storage medium based on the model data source information to read the model file. Determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file; Based on the basic feature information, the model file is identified to obtain the model format type to which the model file belongs. Based on the model format type, the model file is parsed to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. A unified data representation structure is constructed based on the computational structure information, the data description information, and the additional description information, and the loading process of the model to be loaded is executed based on the unified data representation structure.
2. The multi-format model loading and compatibility processing method according to claim 1, characterized in that, The step of identifying the model format of the model file based on the basic feature information to obtain the model format type to which the model file belongs specifically includes: The basic feature information is preprocessed to convert it into a model feature vector. The model feature vector is input into a pre-built and trained model type recognition model to obtain the model format type of the model file output by the model type recognition model; The model type identification model includes an input layer, at least one feature extraction layer, and an output layer. The input layer receives the model feature vector. The feature extraction layer performs layer-by-layer calculations on the model feature vector to extract model format feature vectors related to the model format category. The output layer outputs the probability that the model file belongs to each model format based on the model format feature vectors.
3. The multi-format model loading and compatibility handling method according to claim 1, characterized in that, The construction of a unified data representation structure based on the computational structure information, the data description information, and the additional description information specifically includes: The computational structure information is converted into a unified computational structure representation, the data description information is converted into a unified data representation, and the additional description information is converted into a unified metadata representation; The unified computing structure represents the type information of each computing node in the corresponding model, the connection relationship between nodes, and the execution order of nodes; the unified data represents the data type, dimension information, storage layout information, and access method description information of the parameters and intermediate data of the corresponding model; and the unified metadata represents the input and output structure information, model identification information, version description information, and other additional attribute information related to the model.
4. The multi-format model loading and compatibility handling method according to claim 3, characterized in that, The loading process of the model to be loaded based on the unified data representation structure specifically includes: Obtain the runtime environment information of the model to be loaded; the runtime environment information includes at least the hardware type description information of the platform that can support the operation of the model to be loaded, the required computing resource description information, the required storage resource description information, and the runtime software environment description information; The runtime environment information is correlated with the unified computing structure representation, unified data representation, and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded; the model loading path is used to indicate the processing method for converting the unified data representation structure into the executable model form of the target runtime environment; The loading process of the model to be loaded is executed based on the model loading path of the model to be loaded.
5. The multi-format model loading and compatibility handling method according to claim 4, characterized in that, The process involves correlation analysis between the runtime environment information and the unified computing structure representation, unified data representation, and unified metadata representation contained in the unified data representation structure to determine the model loading path of the model to be loaded, specifically including: Based on the unified computing structure representation and the hardware type description information and runtime software environment description information in the runnable environment information, the target running platform type that matches the model computing structure of the model to be loaded is determined; Based on the unified data representation and the required computing resource description information and required storage resource description information in the target operating environment information, the target operating resource conditions required by the model to be loaded are determined. Based on the unified metadata representation and the runtime software environment description information in the target runtime environment information, the software dependencies required for the operation of the model to be loaded and the target software environment that satisfies the software dependencies are determined. Based on the target running platform type matching the model computation structure of the model to be loaded, the target running resource conditions required by the model to be loaded, the software dependencies required for the running of the model to be loaded, and the target software environment that satisfies the software dependencies, the target running environment of the model to be loaded is determined. Based on the target runtime environment of the model to be loaded, the model loading path of the model to be loaded is determined.
6. The multi-format model loading and compatibility handling method according to claim 5, characterized in that, The loading process of the model to be loaded, based on the model loading path of the model to be loaded, specifically includes: Determine the current state information of the target runtime environment of the model to be loaded; the state information includes the computational structures currently supported by the target runtime environment, the available operators, and the interface specifications adopted. Compatibility verification is performed based on the unified data representation structure and the current state information of the target operating environment, and the loading process of the model to be loaded is executed after the compatibility verification is passed.
7. A multi-format model loading and compatibility processing system, characterized in that, include: The model file reading unit is used to obtain the model data source information of the model to be loaded after receiving the model loading request, and access the model storage medium to read the model file based on the model data source information; The file feature extraction unit is used to determine the basic feature information corresponding to the model file; the basic feature information includes at least the file extension of the model file, the file header features, the arrangement of the data segments inside the model file, and the metadata information describing the model information contained in the model file. The model format identification and parsing unit is used to identify the model format of the model file based on the basic feature information, obtain the model format type to which the model file belongs, and perform model parsing processing on the model file based on the model format type to obtain computational structure information for describing the model computational structure, data description information for describing the model parameters and intermediate data, and additional description information for describing the model's additional attributes. A unified representation conversion and loading unit is used to construct a unified data representation structure based on the computational structure information, the data description information, and the additional description information, and to execute the loading process of the model to be loaded based on the unified data representation structure.
8. The multi-format model loading and compatibility processing system according to claim 7, characterized in that, The step of identifying the model format of the model file based on the basic feature information to obtain the model format type to which the model file belongs specifically includes: The basic feature information is preprocessed to convert it into a model feature vector. The model feature vector is input into a pre-built and trained model type recognition model to obtain the model format type of the model file output by the model type recognition model; The model type identification model includes an input layer, at least one feature extraction layer, and an output layer. The input layer receives the model feature vector. The feature extraction layer performs layer-by-layer calculations on the model feature vector to extract model format feature vectors related to the model format category. The output layer outputs the probability that the model file belongs to each model format based on the model format feature vectors.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the multi-format model loading and compatibility processing method as described in any one of claims 1 to 6.
10. A storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed, they implement the multi-format model loading and compatibility processing method according to any one of claims 1-6.