A third-party library access method, device, equipment, program product and medium

By decomposing the calculation modules of the tripartite library of the pre-trained model and accessing the artificial intelligence computing power framework, the problem of access between different deep learning frameworks and hardware devices is solved, improving efficiency and ease of use, and reducing costs.

CN118394349BActive Publication Date: 2024-09-06LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410853487.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-06
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Existing technology makes it difficult to achieve efficient access to third-party libraries between different deep learning frameworks and hardware devices, resulting in long development cycles, high version maintenance costs, low ease of use, and difficulty in adaptation.

Method used

By combing through the target tripartite libraries used by the pre-training model, the calculation modules are segmented, and the calculation logic is decomposed into target operators executed based on the artificial intelligence computing power framework to achieve compatible access to different deep learning frameworks and hardware devices. .

Benefits of technology

It simplifies the third-party library access process, reduces the amount of code modifications, improves access efficiency and adaptation efficiency, reduces adaptation costs, and achieves unified access to multiple hardware devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394349B
    Figure CN118394349B
Patent Text Reader

Abstract

The present application discloses a method, device, equipment, program product and medium for accessing a third-party library, and relates to the field of computer technology. The method includes: obtaining a target third-party library used in the training process of a pre-trained model, and combing the target third-party library to separate the computing modules in the target third-party library; wherein the computing module is used to implement the computing functions of various algorithms; determining the type of deep learning framework for accessing the target third-party library, and according to the type of deep learning framework, decomposing the computing logic in the computing module into a target operator executed based on an artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms; using the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and docking heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework. Through the technical solution of the present application, the access process of the third-party library can be shortened, and the efficiency of the access of the third-party library can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a third-party library access method, device, equipment, program product and medium. Background Art

[0002] A pre-trained model is a deep learning model that completes a specific task by training on a large-scale dataset. The features learned by this model on general tasks can be transferred to other specific tasks. LLM (Large Language Models) is a specific application of pre-trained models in the field of natural language processing. In recent years, large language models have developed rapidly. In order to solve the efficiency problem in the training process of large language models, researchers have proposed a variety of optimization algorithms and parallel computing technologies. Figure 1 As shown in the figure, most of the current optimizations to improve the efficiency of large language model training are based on NVIDIA's graphics processing unit (GPU) as the backend hardware platform. For other hardware devices, if you want to use the same large language model training optimization techniques to improve training performance, you need to reconnect them. In addition, most of the third-party libraries that improve the efficiency of large language model training are implemented based on the PyTorch deep learning framework, and other deep learning frameworks also need to be re-adapted.

[0003] Therefore, how to connect multiple heterogeneous hardware devices and how to connect third-party libraries based on other deep learning frameworks are problems that technicians in this field currently need to solve. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a third-party library access method, device, equipment, program product and medium, which can not only be connected to different deep learning frameworks, but also be compatible with different hardware devices. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a third-party library access method, comprising:

[0006] Obtaining a target third-party library used in the training process of the pre-training model, and combing the target third-party library to separate out the computing modules in the target third-party library; wherein the computing modules are used to implement computing functions of various algorithms;

[0007] Determine the type of deep learning framework accessed to the target third-party library, and according to the type of deep learning framework, decompose the computing logic in the computing module into target operators executed based on an artificial intelligence computing framework; the artificial intelligence computing framework is a computing framework for implementing artificial intelligence algorithms;

[0008] The artificial intelligence computing power framework is used to call the target operator to complete the access of the target third-party library, and the heterogeneous hardware device is connected to the target third-party library based on the artificial intelligence computing power framework.

[0009] Optionally, the deep learning framework types accessed to the target third-party library include the PyTorch deep learning framework and other deep learning frameworks except the PyTorch deep learning framework.

[0010] Optionally, determining the type of deep learning framework accessing the target third-party library, and decomposing the calculation logic in the calculation module into target operators executed based on an artificial intelligence computing framework according to the type of deep learning framework, includes:

[0011] If the deep learning framework type of the target third-party library is the PyTorch deep learning framework, the computing logic in the computing module is decomposed according to the first operator provided by the artificial intelligence computing power framework to obtain the target operator executed based on the artificial intelligence computing power framework.

[0012] Optionally, decomposing the computing logic in the computing module according to the first operator provided by the artificial intelligence computing power framework to obtain a target operator executed based on the artificial intelligence computing power framework includes:

[0013] Determining whether the artificial intelligence computing power framework provides the first operator;

[0014] When the artificial intelligence computing power framework provides the first operator, directly calling the first operator and determining the first operator as a target operator to be executed based on the artificial intelligence computing power framework;

[0015] When the artificial intelligence computing power framework does not provide the first operator, the calculation logic in the calculation module is decomposed into operator expressions, and the operator expressions are parsed to obtain a target operator executed based on the artificial intelligence computing power framework.

[0016] Optionally, according to the deep learning framework type, after decomposing the computing logic in the computing module into target operators executed based on the artificial intelligence computing framework, the method further includes:

[0017] Determine a first calling sequence when calling the current target operator using the artificial intelligence computing power framework;

[0018] Respectively judging whether the first input parameter and the first output parameter corresponding to the calculation logic in the target tripartite library are consistent with the second input parameter and the second output parameter corresponding to the current target operator, so as to obtain a first judgment result, so as to determine the first target input and output of the calculation module according to the first judgment result;

[0019] Accordingly, the target operator is called by the artificial intelligence computing framework to complete the access to the target third-party library, including:

[0020] Based on the first calling order and the first target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

[0021] Optionally, the respectively determining whether a first input parameter and a first output parameter corresponding to the calculation logic in the target third-party library are consistent with a second input parameter and a second output parameter corresponding to the current target operator to obtain a first determination result, so as to determine a first target input and output of the calculation module according to the first determination result, includes:

[0022] When the first input parameter and the first output parameter are consistent with the second input parameter and the second output parameter, determining the first input parameter or the second input parameter as the input parameter of the calculation module to obtain a first target input of the calculation module, and determining the first output parameter or the second output parameter as the output parameter of the calculation module to obtain a first target output of the calculation module;

[0023] When the first input parameter and the first output parameter are inconsistent with the second input parameter and the second output parameter, the input parameter of the calculation module is added through the first parameter input interface to obtain the first target input of the calculation module, and the second output parameter is determined as the output parameter of the calculation module to obtain the first target output of the calculation module.

[0024] Optionally, the third-party library access method further includes:

[0025] Obtaining intermediate input parameters and intermediate output parameters when the calculation module implements the calculation function;

[0026] The intermediate input parameter and the intermediate output parameter are called based on the first calling sequence.

[0027] Optionally, determining the type of deep learning framework accessing the target third-party library, and decomposing the calculation logic in the calculation module into target operators executed based on an artificial intelligence computing framework according to the type of deep learning framework, includes:

[0028] If the deep learning framework type of the target third-party library is the other deep learning framework, determining whether there is a target implementation method for the target third-party library in the other deep learning framework to obtain a second determination result;

[0029] Based on the second judgment result, the calculation logic in the calculation module is decomposed into target operators executed based on the artificial intelligence computing power framework.

[0030] Optionally, decomposing the calculation logic in the calculation module into target operators executed based on an artificial intelligence computing framework based on the second judgment result includes:

[0031] If the other deep learning framework has a target implementation method for the target third-party library, the target implementation method is parsed to determine whether a non-compiled deep learning framework source code interface is reserved in the other deep learning framework;

[0032] When the non-compiled deep learning framework source code interface is reserved in the other deep learning framework, the computing logic in the computing module is decomposed into target operators executed based on the artificial intelligence computing power framework based on the non-compiled deep learning framework source code interface.

[0033] Optionally, according to the deep learning framework type, after decomposing the computing logic in the computing module into target operators executed based on the artificial intelligence computing framework, the method further includes:

[0034] Determine a second calling order when calling the current target operator using the artificial intelligence computing power framework;

[0035] Determine whether the third input parameter and the third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with the fourth input parameter and the fourth output parameter corresponding to the current target operator to obtain a corresponding third judgment result, so as to determine the second target input and output of the calculation module according to the third judgment result;

[0036] Accordingly, the target operator is called by the artificial intelligence computing framework to complete the access to the target third-party library, including:

[0037] Based on the second calling order and the second target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

[0038] Optionally, the determining whether the third input parameter and the third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with the fourth input parameter and the fourth output parameter corresponding to the current target operator to obtain a corresponding third determination result, so as to determine the second target input and output of the calculation module according to the third determination result, includes:

[0039] When the third input parameter and the third output parameter are consistent with the fourth input parameter and the fourth output parameter, determining the third input parameter or the fourth input parameter as the input parameter of the calculation module to obtain the second target input of the calculation module, and determining the third output parameter or the fourth output parameter as the output parameter of the calculation module to obtain the second target output of the calculation module;

[0040] When the third input parameter and the third output parameter are inconsistent with the fourth input parameter and the fourth output parameter, the input parameter of the calculation module is added through the second parameter input interface to obtain the second target input of the calculation module, and the fourth output parameter is determined as the output parameter of the calculation module to obtain the second target output of the calculation module.

[0041] Optionally, the third-party library access method further includes:

[0042] When the non-compiled deep learning framework source code interface lacks the third input parameter, the step of adding the input parameter of the computing module through the second parameter input interface to obtain the second target input of the computing module is triggered.

[0043] Optionally, the third-party library access method further includes:

[0044] If the other deep learning framework does not have a target implementation method for the target third-party library, or when the non-compiled deep learning framework source code interface is not reserved in the other deep learning framework, it is determined whether the other deep learning framework has a custom operator interface to obtain a fourth judgment result, so as to determine whether the other deep learning framework supports access to the target third-party library based on the fourth judgment result.

[0045] Optionally, the determining whether the other deep learning framework has a custom operator interface to obtain a fourth determination result, so as to determine whether the other deep learning framework supports access to the target third-party library according to the fourth determination result, includes:

[0046] If the other deep learning framework has the custom operator interface, a second operator is customized based on the custom operator interface, so as to access the target third-party library based on the second operator;

[0047] If the other deep learning framework does not have the custom operator interface, it is determined that the other deep learning framework does not support access to the target third-party library.

[0048] Optionally, the customizing the second operator based on the custom operator interface so as to access the target third-party library based on the second operator includes:

[0049] Respectively taking the fourth input parameter and the fourth output parameter corresponding to the current target operator as the fifth input parameter and the fifth output parameter corresponding to the custom operator interface;

[0050] The second operator is registered based on the fifth input parameter and the fifth output parameter, so as to access the target third-party library based on the second operator.

[0051] Optionally, combing the target third-party library to separate out the computing modules in the target third-party library includes:

[0052] Determine the Python interface for interactive calls in the target third-party library and the computing logic interface implemented based on a preset programming language;

[0053] The Python interface and the computing logic interface are split, and the split results are parsed to obtain the computing module in the target third-party library.

[0054] In a second aspect, the present application discloses a third-party library access device, including:

[0055] A computing function segmentation module is used to obtain a target third-party library used in the training process of the pre-training model, and to sort out the target third-party library to segment out the computing modules in the target third-party library; wherein the computing modules are used to implement the computing functions of various algorithms;

[0056] A target operator determination module is used to determine the type of deep learning framework accessing the target third-party library, and according to the type of deep learning framework, decompose the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing framework; the artificial intelligence computing framework is a computing framework for implementing artificial intelligence algorithms;

[0057] The third-party library access module is used to use the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and to connect heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

[0058] In a third aspect, the present application discloses an electronic device, including:

[0059] Memory for storing computer programs;

[0060] A processor is used to load and execute the computer program to implement the aforementioned third-party library access method.

[0061] In a fourth aspect, the present application discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the aforementioned third-party library access method.

[0062] In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program implements the aforementioned third-party library access method when executed by a processor.

[0063] The present application provides a method for accessing a third-party library, including: obtaining a target third-party library used in a pre-training model training process, and combing the target third-party library to separate out computing modules in the target third-party library; wherein the computing modules are used to implement computing functions of various algorithms; determining a deep learning framework type for accessing the target third-party library, and according to the deep learning framework type, decomposing the computing logic in the computing module into a target operator executed based on an artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms; using the artificial intelligence computing power framework to call the target operator to complete the access to the target third-party library, and docking heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

[0064] The beneficial technical effects of the present application are as follows: for the optimization process of pre-trained model training, by combing the target third-party library used, the calculation modules used to implement various algorithm calculations are separated and decomposed and reconstructed, which effectively retains the integrity of other interfaces, reduces the amount of code modification, greatly reduces the third-party library access process, and effectively improves the efficiency of third-party library access. Since the present invention only modifies the calculation logic for the third-party library access scheme, it can access different deep learning frameworks, which improves the training efficiency of pre-trained models of other deep learning frameworks. Further, the artificial intelligence computing power framework is used as the implementation platform of the third-party library calculation logic, and the calculation logic of the third-party library is realized by calling the decomposed target operator, so that heterogeneous hardware devices can be connected once, and the access of the back-ends of multiple hardware devices can be realized, reducing the adaptation cost, reducing the investment in human cost, and effectively improving the adaptation efficiency of heterogeneous hardware devices of the third-party library. It can be seen that the calculation logic in the third-party library is executed based on the artificial intelligence computing power framework to realize the access of the third-party library, which can not only undertake different deep learning frameworks upward, but also be compatible with different hardware devices downward, effectively improving the development efficiency.

[0065] In addition, the present application provides a third-party library access device, equipment, program product and medium, which correspond to the above-mentioned third-party library access method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0067] Figure 1 This is a schematic diagram of a third-party library access;

[0068] Figure 2 A flow chart of a third-party library access method disclosed in this application;

[0069] Figure 3 A schematic diagram of universal access to a third-party library disclosed in this application;

[0070] Figure 4 A schematic diagram of accessing a third-party library based on other deep learning frameworks disclosed in this application;

[0071] Figure 5 This is a schematic diagram of the structure of a third-party library access device disclosed in this application;

[0072] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0074] A pre-trained model is a deep learning model that completes a specific task by training on a large-scale dataset. The features learned by this model on general tasks can be transferred to other specific tasks. LLM is a specific application of pre-trained models in the field of natural language processing. In recent years, large language models have developed rapidly, with a rapid growth trend in development scale, continuous expansion of application scenarios, and endless emergence of diversified applications. With the development of large language models, technical innovations on how to reduce the scale of models and how to improve model performance continue to emerge. Faced with large Chinese and English language models with more than 100 billion parameters such as GPT-3 and LaMDA, their model training requires a lot of hardware resources. How to effectively improve the training speed and training efficiency has become a hot topic. In response to the efficiency issues in the training process of large language models, researchers have proposed a variety of optimization algorithms and parallel computing technologies, such as using data types with smaller memory usage to train model parameters, optimizing algorithms to reduce interactions with video memory, and reducing redundant video memory usage, which significantly improves the training speed and efficiency. Most of these optimization methods are added to model training in the form of third-party libraries. For example, the apex library mainly performs acceleration optimization for automatic mixed precision training and distributed training to improve the training efficiency of large language models.

[0075] like Figure 1 As shown in the figure, most optimizations that improve the efficiency of large language model training are mainly based on NVIDIA-GPU as the backend hardware platform. For other hardware devices, if you want to use the same large language model training optimization techniques to improve training performance, you need to re-connect; and most of the third-party libraries that improve the efficiency of large language model training are implemented based on the PyTorch deep learning framework, and other deep learning frameworks also need to be re-adapted.

[0076] There are currently two methods for accessing other hardware devices based on the PyTorch deep learning framework: one is to access in the form of patches, providing patches that support hardware devices based on the original third-party library, and recompiling to obtain new third-party libraries that support other hardware devices; the other is to provide a new third-party library that is suitable for the hardware device in a fully intrusive form, and adapt and publish the modified third-party library for the specific hardware device. If the third-party library provides a python interface, both of the above methods require intrusion into the python code for modification. The current technical solution has the following disadvantages:

[0077] 1. The connection is difficult and the development cycle is long. R&D personnel need to understand both the Python interface implementation and the calculation logic implementation to effectively connect to the third-party library;

[0078] 2. The version maintenance cost is high. The current two access methods require a lot of modifications to the implementation in the original third-party library. If the third-party library is updated, this method has a long update cycle and cannot be updated quickly;

[0079] 3. Low usability, difficult for users to use. If the user has more than two hardware devices at the same time, they need to install the third-party libraries of their respective hardware devices and the dependent libraries of the hardware devices respectively, which reduces the usability;

[0080] 4. Each hardware device only provides access methods suitable for itself, and there is no universal access solution;

[0081] 5. Most of them are based on NVIDIA GPU, and other hardware devices are difficult to use. Only some hardware devices support third-party libraries independently;

[0082] 6. Most of them are based on the PyTorch deep learning framework, which has great limitations. It is difficult for other deep learning frameworks to use the optimization methods in third-party libraries.

[0083] To this end, this application provides a third-party library access solution that can not only connect to different deep learning frameworks upward, but also be compatible with different hardware devices downward.

[0084] The embodiment of the present invention discloses a third-party library access method, see Figure 2 As shown, the method includes:

[0085] Step S11: obtaining a target third-party library used in the training process of the pre-training model, and combing the target third-party library to separate out the computing modules in the target third-party library; wherein the computing modules are used to implement computing functions of various algorithms.

[0086] In a specific embodiment, a large language model can be used as a specific type of pre-trained model, wherein the large language model has outstanding data processing capabilities and can exert its capabilities in many scenarios. It can be understood by those of ordinary skill in the art that the large language model is only for illustration and does not limit the type of the above-mentioned pre-trained model. The following embodiments are all illustrated by taking the large language model as an example, and will not be repeated later. In order to solve the efficiency problem in the training process of the large language model, it is usually added to the model training in the form of a third-party library to improve the training efficiency of the large language model. Therefore, in the embodiment of the present application, the limitations and inefficiency problems existing when accessing the third-party library are solved, and the access efficiency of the third-party library is effectively improved.

[0087] First, obtain the target third-party library used in the training process of the pre-trained model. Currently, when most third-party libraries are connected, it is necessary to adjust the python interface and modify the calculation logic implemented in C++. The technical requirements for R&D personnel are high and a comprehensive understanding of the calling logic of the entire third-party library is required. In response to this situation, the target third-party library is sorted out in the embodiment of the present application, and the relevant implementations of the specific calculation logic involved are separated to obtain the calculation module. In this way, when the artificial intelligence (AI) computing power framework is used to replace the calculation logic of the third-party library in the future, the original interface call can be retained, the access process is simplified, and the difficulty of version maintenance is reduced.

[0088] Generally, the third-party library will provide an external interface in Python and a specific computing logic implementation in C++. It is understandable that the external Python interface in the third-party library is usually implemented based on a deep learning framework, and its real core optimization is the computing logic implemented in C++, or the optimization of memory calls, or the reconstruction of certain structures in the pre-trained model. Therefore, in an embodiment of the present application, the process of combing the target third-party library to separate the computing modules in the target third-party library may include: determining the interactively called Python interface in the target third-party library and the computing logic interface implemented based on a preset programming language; segmenting the Python interface and the computing logic interface, and parsing the segmented results to obtain the computing modules in the target third-party library.

[0089] It is understandable that, since there is a clear boundary between Python and C++ interactive calls, the interface call on the Python side is separated from the implementation related to the computing logic involved in C++, and the computing logic interface implemented by C++ is located and analyzed to obtain the computing module. In addition, it can be understood by ordinary technicians in this field that the computing logic interface implemented by C++ is only for illustration and does not limit the above-mentioned technology of the computing logic interface implemented based on the preset programming language. The computing logic interface implemented by C++ is used as an example in the following embodiments for explanation, and will not be repeated later.

[0090] Step S12: Determine the type of deep learning framework connected to the target third-party library, and according to the type of deep learning framework, decompose the computing logic in the computing module into target operators executed based on the artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms.

[0091] In an embodiment of the present application, the calculation logic implemented in C++ is modified based on the AI ​​computing power framework. The AI ​​computing power framework can undertake multiple deep learning frameworks upward, so it is applicable to a variety of deep learning frameworks. First, determine the type of deep learning framework corresponding to the access to the target third-party library. Currently, the external python interface in most third-party libraries is implemented based on the PyTorch deep learning framework. Since the AI ​​computing power framework is applicable to a variety of deep learning frameworks, it can also be implemented based on other deep learning frameworks other than the PyTorch deep learning framework. Specifically, the types of deep learning frameworks accessing the target third-party library include the PyTorch deep learning framework and other deep learning frameworks other than the PyTorch deep learning framework. In this way, the training efficiency of large language models of each deep learning framework on different hardware devices can be effectively improved.

[0092] Furthermore, according to different types of deep learning frameworks, the calculation logic in the calculation module is modified accordingly based on the AI ​​computing power framework. According to the calculations involved in the calculation module, the calculation logic and calculation content are analyzed, and the calculation logic in the calculation module is decomposed into target operators executed based on the artificial intelligence computing power framework. In this way, the decomposed target operator is implemented using the AI ​​computing power framework, and multiple hardware device backends can be used with only one connection. And when modifying the implementation of the third-party library calculation module, since the calculation logic of most third-party libraries is stable and will not change too much due to version updates, the version maintenance cost is low, and fast version iteration can be achieved.

[0093] It should be pointed out that after the target operator is decomposed, the calling relationship and calling order between operators are determined according to the calculation logic of the operator, and finally the input and output required for the calculation are determined.

[0094] Step S13: Use the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and connect heterogeneous hardware devices based on the artificial intelligence computing power framework and the target third-party library.

[0095] Based on the above steps, it can be seen that after obtaining the target operator, the calling relationship and calling order between the operators are also determined, as well as the input and output required for calculation. At this time, the calculation logic of the three-party library can be realized by calling the corresponding target operator after decomposition using the artificial intelligence computing power framework. It can be seen that in the embodiment of the present application, the implementation of the three-party library calculation logic can be completed based on the artificial intelligence computing power framework, and the three-party library can be accessed without making other changes.

[0096] In the embodiment of the present application, the AI ​​computing framework is used as the implementation platform of the third-party library computing logic, and the heterogeneous hardware devices are connected to the target third-party library based on the artificial intelligence computing framework. Different hardware devices can be used with only one connection, or when the user has more than two hardware devices at the same time, multiple hardware devices can be used with one connection, thereby improving the access efficiency of the third-party library.

[0097] The present application provides a method for accessing a third-party library, including: obtaining a target third-party library used in a pre-training model training process, and combing the target third-party library to separate out computing modules in the target third-party library; wherein the computing modules are used to implement computing functions of various algorithms; determining a deep learning framework type for accessing the target third-party library, and according to the deep learning framework type, decomposing the computing logic in the computing module into a target operator executed based on an artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms; using the artificial intelligence computing power framework to call the target operator to complete the access to the target third-party library, and docking heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

[0098] The beneficial technical effects of the present application are as follows: for the optimization process of pre-trained model training, by combing the target third-party library used, the calculation modules used to implement various algorithm calculations are separated and decomposed and reconstructed, which effectively retains the integrity of other interfaces, reduces the amount of code modification, greatly reduces the third-party library access process, and effectively improves the efficiency of third-party library access. Since the present invention only modifies the calculation logic for the third-party library access scheme, it can access different deep learning frameworks, which improves the training efficiency of pre-trained models of other deep learning frameworks. Further, the artificial intelligence computing power framework is used as the implementation platform of the third-party library calculation logic, and the calculation logic of the third-party library is realized by calling the decomposed target operator, so that heterogeneous hardware devices can be connected once, and the access of the back-ends of multiple hardware devices can be realized, reducing the adaptation cost, reducing the investment in human cost, and effectively improving the adaptation efficiency of heterogeneous hardware devices of the third-party library. It can be seen that the calculation logic in the third-party library is executed based on the artificial intelligence computing power framework to realize the access of the third-party library, which can not only undertake different deep learning frameworks upward, but also be compatible with different hardware devices downward, effectively improving the development efficiency.

[0099] like Figure 3 The figure shows a schematic diagram of a general access process of a third-party library based on an AI computing power framework. For different types of deep learning frameworks, the calculation modules involved in the third-party library are first sorted out, and only the calculation modules in the third-party library are decomposed and reconstructed, which effectively retains the integrity of other interfaces, greatly reduces the access process of the third-party library, and effectively improves the access efficiency of the third-party library. Secondly, according to the calculations involved in the calculation module, the calculation logic and calculation content are analyzed and decomposed into corresponding operator implementations; next, according to the operator calculation logic, the calling relationship and calling order between operators are determined; finally, the input and output required for the calculation are determined, and the corresponding operator after decomposition is called based on the AI ​​computing power framework to realize the calculation logic of the third-party library and complete the access of the third-party library. And multiple hardware backends can be called once accessed. It can be seen that by splitting the interface call and the calculation logic implementation, the calculation logic in the third-party library is reconstructed based on the AI ​​computing power framework, the original interface call is retained, the code modification amount is reduced, the access steps are simplified, the version maintenance cost is reduced, and the access efficiency of the third-party library is improved. In addition, the present invention can also be applied to other fields, such as the access of the cv-cuda tripartite library in the cv (Computer Vision) field, and is not specifically limited here.

[0100] The following is a detailed introduction to the second embodiment of a third-party library access method provided by the present invention. The second embodiment is implemented based on the above embodiment and is expanded to a certain extent on the basis of the above embodiment. In a specific implementation, if the deep learning framework type of the target third-party library is the PyTorch deep learning framework, according to the deep learning framework type, decomposing the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing framework may include the following steps:

[0101] The computing logic in the computing module is decomposed according to the first operator provided by the artificial intelligence computing power framework to obtain a target operator executed based on the artificial intelligence computing power framework.

[0102] In the embodiment of the present application, the operator is decomposed according to the computational logic in the computational module, that is, the operator to be used is analyzed according to its computational logic. Specifically, it is determined whether the artificial intelligence computing power framework provides the first operator; when the artificial intelligence computing power framework provides the first operator, the first operator is directly called and the first operator is determined as the target operator to be executed based on the artificial intelligence computing power framework; when the artificial intelligence computing power framework does not provide the first operator, the computational logic in the computational module is decomposed into operator expressions, and the operator expressions are parsed to obtain the target operator to be executed based on the artificial intelligence computing power framework.

[0103] It is understandable that if the AI ​​computing framework already provides operators for calculations in the third-party library, the operator can be called directly; if it is not provided in the AI ​​computing framework, it needs to be decomposed into the basic operator expression according to its calculation logic, and the target operator is obtained by analyzing the basic operator expression and decomposing it into the basic operator.

[0104] It should be pointed out that after determining the target operator, the next step is to determine the calling order of the target operator in the AI ​​computing framework, as well as the corresponding operator input and output when executing the calculation module to complete the implementation of the overall calculation logic.

[0105] Specifically, determine the first calling sequence when the artificial intelligence computing power framework is used to call the current target operator; respectively determine whether the first input parameter and the first output parameter corresponding to the calculation logic in the target three-party library are consistent with the second input parameter and the second output parameter corresponding to the current target operator to obtain a first judgment result, so as to determine the first target input and output of the calculation module according to the first judgment result. After the target operator is obtained, and the first calling sequence when the artificial intelligence computing power framework calls the current target operator, as well as the first target input and output of the calculation module are determined, correspondingly, the artificial intelligence computing power framework is used to call the target operator to complete the access to the target three-party library, including: based on the first calling sequence and the first target input and output of the calculation module, the artificial intelligence computing power framework is used to call the target operator to complete the access to the target three-party library.

[0106] Furthermore, for the first target input and output of the calculation module, it is necessary to determine whether the input and output of the calculation logic part in the tripartite library are consistent with the input and output of the decomposed operator. In a specific implementation, when the first input parameter and the first output parameter are consistent with the second input parameter and the second output parameter, the first input parameter or the second input parameter is determined as the input parameter of the calculation module to obtain the first target input of the calculation module, and the first output parameter or the second output parameter is determined as the output parameter of the calculation module to obtain the first target output of the calculation module. That is, if the input and output parameters of the two are consistent, it is sufficient to directly determine that any parameter between the two corresponds to the corresponding input and output parameters.

[0107] In another specific implementation, when the first input parameter and the first output parameter are inconsistent with the second input parameter and the second output parameter, the input parameter of the calculation module is added through the first parameter input interface to obtain the first target input of the calculation module, and the second output parameter is determined as the output parameter of the calculation module to obtain the first target output of the calculation module. That is, if the input parameters are inconsistent, the input parameters are manually added through the first parameter input interface while ensuring that the basic input data remains unchanged; the output parameters are mainly based on the output of the tripartite library calculation module.

[0108] It is worth noting that it is necessary to ensure that the input and output of the intermediate results meet the operator calling requirements according to the calling order of the target operator. Specifically, the intermediate input parameters and intermediate output parameters when the computing module implements the computing function are obtained; and the intermediate input parameters and the intermediate output parameters are called based on the first calling order.

[0109] Finally, based on the AI ​​computing power framework, the decomposed operators are implemented to realize the computing logic of the third-party library and complete the access to the third-party library.

[0110] It can be seen that when using the PyTorch deep learning framework to access a third-party library, only the computing modules in the third-party library are decomposed and reconstructed, which effectively retains the integrity of other interfaces, reduces the amount of code modification, greatly shortens the third-party library access process, simplifies the access steps, and effectively improves the efficiency of third-party library access; using the AI ​​computing power framework to implement the decomposed operator, you only need to connect once to use multiple hardware device backends, reduce adaptation costs, and save labor costs.

[0111] Based on the above embodiment, in a feasible implementation, when using a third-party library for optimization in other deep learning frameworks, it is not necessary to connect to its python interface. In the embodiment of the present application, the third-party library access work is performed for the scenario where the deep learning framework type of the target third-party library is the other deep learning framework. Specifically, the following steps may be included:

[0112] Determine whether there is a target implementation method for the target third-party library in the other deep learning framework to obtain a second determination result;

[0113] Based on the second judgment result, the calculation logic in the calculation module is decomposed into target operators executed based on the artificial intelligence computing power framework.

[0114] In the embodiment of the present application, the computing logic implemented in C++ is modified based on the AI ​​computing power framework. When third-party libraries are used for optimization in other deep learning frameworks, their python interfaces can be disconnected. This ensures that the access to third-party libraries can be effectively executed while ensuring that the python interface is not connected, and multiple hardware backends can be called with one access.

[0115] When accessing the target third-party library based on other deep learning frameworks, first analyze whether there is a unique implementation for the target third-party library in other deep learning frameworks. In other words, determine whether there is a target implementation method for the target third-party library in other deep learning frameworks.

[0116] It is understandable that if there is a target implementation method for the target third-party library in other deep learning frameworks, it means that the unique implementation method can be called to access the target third-party library. Otherwise, it is necessary to further determine whether the access to the target third-party library can be achieved by formulating rules or customizing operator rules.

[0117] In a specific implementation, if there is a target implementation method for the target third-party library in the other deep learning framework, the target implementation method is parsed to determine whether a non-compiled deep learning framework source code interface is reserved in the other deep learning framework; when the non-compiled deep learning framework source code interface is reserved in the other deep learning framework, the calculation logic in the calculation module is decomposed into a target operator executed based on the artificial intelligence computing power framework based on the non-compiled deep learning framework source code interface.

[0118] It can be seen that by analyzing the target implementation method for the target third-party library, it is determined whether a non-compiled deep learning framework source code interface is reserved. When a non-compiled deep learning framework source code interface is reserved, the operation of decomposing the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing framework can be performed based on the interface.

[0119] Furthermore, after the calculation logic in the third-party library is decomposed into target operators based on the AI ​​computing framework, it is also necessary to analyze the calling relationship and calling order of the decomposed operators, as well as the input and output of the computing module, to complete the implementation of the overall calculation logic. Specifically, determine the second calling order when calling the current target operator using the artificial intelligence computing framework; determine whether the third input parameter and the third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with the fourth input parameter and the fourth output parameter corresponding to the current target operator to obtain the corresponding third judgment result, so as to determine the second target input and output of the computing module according to the third judgment result.

[0120] After the target operator is obtained, and the second calling order when the artificial intelligence computing power framework calls the current target operator, as well as the second target input and output of the computing module are determined, the artificial intelligence computing power framework is used to call the target operator to complete the access to the target three-party library, including: based on the second calling order and the second target input and output of the computing module, the artificial intelligence computing power framework is used to call the target operator to complete the access to the target three-party library. It can be seen that the AI ​​computing power framework is called in sequence according to the calling order between the determined target operators; and the input and output in the reserved interface are analyzed to determine whether the main input and output parameters meet the decomposed operator.

[0121] In addition, it should be noted that if the input parameter is missing, it needs to be added manually. Specifically, when the non-compiled deep learning framework source code interface lacks the third input parameter, the step of adding the input parameter of the calculation module through the second parameter input interface to obtain the second target input of the calculation module is triggered.

[0122] In the embodiment of the present application, for analyzing the input and output in the reserved interface, judging whether the main input and output parameters satisfy the decomposed operator is also done by determining whether the input and output of the calculation logic part in the tripartite library are consistent with the input and output of the decomposed operator. In a specific implementation, when the third input parameter and the third output parameter are consistent with the fourth input parameter and the fourth output parameter, the third input parameter or the fourth input parameter is determined as the input parameter of the calculation module to obtain the second target input of the calculation module, and the third output parameter or the fourth output parameter is determined as the output parameter of the calculation module to obtain the second target output of the calculation module. That is, if the input and output parameters of the two are consistent, it is sufficient to directly determine that any parameter between the two corresponds to the corresponding input and output parameters.

[0123] In another specific implementation, when the third input parameter and the third output parameter are inconsistent with the fourth input parameter and the fourth output parameter, the input parameter of the calculation module is added through the second parameter input interface to obtain the second target input of the calculation module, and the fourth output parameter is determined as the output parameter of the calculation module to obtain the second target output of the calculation module. That is, if the input parameters are inconsistent, the input parameters are manually added through the second parameter input interface while ensuring that the basic input data remains unchanged; the output parameters are mainly based on the output of the tripartite library calculation module.

[0124] It is understandable that the aforementioned processes are all the corresponding execution processes when there are unique implementation methods for the target third-party library in other deep learning frameworks, or when the non-compiled deep learning framework source code interface is reserved for the unique implementation method of the target third-party library. Then, if there is no target implementation method for the target third-party library in the other deep learning framework, or when the non-compiled deep learning framework source code interface is not reserved in the other deep learning framework, it is determined whether the other deep learning framework has a custom operator interface to obtain a fourth judgment result, so as to determine whether the other deep learning framework supports access to the target third-party library based on the fourth judgment result. That is, by analyzing whether there is a custom operator interface in other deep learning frameworks, it is determined whether the target third-party library can be accessed.

[0125] In a specific implementation, if the custom operator interface exists in the other deep learning framework, the second operator is customized based on the custom operator interface so as to access the target third-party library based on the second operator. It is understandable that if the custom operator interface exists in other deep learning frameworks, then the custom operator interface can be used to formulate corresponding unique rules or custom operator rules according to different deep learning frameworks, and add custom operators to support the third-party library to optimize performance. Specifically, the fourth input parameter and the fourth output parameter corresponding to the current target operator are respectively used as the fifth input parameter and the fifth output parameter corresponding to the custom operator interface; the second operator is registered based on the fifth input parameter and the fifth output parameter so as to access the target third-party library based on the second operator.

[0126] It can be seen that by analyzing the input and output of the computing module in the target third-party library, the input of the custom operator interface can be based on the operator input provided by the AI ​​computing framework, which includes the input of the computing module in the target third-party library; the output needs to be aligned with the output of the relevant operator in the target third-party library. In this way, the custom operator rules are implemented, and then registered as a custom operator according to the custom operator rules to complete the third-party library access.

[0127] In another specific implementation, if the other deep learning framework does not have the custom operator interface, it is determined that the other deep learning framework does not support access to the target third-party library. It is understandable that if the other deep learning framework does not have a custom operator interface, there is no relevant way to implement operator customization to connect to the third-party library, and access to the third-party library cannot be achieved at this time.

[0128] like Figure 4 The following is a flow chart of accessing third-party libraries in other deep learning frameworks. The specific steps are as follows:

[0129] 1. First, analyze whether the deep learning framework has a unique implementation for a third-party library. If so, proceed to step 2; otherwise, proceed to step 4.

[0130] 2. Analyze whether a non-compiled deep learning framework source code interface is reserved for the unique implementation of a third-party library. If yes, proceed to step 3; if not, proceed to step 4.

[0131] 3. Decompose the calculation logic in the third-party library into operators based on the AI ​​computing framework, analyze the calling relationship and calling order of the decomposed operators, and call the operators in the AI ​​computing framework in sequence; analyze the input and output in the reserved interface to determine whether the main input parameters meet the requirements of the decomposed operators. If the input parameters are missing, they need to be added manually.

[0132] 4. Analyze whether the deep learning framework has a custom operator interface. If so, execute step 5. If not, it cannot support third-party library access.

[0133] 5. Decompose the calculation logic in the third-party library into operators based on the AI ​​computing framework, analyze the calling relationship and calling order of the decomposed operators, and call the operators in the AI ​​computing framework in sequence; analyze the input and output of the relevant modules in the third-party library. The custom operator input can be based on the operator input provided by the AI ​​computing framework, including the input of the relevant modules in the third-party library, and the output needs to be aligned with the output of the relevant operators in the original third-party library;

[0134] 6. According to the custom operator rules, register as a custom operator and complete the third-party library access.

[0135] It can be seen that by implementing universal third-party library access based on the AI ​​computing framework and only modifying the calculation logic, other deep learning frameworks can be connected to the third-party library for optimization, which improves the training efficiency of other deep learning frameworks in optimizing pre-trained models. At the same time, the AI ​​computing framework is used to implement the operators after the decomposition of the third-party library calculation logic. Custom operators can be added according to the unique rules or custom operator rules formulated by different deep learning frameworks to support the performance optimization brought by the third-party library.

[0136] Correspondingly, the present application embodiment also discloses a third-party library access device, see Figure 5 As shown, the device comprises:

[0137] The computing function segmentation module 11 is used to obtain the target three-party library used in the pre-training model training process, and to sort out the target three-party library to segment the computing modules in the target three-party library; wherein the computing modules are used to implement the computing functions of various algorithms;

[0138] The target operator determination module 12 is used to determine the type of deep learning framework accessing the target third-party library, and according to the type of deep learning framework, decompose the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing framework; the artificial intelligence computing framework is a computing framework for implementing artificial intelligence algorithms;

[0139] The third-party library access module 13 is used to use the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and to connect heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

[0140] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0141] It can be seen that the above scheme of this embodiment includes: obtaining the target third-party library used in the training process of the pre-trained model, and combing the target third-party library to separate the computing modules in the target third-party library; wherein the computing module is used to implement the computing functions of various algorithms; determining the type of deep learning framework accessing the target third-party library, and according to the type of deep learning framework, decomposing the computing logic in the computing module into target operators executed based on the artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms; using the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and docking heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

[0142] The beneficial technical effects of the present application are as follows: for the optimization process of pre-trained model training, by combing the target third-party library used, the calculation modules used to implement various algorithm calculations are separated and decomposed and reconstructed, which effectively retains the integrity of other interfaces, reduces the amount of code modification, greatly reduces the third-party library access process, and effectively improves the efficiency of third-party library access. Since the present invention only modifies the calculation logic for the third-party library access scheme, it can access different deep learning frameworks, which improves the training efficiency of pre-trained models of other deep learning frameworks. Further, the artificial intelligence computing power framework is used as the implementation platform of the third-party library calculation logic, and the calculation logic of the third-party library is realized by calling the decomposed target operator, so that heterogeneous hardware devices can be connected once, and the access of the back-ends of multiple hardware devices can be realized, reducing the adaptation cost, reducing the investment in human cost, and effectively improving the adaptation efficiency of heterogeneous hardware devices of the third-party library. It can be seen that the calculation logic in the third-party library is executed based on the artificial intelligence computing power framework to realize the access of the third-party library, which can not only undertake different deep learning frameworks upward, but also be compatible with different hardware devices downward, effectively improving the development efficiency.

[0143] In a specific implementation, the target operator determination module 12 includes:

[0144] The first operator determination module is used to decompose the calculation logic in the calculation module according to the first operator provided by the artificial intelligence computing power framework if the deep learning framework type of the target third-party library is the PyTorch deep learning framework, so as to obtain a target operator executed based on the artificial intelligence computing power framework.

[0145] In a specific implementation, the first operator determination module includes:

[0146] An operator determination unit, used to determine whether the artificial intelligence computing power framework provides the first operator;

[0147] A first processing unit, configured to directly call the first operator and determine the first operator as a target operator to be executed based on the artificial intelligence computing power framework when the artificial intelligence computing power framework provides the first operator;

[0148] The second processing unit is used to decompose the calculation logic in the calculation module into operator expressions when the artificial intelligence computing power framework does not provide the first operator, and parse the operator expressions to obtain a target operator executed based on the artificial intelligence computing power framework.

[0149] In a specific implementation, the first operator determination module further includes:

[0150] A first calling sequence determination module, used to determine a first calling sequence when calling the current target operator using the artificial intelligence computing power framework;

[0151] A first target input / output determination module, used to respectively determine whether a first input parameter and a first output parameter corresponding to the calculation logic in the target tripartite library are consistent with a second input parameter and a second output parameter corresponding to the current target operator, so as to obtain a first determination result, so as to determine a first target input / output of the calculation module according to the first determination result;

[0152] Accordingly, the third-party library access module 13 is specifically used for:

[0153] Based on the first calling order and the first target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

[0154] In a specific implementation, the first target input / output determination module is specifically configured to:

[0155] When the first input parameter and the first output parameter are consistent with the second input parameter and the second output parameter, determining the first input parameter or the second input parameter as the input parameter of the calculation module to obtain a first target input of the calculation module, and determining the first output parameter or the second output parameter as the output parameter of the calculation module to obtain a first target output of the calculation module;

[0156] When the first input parameter and the first output parameter are inconsistent with the second input parameter and the second output parameter, the input parameter of the calculation module is added through the first parameter input interface to obtain the first target input of the calculation module, and the second output parameter is determined as the output parameter of the calculation module to obtain the first target output of the calculation module.

[0157] In a specific implementation, the first target input / output determination module further includes:

[0158] An intermediate parameter acquisition module, used to acquire intermediate input parameters and intermediate output parameters when the calculation module implements the calculation function;

[0159] An intermediate parameter calling module is used to call the intermediate input parameter and the intermediate output parameter based on the first calling sequence.

[0160] In a specific implementation, the target operator determination module 12 includes:

[0161] The second operator determination module is used to determine whether there is a target implementation method for the target third-party library in the other deep learning framework if the deep learning framework type of the target third-party library is the other deep learning framework, so as to obtain a second judgment result; based on the second judgment result, the calculation logic in the calculation module is decomposed into a target operator executed based on the artificial intelligence computing power framework.

[0162] In a specific implementation, the second operator determination module includes:

[0163] A reserved interface judgment module is used to parse the target implementation method for the target third-party library to determine whether a non-compiled deep learning framework source code interface is reserved in the other deep learning framework if the target implementation method for the target third-party library exists in the other deep learning framework;

[0164] The third processing unit is used to decompose the computing logic in the computing module into target operators executed based on the artificial intelligence computing power framework based on the non-compiled deep learning framework source code interface when the non-compiled deep learning framework source code interface is reserved in the other deep learning framework.

[0165] In a specific implementation, the second operator determination module further includes:

[0166] A second calling sequence determination module, used to determine a second calling sequence when calling the current target operator using the artificial intelligence computing power framework;

[0167] A second target input / output determination module is used to determine whether a third input parameter and a third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with a fourth input parameter and a fourth output parameter corresponding to the current target operator, so as to obtain a corresponding third judgment result, so as to determine the second target input / output of the calculation module according to the third judgment result;

[0168] Accordingly, the third-party library access module 13 is specifically used for:

[0169] Based on the second calling order and the second target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

[0170] In a specific implementation, the second target input / output determination module is specifically configured to:

[0171] When the third input parameter and the third output parameter are consistent with the fourth input parameter and the fourth output parameter, determining the third input parameter or the fourth input parameter as the input parameter of the calculation module to obtain the second target input of the calculation module, and determining the third output parameter or the fourth output parameter as the output parameter of the calculation module to obtain the second target output of the calculation module;

[0172] When the third input parameter and the third output parameter are inconsistent with the fourth input parameter and the fourth output parameter, the input parameter of the calculation module is added through the second parameter input interface to obtain the second target input of the calculation module, and the fourth output parameter is determined as the output parameter of the calculation module to obtain the second target output of the calculation module.

[0173] In a specific implementation, the second target input / output determination module further includes:

[0174] A parameter input unit is used to trigger the step of adding the input parameters of the computing module through the second parameter input interface to obtain the second target input of the computing module when the non-compiled deep learning framework source code interface lacks the third input parameter.

[0175] In a specific implementation, the second operator determination module further includes:

[0176] The fourth processing unit is used to determine whether the other deep learning framework has a custom operator interface to obtain a fourth judgment result if the other deep learning framework does not have a target implementation method for the target third-party library, or when the non-compiled deep learning framework source code interface is not reserved in the other deep learning framework, so as to determine whether the other deep learning framework supports access to the target third-party library according to the fourth judgment result.

[0177] In a specific implementation, the fourth processing unit is specifically configured to:

[0178] If the other deep learning framework has the custom operator interface, a second operator is customized based on the custom operator interface, so as to access the target third-party library based on the second operator;

[0179] If the other deep learning framework does not have the custom operator interface, it is determined that the other deep learning framework does not support access to the target third-party library.

[0180] In a specific implementation, the fourth processing unit is specifically configured to:

[0181] Respectively taking the fourth input parameter and the fourth output parameter corresponding to the current target operator as the fifth input parameter and the fifth output parameter corresponding to the custom operator interface;

[0182] The second operator is registered based on the fifth input parameter and the fifth output parameter, so as to access the target third-party library based on the second operator.

[0183] In a specific implementation, the computing function segmentation module 11 includes:

[0184] An interface acquisition module is used to determine the Python interface for interactive calls in the target third-party library and the computing logic interface implemented based on a preset programming language;

[0185] The function segmentation module is used to segment the Python interface and the computing logic interface, and parse the segmentation result to obtain the computing module in the target third-party library.

[0186] Furthermore, the present application also discloses an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.

[0187] Figure 6 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the third-party library access method disclosed in any of the aforementioned embodiments.

[0188] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0189] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The data 223 may include various data. The storage method may be temporary storage or permanent storage.

[0190] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the third-party library access method executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0191] Furthermore, the embodiments of the present application also disclose a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes a random access memory (Random Access Memory, RAM), a memory, a read-only memory (Read-Only Memory, ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk or an optical disk, or any other form of storage medium known in the technical field. Wherein, when the computer program is executed by the processor, the aforementioned three-party library access method is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0192] Furthermore, an embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements any one of the above-mentioned third-party library access methods.

[0193] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0194] The steps of the third-party library access method or algorithm described in the embodiments disclosed herein can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0195] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0196] The above is a detailed introduction to a third-party library access method, device, equipment, program product and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A third-party library access method, It is characterized in that include: Obtaining a target third-party library used in the training process of the pre-training model, and combing the target third-party library to separate out the computing modules in the target third-party library; wherein the computing modules are used to implement computing functions of various algorithms; Determine the type of deep learning framework connected to the target third-party library, and according to the type of deep learning framework, decompose the computing logic in the computing module into target operators executed based on the artificial intelligence computing power framework; the artificial intelligence computing power framework is a computing framework for implementing artificial intelligence algorithms; if the deep learning framework type of the target third-party library is the PyTorch deep learning framework, decompose the computing logic in the computing module according to the first operator provided by the artificial intelligence computing power framework to obtain the target operator executed based on the artificial intelligence computing power framework; if the deep learning framework type of the target third-party library is other deep learning frameworks, determine whether a non-compiled deep learning framework source code interface is reserved by analyzing the target implementation method for the target third-party library, so as to decompose the computing logic in the computing module into target operators executed based on the artificial intelligence computing power framework; The artificial intelligence computing power framework is used to call the target operator to complete the access of the target third-party library, and the heterogeneous hardware device is connected to the target third-party library based on the artificial intelligence computing power framework.

2. According to the third-party library access method of claim 1, It is characterized in that The types of deep learning frameworks accessed to the target third-party library include the PyTorch deep learning framework and other deep learning frameworks except the PyTorch deep learning framework.

3. According to the third-party library access method of claim 1, It is characterized in that The decomposing the computing logic in the computing module according to the first operator provided by the artificial intelligence computing power framework to obtain a target operator executed based on the artificial intelligence computing power framework includes: Determining whether the artificial intelligence computing power framework provides the first operator; When the artificial intelligence computing power framework provides the first operator, directly calling the first operator and determining the first operator as a target operator to be executed based on the artificial intelligence computing power framework; When the artificial intelligence computing power framework does not provide the first operator, the calculation logic in the calculation module is decomposed into operator expressions, and the operator expressions are parsed to obtain a target operator executed based on the artificial intelligence computing power framework.

4. According to the third-party library access method according to claim 2 or 3, It is characterized in that According to the deep learning framework type, after decomposing the computing logic in the computing module into target operators executed based on the artificial intelligence computing framework, it also includes: Determine a first calling sequence when calling the current target operator using the artificial intelligence computing power framework; Respectively judging whether the first input parameter and the first output parameter corresponding to the calculation logic in the target tripartite library are consistent with the second input parameter and the second output parameter corresponding to the current target operator, so as to obtain a first judgment result, so as to determine the first target input and output of the calculation module according to the first judgment result; Accordingly, the target operator is called by the artificial intelligence computing framework to complete the access to the target third-party library, including: Based on the first calling order and the first target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

5. According to the third-party library access method of claim 4, It is characterized in that The respectively judging whether the first input parameter and the first output parameter corresponding to the calculation logic in the target tripartite library are consistent with the second input parameter and the second output parameter corresponding to the current target operator to obtain a first judgment result, so as to determine the first target input and output of the calculation module according to the first judgment result, includes: When the first input parameter and the first output parameter are consistent with the second input parameter and the second output parameter, determining the first input parameter or the second input parameter as the input parameter of the calculation module to obtain a first target input of the calculation module, and determining the first output parameter or the second output parameter as the output parameter of the calculation module to obtain a first target output of the calculation module; When the first input parameter and the first output parameter are inconsistent with the second input parameter and the second output parameter, the input parameter of the calculation module is added through the first parameter input interface to obtain the first target input of the calculation module, and the second output parameter is determined as the output parameter of the calculation module to obtain the first target output of the calculation module.

6. The third-party library access method according to claim 4, It is characterized in that Also includes: Obtaining intermediate input parameters and intermediate output parameters when the calculation module implements the calculation function; The intermediate input parameter and the intermediate output parameter are called based on the first calling sequence.

7. The third-party library access method according to claim 2, It is characterized in that The determining of the type of deep learning framework accessing the target third-party library, and decomposing the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing framework according to the type of deep learning framework, includes: If the deep learning framework type of the target third-party library is the other deep learning framework, determining whether there is a target implementation method for the target third-party library in the other deep learning framework to obtain a second determination result; Based on the second judgment result, the calculation logic in the calculation module is decomposed into target operators executed based on the artificial intelligence computing power framework.

8. The third-party library access method according to claim 7, It is characterized in that The decomposing the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing power framework based on the second judgment result includes: If the other deep learning framework has a target implementation method for the target third-party library, the target implementation method is parsed to determine whether a non-compiled deep learning framework source code interface is reserved in the other deep learning framework; When the non-compiled deep learning framework source code interface is reserved in the other deep learning framework, the computing logic in the computing module is decomposed into target operators executed based on the artificial intelligence computing power framework based on the non-compiled deep learning framework source code interface.

9. The third-party library access method according to claim 8, It is characterized in that According to the deep learning framework type, after decomposing the computing logic in the computing module into target operators executed based on the artificial intelligence computing framework, it also includes: Determine a second calling order when calling the current target operator using the artificial intelligence computing power framework; Determine whether the third input parameter and the third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with the fourth input parameter and the fourth output parameter corresponding to the current target operator to obtain a corresponding third judgment result, so as to determine the second target input and output of the calculation module according to the third judgment result; Accordingly, the target operator is called by the artificial intelligence computing framework to complete the access to the target third-party library, including: Based on the second calling order and the second target input and output of the computing module, the target operator is called using the artificial intelligence computing power framework to complete the access to the target third-party library.

10. The third-party library access method according to claim 9, It is characterized in that The determining whether the third input parameter and the third output parameter corresponding to the non-compiled deep learning framework source code interface are consistent with the fourth input parameter and the fourth output parameter corresponding to the current target operator to obtain a corresponding third determination result, so as to determine the second target input and output of the calculation module according to the third determination result, includes: When the third input parameter and the third output parameter are consistent with the fourth input parameter and the fourth output parameter, determining the third input parameter or the fourth input parameter as the input parameter of the calculation module to obtain the second target input of the calculation module, and determining the third output parameter or the fourth output parameter as the output parameter of the calculation module to obtain the second target output of the calculation module; When the third input parameter and the third output parameter are inconsistent with the fourth input parameter and the fourth output parameter, the input parameter of the calculation module is added through the second parameter input interface to obtain the second target input of the calculation module, and the fourth output parameter is determined as the output parameter of the calculation module to obtain the second target output of the calculation module.

11. The third-party library access method according to claim 10, It is characterized in that Also includes: When the non-compiled deep learning framework source code interface lacks the third input parameter, the step of adding the input parameter of the computing module through the second parameter input interface to obtain the second target input of the computing module is triggered.

12. The third-party library access method according to claim 9, It is characterized in that Also includes: If the other deep learning framework does not have a target implementation method for the target third-party library, or when the non-compiled deep learning framework source code interface is not reserved in the other deep learning framework, it is determined whether the other deep learning framework has a custom operator interface to obtain a fourth judgment result, so as to determine whether the other deep learning framework supports access to the target third-party library based on the fourth judgment result.

13. The third-party library access method according to claim 12, It is characterized in that The determining whether the other deep learning framework has a custom operator interface to obtain a fourth determination result, so as to determine whether the other deep learning framework supports access to the target third-party library according to the fourth determination result, includes: If the other deep learning framework has the custom operator interface, a second operator is customized based on the custom operator interface, so as to access the target third-party library based on the second operator; If the other deep learning framework does not have the custom operator interface, it is determined that the other deep learning framework does not support access to the target third-party library.

14. The third-party library access method according to claim 13, It is characterized in that The customizing the second operator based on the custom operator interface so as to access the target third-party library based on the second operator includes: Respectively taking the fourth input parameter and the fourth output parameter corresponding to the current target operator as the fifth input parameter and the fifth output parameter corresponding to the custom operator interface; The second operator is registered based on the fifth input parameter and the fifth output parameter, so as to access the target third-party library based on the second operator.

15. The third-party library access method according to claim 1, It is characterized in that The combing the target third-party library to separate the computing modules in the target third-party library includes: Determine the Python interface for interactive calls in the target third-party library and the computing logic interface implemented based on a preset programming language; The Python interface and the computing logic interface are split, and the split results are parsed to obtain the computing module in the target third-party library.

16. A third-party library access device, It is characterized in that include: A computing function segmentation module is used to obtain a target third-party library used in the training process of the pre-training model, and to sort out the target third-party library to segment out the computing modules in the target third-party library; wherein the computing modules are used to implement the computing functions of various algorithms; A target operator determination module is used to determine the type of deep learning framework connected to the target third-party library, and according to the type of deep learning framework, decompose the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing power framework; the artificial intelligence computing power framework is a calculation framework for implementing artificial intelligence algorithms; if the deep learning framework type of the target third-party library is the PyTorch deep learning framework, the calculation logic in the calculation module is decomposed according to the first operator provided by the artificial intelligence computing power framework to obtain the target operator executed based on the artificial intelligence computing power framework; if the deep learning framework type of the target third-party library is other deep learning frameworks, by analyzing the target implementation method for the target third-party library, it is determined whether a non-compiled deep learning framework source code interface is reserved to decompose the calculation logic in the calculation module into target operators executed based on the artificial intelligence computing power framework; The third-party library access module is used to use the artificial intelligence computing power framework to call the target operator to complete the access of the target third-party library, and to connect heterogeneous hardware devices with the target third-party library based on the artificial intelligence computing power framework.

17. An electronic device, It is characterized in that include: Memory for storing computer programs; A processor, used to load and execute the computer program to implement the third-party library access method described in any one of claims 1 to 15.

18. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the steps of the third-party library access method described in any one of claims 1 to 15 are implemented.

19. A computer-readable storage medium, It is characterized in that Used to store computer programs; wherein the computer program, when executed by a processor, implements the third-party library access method described in any one of claims 1 to 15.