WO2023056841A1 - 一种数据服务方法、装置及相关产品 - Google Patents
一种数据服务方法、装置及相关产品 Download PDFInfo
- Publication number
- WO2023056841A1 WO2023056841A1 PCT/CN2022/120165 CN2022120165W WO2023056841A1 WO 2023056841 A1 WO2023056841 A1 WO 2023056841A1 CN 2022120165 W CN2022120165 W CN 2022120165W WO 2023056841 A1 WO2023056841 A1 WO 2023056841A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- candidate data
- graph structure
- neural network
- data service
- data
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 96
- 238000013528 artificial neural network Methods 0.000 claims abstract description 107
- 230000008569 process Effects 0.000 claims abstract description 39
- 238000004364 calculation method Methods 0.000 claims description 42
- 238000005538 encapsulation Methods 0.000 claims description 25
- 230000006870 function Effects 0.000 claims description 17
- 238000004590 computer program Methods 0.000 claims description 10
- 230000003068 static effect Effects 0.000 claims description 3
- 238000012856 packing Methods 0.000 claims 1
- 238000007711 solidification Methods 0.000 claims 1
- 230000008023 solidification Effects 0.000 claims 1
- 230000005540 biological transmission Effects 0.000 abstract description 8
- 238000012423 maintenance Methods 0.000 abstract description 8
- 238000010586 diagram Methods 0.000 description 14
- 238000013135 deep learning Methods 0.000 description 13
- 239000011159 matrix material Substances 0.000 description 11
- 238000012545 processing Methods 0.000 description 11
- 238000007726 management method Methods 0.000 description 10
- 238000004891 communication Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 6
- 238000012546 transfer Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 3
- 230000008676 import Effects 0.000 description 3
- 238000010801 machine learning Methods 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000013459 approach Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013075 data extraction Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0631—Item recommendations
Definitions
- the present application relates to the technical field of machine learning, in particular to a data service method, device and related products.
- Machine learning is a multi-field interdisciplinary subject that studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance.
- Machine learning technology represented by deep learning is widely used in big data scenarios such as recommendation, advertising, and search.
- the online system needs to perform online calculations on large-scale data (such as the content, advertisements, and number of users of large-scale Internet services) and obtain the recommended ranking results.
- the deep neural network has the typical characteristics of complex structure and deep layers.
- Its computing framework is mainly based on graph computing, so as to adapt to the complex neural network structure.
- Typical deep neural network computing frameworks include TensorFlow, PyTorch, etc., which are characterized by supporting complete deep neural network training and line inference calculations.
- TensorFlow is an open source deep learning framework created by developers at Google.
- PyTorch is one of the latest deep learning frameworks, developed by a team at Facebook.
- the data set form of the candidate data is usually a very large-scale N ⁇ M matrix, where N represents the number of data pieces, and M represents the dimension of the data.
- the use of candidate data is divided into two types, namely, the use in the graph and the use outside the graph.
- the use method in the graph refers to: solidify the large-scale candidate data in the form of tensor matrix input into the neural network graph structure of TensorFlow, Pytorch and other graph computing frameworks, and use the serialization method of the graph computing framework to The network graph structure and the candidate data matrix are uniformly serialized, and then distributed to online services for inference calculations, etc.
- the way of using outside the graph refers to: the candidate data matrix is used as the external input parameter of the neural network graph structure, and is input to the neural network graph structure during inference calculation.
- the candidate data is in a "binding" relationship with the deep learning framework.
- the data and neural network graph structure cannot be independently updated and adjusted, and the degree of freedom for storing candidate data is also limited, which is very inconvenient.
- the embodiment of the present application provides a data service method, device and related products to improve the degree of freedom of candidate data storage and update, avoid unnecessary computing resource overhead, and reduce the implementation difficulty of parameter transmission and maintenance in the graph structure .
- the first aspect of the embodiment of the present application provides a data service method, including:
- the candidate data set corresponding to the target data service outside the neural network graph structure is obtained through a user-defined operator in the neural network graph structure;
- the target data service is performed using the neural network graph structure and the candidate data set.
- the second aspect of the embodiment of the present application provides a data service device, including:
- the candidate data set acquisition module is used to obtain the candidate data set corresponding to the target data service outside the neural network graph structure through a user-defined operator in the neural network graph structure after the process of the target data service is started;
- a data service module configured to utilize the neural network graph structure and the candidate data set to execute the target data service.
- the third aspect of the embodiments of the present application provides a processor configured to execute the data service method provided by the first aspect when the program is running.
- the fourth aspect of the embodiment of the present application provides an electronic device for data services, where the electronic device includes:
- processors for executing instructions stored in memory
- memory for storing one or more programs
- the one or more processors are made to implement the data service method provided in the first aspect.
- a fifth aspect of the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the data service method as provided in the first aspect is implemented.
- the data service method in the embodiment of the present application includes: after the target data service process is started, obtain the candidate data set corresponding to the target data service outside the neural network graph structure through a custom operator in the neural network graph structure, and then use the neural network
- the graph structure and the candidate data set obtained through the custom operator in the previous step execute the target data service.
- a hybrid graph computing framework with in-graph and out-of-graph is implemented with the help of custom operators.
- the user-defined operator is located in the graph (that is, inside the graph structure), and the candidate data is located outside the graph (that is, outside the graph structure).
- the user-defined operator in the graph can access and obtain the candidate data outside the graph, so that the candidate data can participate in the target data service.
- the candidate data is not solidified in the graph structure, so the decoupling of the candidate data and the graph structure is realized.
- the degree of freedom of update and storage of candidate data is improved.
- candidate data is accessed and read through a custom operator, and is not used as an input parameter of the entire graph structure. Therefore, the impact of candidate data on parameters in the graph structure is avoided. In this way, unnecessary computing resource overhead is avoided, and the implementation difficulty of parameter transmission and maintenance in the graph structure is reduced.
- Fig. 1 is a kind of schematic diagram that obtains candidate data outside the figure through the user-defined operator in the figure structure that the embodiment of the application provides;
- FIG. 2 is a flowchart of a data service method provided by an embodiment of the present application
- FIG. 3 is a flow chart of another data service method provided by the embodiment of the present application.
- FIG. 4 is a schematic structural diagram of a data service device provided by an embodiment of the present application.
- FIG. 5 is a schematic structural diagram of another data service device provided by an embodiment of the present application.
- FIG. 6 is a schematic structural diagram of another data service device provided by an embodiment of the present application.
- FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
- candidate data needs to be applied in many big data scenarios.
- the use methods of these candidate data include the use methods in the graph and the use methods outside the graph. Both approaches have their drawbacks.
- the candidate data needs to be solidified into the neural network graph structure and tightly coupled with the graph structure, so that data update and storage are limited to the deep learning graph computing framework to which the graph structure belongs, and the degree of freedom is extremely low.
- candidate data needs to be preprocessed into parameters suitable for input into the graph structure. In this method, the introduction of candidate data as input parameters increases the difficulty of parameter transmission and maintenance in the graph structure, and also brings Additional computational overhead.
- Candidate data is the data basis for providing data services.
- the inconvenience caused by the use of candidate data will also lower the upper limit of data service capabilities. For example, in big data scenarios such as recommendation and search, it leads to problems such as inaccurate recommendation results and search results, unstable accuracy, and low matching degree.
- the embodiment of the present application provides a method and device for implementing data services through a hybrid graph computing architecture of in-graph and out-of-graph.
- the user-defined operator inside the graph structure is used to obtain candidate data outside the graph structure.
- subsequent calculations can be performed only after obtaining a set of candidate data, and it is not necessary to specifically obtain a certain piece of candidate data. In all other application scenarios, it may be necessary to specify a certain piece of candidate data.
- an implementation manner of obtaining a candidate data set for data service is firstly introduced.
- this figure is a schematic diagram of obtaining candidate data sets outside the graph through a user-defined operator in the graph structure provided by the embodiment of the present application.
- the neural network graph structure shown in Figure 1 can be implemented based on the neural network graph structure in open source deep learning graph computing frameworks such as TensorFlow or Pytorch.
- the neural network graph structure shown in Figure 1 is different from the current commonly used neural network graph structure.
- a custom operator (Custom Op) is included inside the graph structure, and the custom operator is used as a part of the graph structure.
- This custom operator can be used to obtain data outside the graph structure, such as large-scale candidate data that is often required to meet data service requirements in big data scenarios.
- the user-defined operator can be injected into any node in the neural network graph structure, as shown in Figure 1, access to the candidate data set outside the graph is performed through the user-defined operator of a certain node.
- FIG. 2 the figure is a flowchart of a data service method provided by an embodiment of the present application.
- the data service methods shown in Figure 2 include:
- the data service mentioned in the embodiment of the present application refers to a calculation process that needs to use a large amount of candidate data as a data basis to be performed online.
- the target data service is defined.
- the target data service specifically refers to a data service that has a specific purpose and needs to be executed urgently.
- the target data service may be: providing search results based on search terms, or recommending commodities based on the user's historical shopping information.
- the data basis required for operations is also different.
- the candidate data corresponding to the target data service can be news reports; when the target data service recommends products based on the user's historical shopping information, the candidate data corresponding to the target data service can be It is product information.
- the process of the target data service Before performing the target data service, the process of the target data service needs to be started first.
- the start of the process of the target data service can be triggered by a specific operation. For example, in response to a confirmation operation after the user inputs a search term, the process of the target data service is triggered to start. For another example, in response to the user's sliding operation on the product page, the start of the process of the target data service is triggered. In practical applications, it is not limited to the above trigger mechanism for starting the process, and there is no restriction on the trigger mechanism for starting the data service process here.
- the custom operator in the neural network graph structure can obtain the candidate data set corresponding to the target data service outside the neural network graph structure.
- the candidate data is prepackaged in a data structure outside the neural network graph structure.
- the data structure may be a matrix.
- one row or column in the matrix may represent a piece of candidate data, and another dimension in the matrix may represent a component dimension of a piece of candidate data.
- a piece of candidate data in the matrix can be expressed in vector form.
- the data structure can be used as a candidate data set because it contains a large number of candidate data.
- each candidate data set has a name
- each piece of candidate data in a candidate data set has a unique identifier.
- the number of rows or columns of the candidate data in the candidate data set can be used as the identifier of the candidate data, and of course, an identifier can be assigned to the candidate data according to the content or use of the candidate data.
- an identifier can be assigned to the candidate data according to the content or use of the candidate data.
- the name of the candidate data set can be a unique code assigned randomly or by other means, or it can be a description formed based on the content or function of the candidate data set.
- the names of different candidate data sets are different from each other, therefore, the names of the candidate data sets can be used to uniquely determine the candidate data sets.
- a candidate data set has a unique corresponding pointer address in the data structure it encapsulates, and the pointer address can be used to obtain the candidate data set later.
- a preset information carrier can be set, the name of the candidate data set can be used as the name of the carrier, and the candidate data set The pointer address of the file is added to the content of the carrier.
- set the name of the candidate data set as the solidified parameter of the custom operator.
- the user-defined operator can obtain the pointer address of the candidate data set corresponding to the target data service according to the curing parameters and the previously introduced preset information carrier.
- the preset information carrier is obtained according to the curing parameters through the user-defined operator (in this case, the name of the candidate data set in the curing parameters is used as an index). Then query its content according to the preset information carrier, and obtain the pointer address of the candidate data set. Finally, the user-defined operator obtains the candidate data set outside the graph according to the pointer address access.
- the preset information carrier described in the embodiment of the present application refers to the information carrier that makes it possible to acquire the candidate data set outside the graph through its own name and content.
- the preset information carrier includes multiple implementation manners.
- the preset information carrier may be a static variable (static variable), a shared variable (shared variable) in a shared memory (shared memory), or a file (files).
- the preset information carrier as a shared variable as an example, the name of the candidate data set is used as the name of the shared variable, and the pointer address of the candidate data set is used as the value of the shared variable.
- the embodiment of the present application does not limit the implementation form of the preset information carrier.
- the implementation of the above scheme realizes the direct acquisition of the candidate data set based on the pointer address of the candidate data set.
- the candidate data set may also be encapsulated in advance to obtain an encapsulation class of the candidate data set. Then, the user-defined operator obtains the candidate data set by calling the interface function of the encapsulation class. It should be noted that, in practical applications, before providing target data services, some preset calculations may be performed based on candidate data sets to obtain corresponding calculation results.
- the calculation method of the preset calculation may be pre-set, for example, the preset calculation may be calculating an average, a minimum value, or sorting results.
- the preset calculation may be a calculation method related to the target data service, and the preset calculation is not limited in this embodiment of the present application.
- the calculation result of the preset calculation can also be obtained by calling the interface function of the encapsulation class.
- the above implementation methods realize the indirect acquisition of the candidate data set or its related calculation results by calling the interface function of the encapsulation class. Since the candidate data set is located outside the neural network graph structure, the candidate data set and the neural network graph structure are relatively separated.
- the custom operator in the graph structure serves as a "bridge" between the graph structure and the candidate data set outside the graph, enabling the candidate data set to participate in the target data service performed by the graph structure.
- S202 Execute the target data service by using the neural network graph structure and the candidate data set.
- the neural network graph structure After executing S201, the neural network graph structure has obtained candidate data sets outside the graph by means of a user-defined operator. Then, the neural network graph structure can execute the target data service according to these acquired candidate data sets. It should be noted that the graph parameters in the neural network graph structure mentioned in the embodiment of the present application have been pre-trained. Therefore, what this step S202 describes is the process of the neural network graph structure performing graph calculation based on the candidate data set to obtain the execution results (such as search results and recommendation results) of the target data service.
- the target data services involved may be different.
- the neural network graph structure may also have structural and parameter differences based on actual needs.
- the structure and parameters of the neural network graph structure and the implementation process of executing the target data service are not limited.
- a hybrid graph computing framework of in-graph and out-of-graph is realized with the help of self-defined operators.
- the custom operator is located in the graph (that is, inside the graph structure), and the candidate data set is located outside the graph (that is, outside the graph structure).
- the custom operator in the graph can access and obtain the candidate data set outside the graph, so that the candidate data set
- the data in can participate in the target data service.
- the candidate data set is not solidified in the graph structure, so the decoupling of the candidate data set and the graph structure is realized.
- the degree of freedom of update and storage of candidate data sets is improved.
- the candidate data set is accessed and read through a custom operator, and is not used as an input parameter of the entire graph structure. Therefore, the impact of candidate data on parameters in the graph structure is avoided. In this way, unnecessary computing resource overhead is avoided, and the implementation difficulty of parameter transmission and maintenance in the graph structure is reduced.
- target candidate data it may be necessary to use one or more pieces of candidate data in the candidate data set for data services.
- candidate data is referred to as target candidate data herein.
- an identifier of the target candidate data may be acquired first.
- the target candidate data may be extracted from the candidate data set according to the identifier of the target candidate data.
- the target data service is executed by using the neural network graph structure and the target candidate data.
- the candidate data sets are decoupled from the graph structure, so when it is necessary to update the candidate data sets (update the entire set or Part of the candidate data), the candidate data can be updated independently without affecting the graph structure, and the deep learning graph computing framework to which the graph structure belongs will not impose constraints and restrictions on the update of the candidate data set.
- the embodiment of the present application realizes a more flexible and rapid data update mechanism.
- the graph structure can also be updated independently of the candidate data set.
- the update of the graph structure does not affect the existing candidate data sets. Realize faster update of graph structure parameters, not limited by the update speed of large-scale data.
- the target data service is implemented by multiple neural network computing devices.
- the neural network computing device mentioned here may be a graphics card, or other dedicated chips.
- a graphics card is used as an example for description.
- the neural network graph structure has multiple copies, and after the target data service is started, the multiple copies are loaded one-to-one on multiple graphics cards. Since the candidate data is usually large-scale (existing in the form of candidate data sets), and the display memory of the graphics card is small, storing the candidate data sets separately will affect the performance of the graphics card. Since the neural network graph structure is decoupled from the candidate data set in the embodiment of the present application, the candidate data set can be stored outside of multiple graphics cards, for example, a copy of the candidate data can be stored in the internal memory.
- the duplication of the graph structure does not result in duplication of the candidate data.
- the candidate data sets outside the graph are shared and do not need to be stored in the video memory of each graphics card. In this way, video memory resources are saved, and the performance of the graphics card is improved.
- the neural network graph structure and the candidate data set are used to execute the target data service, specifically including: multiple neural network computing devices respectively execute the target data service based on their own loaded graph structure copy and the same candidate data set.
- the implementation of updating the candidate data set and the neural network structure diagram respectively is introduced.
- the candidate data set and the neural network graph structure can be loaded into the process, and then the operations described in S201-S202 are performed.
- the candidate data set (part or all of the candidate data) is independently updated, it is independently distributed to the process of the target data service.
- the graph structure is updated, it is separately distributed to the process of the target data service.
- the data service method may also include:
- the entire data package is updated.
- the new data package is distributed (loaded) as a whole into the process of the target data service.
- FIG. 3 is a flow chart of another data service method provided by an embodiment of the present application.
- the data service methods shown in Figure 3 include:
- the custom operator used in the embodiment of this application is the most significant difference between the neural network graph structure and other existing neural network graph structures.
- it is first necessary to encapsulate the implementation of the custom operator to access candidate data. It is realized by defining encapsulation class A and management class B. The following details:
- encapsulation class A of a data set that is, the data structure where large-scale candidate data resides, such as a matrix, which can also be understood as the aforementioned candidate data set.
- a class is used to describe a data set with a specific access interface.
- the interfaces defined in wrapper class A include:
- Incremental data is passed to the interface of the dataset object in the form of matrix parameters or byte streams, and the thread safety of incremental writing is guaranteed through internal locking or lock-free queues. This interface is used to update some candidate data in the candidate data set.
- encapsulation class A needs to support include: the method of memory allocation can be controlled through parameters, such as whether to allocate transparent huge page memory, video memory, etc.
- the defined interfaces include:
- the input parameter of a custom operator in the graph can be a list of data names participating in the calculation of the data service graph;
- the output data structure can be a vector query result tensor, or a vector dot product result tensor, etc.
- add an attribute to the custom operator the name of the dataset corresponding to the custom operator.
- the custom operator refers to the header files of the encapsulation class A and the management class B of the public library, and in the operator initialization function, accesses the object b of the management class B of the singleton, and obtains the dataset by querying the corresponding dataset name of the operator itself A's object a, and save its pointer address.
- the execution function of the custom operator by calling the address of object a, access its data query method, and return the output data structure after simple calculation. Compile the custom operator to obtain a dynamic link library, so that the custom operator can be registered in frameworks such as Tensorflow and PyTorch in the C++/Python code, and the custom operator can be imported into the framework.
- the original graph structure specifically refers to the neural network graph structure before the custom operator is imported. In order to distinguish it from the neural network graph structure after the custom operator is imported, it is named the original graph structure here.
- the original graph structure is pre-trained based on the specific content of the target data service. Since the target data service may include multiple implementation methods, the training method and training data of the original graph structure are not limited here.
- the deep learning graph computing architecture in the embodiment of the present application is divided into an offline architecture and an online architecture.
- the offline architecture is prepared before online computing
- the online architecture is the architecture used for online computing according to the requirements of the target data service. In this step, it mainly involves the formation of the offline computing architecture, that is, obtaining the network graph structure after importing the custom operator.
- the realization of online computing architecture includes: neural network graph structure and data loading process, real-time data update process and data batch replacement process.
- the data set that is, the candidate data set
- the data set can be obtained through the encapsulation class A and management class B of the data set through the user-defined operator.
- step 5 is also involved:
- the queue name can be updated according to the data written in the matching information, and the data update stream can be subscribed to.
- the real-time update data can be written into the encapsulation class A of the dataset, thereby realizing real-time data update.
- steps 1-5 under this step S304 are repeated to implement batch replacement of candidate data, for example, replacing the data set as a whole.
- S305 Execute the target data service by using the neural network graph structure and the candidate data set.
- the candidate data outside the graph structure can be called inside the graph structure, and the candidate data can be updated and replaced in real time and in batches, including incremental replacement or full replacement.
- the results of auxiliary target data services are more accurate, stable and match the needs.
- an embodiment of the present application further provides a data service device.
- the device will be described in detail below in conjunction with the embodiments.
- FIG. 4 is a schematic structural diagram of a data service device provided by an embodiment of the present application.
- the data service device 40 shown in Figure 4 includes:
- the candidate data set acquisition module 41 is used to obtain the candidate data set corresponding to the external target data service of the neural network graph structure through the self-defined operator in the neural network graph structure after the process of the target data service is started;
- the data service module 42 is configured to use the neural network graph structure and the candidate data set to execute the target data service.
- a hybrid graph computing framework with in-graph and out-of-graph is implemented with the help of custom operators.
- the user-defined operator is located in the graph (that is, inside the graph structure), and the candidate data is located outside the graph (that is, outside the graph structure).
- the user-defined operator in the graph can access and obtain the candidate data outside the graph, so that the candidate data can participate in the target data service.
- the candidate data is not solidified in the graph structure, so the decoupling of the candidate data and the graph structure is realized.
- candidate data is accessed and read through a custom operator, and is not used as an input parameter of the entire graph structure. Therefore, the impact of candidate data on parameters in the graph structure is avoided. In this way, unnecessary computing resource overhead is avoided, and the implementation difficulty of parameter transmission and maintenance in the graph structure is reduced.
- FIG. 5 illustrates the structure of another data service apparatus 500 .
- the data service device 500 includes a candidate data set acquisition module 41 and a data service module 42, and also includes:
- the data encapsulation module 43 is used for encapsulating the candidate data into a data structure outside the neural network graph structure to form the candidate data set;
- the curing parameter setting module 44 is used to set the name of the candidate data set as the curing parameter of the user-defined operator
- the candidate data set acquisition module 41 includes:
- a carrier obtaining unit configured to obtain a preset information carrier according to the curing parameters through the user-defined operator
- an address obtaining unit configured to obtain the pointer address of the candidate data set according to the preset information carrier
- the data obtaining unit is used for accessing the candidate data set according to the pointer address.
- the data service device includes a candidate data set acquisition module 41 and a data service module 42, and also includes:
- a data encapsulation module 43 encapsulating candidate data into a data structure outside the neural network graph structure to form the candidate data set;
- a data set encapsulation module configured to encapsulate the candidate data set to obtain the encapsulation class of the candidate data set
- the candidate data set obtaining module 41 is used for the user-defined operator to obtain the candidate data set by calling the interface function of the encapsulation class, or to obtain a calculation result obtained by performing a preset calculation based on the candidate data set.
- the data service device also includes:
- a data identification acquisition module configured to acquire the identification of target candidate data; the candidate data set includes the target candidate data;
- Data service module 42 includes:
- a data extraction unit configured to extract the target candidate data from the candidate data set according to the target candidate data identifier, or extract the target candidate data from the encapsulation class of the candidate data set according to the target candidate data identifier
- the target candidate data executes a preset calculation and obtains a calculation result
- An executing unit configured to use the neural network graph structure and the target candidate data to execute the target data service, or use the neural network graph structure and the calculation result to execute the target data service.
- the neural network graph structure has multiple copies, and the multiple copies are loaded in multiple neural network computing devices one-to-one; the candidate data is stored outside the multiple neural network computing devices.
- Multiple neural network computing devices are multiple graphics cards.
- the data service module 42 is specifically configured to execute the target data service based on the copy loaded by itself and the same set of candidate data through multiple neural network computing devices.
- the above-mentioned data service device also includes:
- the first updating module is configured to independently update the candidate data set, and/or independently update the neural network graph structure.
- FIG. 6 is a schematic structural diagram of another data service device provided by an embodiment of the present application.
- the data service device 600 as shown in Figure 6 includes: the data service device 600 includes a candidate data set acquisition module 41, a data service module 42, and also includes:
- Graph structure acquisition module 602 used to obtain the original graph structure
- the operator import module 603 is used to import a custom operator into the original graph structure to obtain the neural network graph structure.
- the candidate data set outside the graph structure can be called inside the graph structure, and the candidate data can be updated and replaced in real time and in batches.
- the results of auxiliary target data services are more accurate, stable and match the needs.
- the data service device provided in the embodiment of the present application can execute the data service method provided in any embodiment of the present application, and has corresponding functional units and beneficial effects for executing the data service method.
- FIG. 7 it shows a schematic structural diagram of an electronic device (such as a terminal device running a software program) 400 suitable for implementing the embodiment of the present application.
- the terminal equipment in the embodiment of the present application may include but not limited to such as mobile phone, notebook computer, digital broadcast receiver, PDA (personal digital assistant), PAD (tablet computer), PMP (portable multimedia player), vehicle terminal (such as mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers and the like.
- the electronic device shown in FIG. 7 is only an example, and should not limit the functions and scope of use of this embodiment of the present application.
- an electronic device 400 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 401, which may be stored in a read-only memory (ROM) 402 or loaded from a storage device 408 to Various appropriate actions and processes are executed by accessing programs in the random memory (RAM) 403 . In the RAM 403, various programs and data necessary for the operation of the electronic device 400 are also stored.
- the processing device 401 , ROM 402 and RAM 403 are connected to each other through a bus 404 .
- An input/output (I/O) interface 405 is also connected to bus 404 .
- the following devices can be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 407 such as a computer; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409.
- the communication means 409 may allow the electronic device 400 to perform wireless or wired communication with other devices to exchange data. While FIG. 7 shows electronic device 400 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
- embodiments of the present application include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in FIG. 1 .
- the computer program may be downloaded and installed from a network via communication means 409 , or from storage means 408 , or from ROM 402 .
- the processing device 401 executes the above-mentioned functions defined in the method of the embodiment of the present application.
- the electronic device provided by the embodiment of the present application and the data service method provided by the above-mentioned embodiment belong to the same inventive concept.
- the embodiment of the present application has the same characteristics as the above-mentioned embodiment. Same beneficial effect.
- An embodiment of the present application provides a computer storage medium, on which a computer program is stored, and when the program is executed by a processor, the data service method provided in the foregoing embodiments is implemented.
- the above-mentioned computer-readable medium in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
- a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
- a computer-readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, device or device.
- the computer-readable signal medium may include a data signal propagated in the baseband or as a part of the carrier wave, and the computer-readable program code is carried therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
- the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable signal medium may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
- Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
- the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communications (eg, communication networks) are interconnected.
- Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
- the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
- the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device:
- the candidate data set corresponding to the external target data service of the neural network graph structure is obtained through the custom operator in the neural network graph structure; the target data service is executed using the neural network graph structure and the candidate data set.
- the computer-readable storage medium can write computer program codes for performing the operations of the embodiments of the present application in one or more programming languages or a combination thereof.
- the above-mentioned programming languages include but are not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional procedural programming languages—such as "C" or similar programming languages.
- the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
- the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
- LAN local area network
- WAN wide area network
- Internet connection any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
- each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
- FPGAs Field Programmable Gate Arrays
- ASICs Application Specific Integrated Circuits
- ASSPs Application Specific Standard Products
- SOCs System on Chips
- CPLD Complex Programmable Logical device
- a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
- a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
- a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
- machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, Random Access Memory (RAM), Read Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
- RAM Random Access Memory
- ROM Read Only Memory
- EPROM Erasable Programmable Read Only Memory
- CD-ROM compact disk read only memory
- magnetic storage or any suitable combination of the foregoing.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Finance (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Accounting & Taxation (AREA)
- General Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Marketing (AREA)
- Economics (AREA)
- Development Economics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开一种数据服务方法、装置及相关产品。目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部所述目标数据服务对应的候选数据集合,再利用神经网络图结构和前一步通过自定义算子获取到的候选数据集合执行目标数据服务。借助自定义算子实现了一种图内、图外的混合式图计算框架。自定义算子位于图内,候选数据位于图外,自定义算子可访问获取图外的候选数据,使候选数据参与到目标数据服务。候选数据与图结构的解耦。候选数据的更新和存储自由度提升。候选数据通过自定义算子访问读取,避免候选数据对图结构参数的影响。避免不必要计算资源开销,降低图结构中参数传递和维护的实现难度。
Description
本申请要求于2021年10月08日提交中国国家知识产权局、申请号为202111173249.9、发明名称为“一种数据服务方法、装置及相关产品”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及机器学习技术领域,特别是涉及一种数据服务方法、装置及相关产品。
机器学习是一门多领域交叉学科,研究计算机如何模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。以深度学习为代表的机器学习技术广泛应用于推荐、广告、搜索等大数据场景。此类大数据场景下,在线***需要对规模庞大的数据(如大规模互联网服务的内容、广告、用户数量等)进行在线计算,并得到推荐排序结果。深度神经网络具有典型的结构复杂、层次深的特点,其计算框架以图计算为主,从而适应复杂的神经网络结构。典型的深度神经网络计算框架包括TensorFlow、PyTorch等,其特点是支持完整的深度神经网络训练和线推理计算。TensorFlow是谷歌的开发者创造的一款开源的深度学习框架。PyTorch是最新的深度学习框架之一,由Facebook的团队开发。
在大数据的在线计算场景,一般需要将大规模的候选数据作为参与计算的数据集用于在线计算。例如在推荐场景中,进行粗排计算时需要从上亿条候选数据中取出数千条数据参与到神经网络的预估推理计算。候选数据的数据集形式通常是一个超大规模N×M矩阵,其中N表示数据条数,M表示数据的维度。
目前依据候选数据与深度学习图计算框架的神经网络图结构的结合方式,将候选数据的使用方式分为两种,分别是图内使用方式和图外使用方式。其中,图内使用方式是指:将大规模的候选数据以张量矩阵输入的形式提前固化到TensorFlow、Pytorch等图计算框架的神经网络图结构内,利用图计算框架的序列化方法,将神经网络图结构和候选数据矩阵进行同一序列化,然后分发给 在线服务用于推理计算等。图外使用方式则是指:将候选数据矩阵作为神经网络图结构的外部输入参数,在推理计算时输入给神经网络图结构。
对于上述的图内使用方式,受到深度学习图计算框架对数据规模、数据内存分配方式、数据序列化方式、数据内存复制数量的约束,使得候选数据与深度学习框架处于“绑定”关系,候选数据和神经网络图结构无法独立地更新调整,存储候选数据的自由度也受到限制,十分不便。
对于上述的图外使用方式,需要在深度学习图计算框架外部准备好候选数据并处理为图结构的输入参数。在此实现方案中,图结构中参数的传递和维护非常困难,并使得参数的传递需要额外计算开销。
为了在推荐、广告、搜索等场景中提供数据服务(例如推理计算等)通常需要在设备本地缓存候选数据以及定期更新候选数据。提升候选数据存储和更新的自由度,并避免不必要计算资源开销,降低图结构中参数传递和维护的实现难度,已经成为推荐、广告、搜索等大数据场景下提供数据服务所亟待解决的问题。
发明内容
基于上述问题,本申请实施例提供了一种数据服务方法、装置及相关产品,以提升候选数据存储和更新的自由度,避免不必要计算资源开销,降低图结构中参数传递和维护的实现难度。
本申请实施例公开了如下技术方案:
本申请实施例第一方面提供了一种数据服务方法,包括:
目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取所述神经网络图结构外部所述目标数据服务对应的候选数据集合;
利用所述神经网络图结构和所述候选数据集合执行所述目标数据服务。
本申请实施例第二方面提供了一种数据服务装置,包括:
候选数据集合获取模块,用于在目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取所述神经网络图结构外部所述目标数据服务对应的候选数据集合;
数据服务模块,用于利用所述神经网络图结构和所述候选数据集合执行所 述目标数据服务。
本申请实施例第三方面提供了一种处理器,用于在程序运行时执行第一方面提供的数据服务方法。
本申请实施例第四方面提供了一种用于数据服务的电子设备,所述电子设备包括:
一个或多个处理器;存储器,用于存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如第一方面提供的数据服务方法。
本申请实施例第五方面提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如第一方面提供的数据服务方法。
相较于现有技术,本申请实施例具有以下有益效果:
本申请实施例中数据服务方法包括:目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部所述目标数据服务对应的候选数据集合,再利用神经网络图结构和前一步通过自定义算子获取到的候选数据集合执行目标数据服务。在本申请实施例中,借助于自定义算子实现了一种图内、图外的混合式图计算框架。其中,自定义算子位于图内(即图结构内),候选数据位于图外(即图结构外),图内的自定义算子可以访问获取图外的候选数据,使候选数据得以参与到目标数据服务中。在该方案中,候选数据并非固化于图结构中,因此实现候选数据与图结构的解耦。从而,候选数据的更新和存储自由度提升。此外,候选数据是通过自定义算子访问读取,不作为整个图结构的输入参数,因此,避免了候选数据对图结构中参数的影响。从而避免了不必要计算资源开销,降低了图结构中参数传递和维护的实现难度。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种通过图结构内的自定义算子获取图外候 选数据的示意图;
图2为本申请实施例提供的一种数据服务方法的流程图;
图3为本申请实施例提供的另一种数据服务方法的流程图;
图4为本申请实施例提供的一种数据服务装置的结构示意图;
图5为本申请实施例提供的另一种数据服务装置的结构示意图;
图6为本申请实施例提供的又一种数据服务装置的结构示意图;
图7为本申请实施例提供的电子设备的一种结构示意图。
正如前文描述,目前在许多大数据场景中需要应用到候选数据。这些候选数据的使用方式包括图内使用方式和图外使用方式。这两种方式各有缺陷。对于图内使用方式,候选数据需要固化到神经网络图结构中,与图结构紧紧耦合,使数据更新和存储均受限于图结构所属的深度学习图计算框架内,自由度极低。对于图外使用方式,候选数据需要预处理为适合输入至图结构中的参数,在该方式中,候选数据作为输入参数的引入提升了图结构中参数传递和维护的难度,同时也会带来额外的计算开销。可见,无论是数据更新或是图结构中参数的传递,会由于当前候选数据的使用方式而存在不便。候选数据是提供数据服务的数据基础,在候选数据使用方式带来的不便,也会拉低数据服务的能力上限。例如,在推荐和搜索等大数据场景下,导致推荐结果和搜索结果的不准确、准确性不稳定、匹配度较低等问题。
基于以上问题,本申请实施例中提供了一种通过图内、图外混合式的图计算架构实现数据服务的方法和装置。以下结合实施例和附图进行详细说明。
在本申请实施例中,采用图结构内部的自定义算子来获取图结构外部的候选数据。在一些应用场景中(例如召回计算中)仅需要获取到候选数据集合便可以进行后续计算,不需要特定获取到某一条候选数据。而在一切其他应用场景中,可能需要具体到某一条候选数据。在下面的实施例中首先介绍获取候选数据集合以进行数据服务的实现方式。
参见图1,该图为本申请实施例提供的一种通过图结构内的自定义算子获取图外候选数据集合的示意图。在图1所示的神经网络图结构可以是 TensorFlow或者Pytorch等开源的深度学习图计算框架中的神经网络图结构基础上实现。图1所示的神经网络图结构区别于当前常用的神经网络图结构,在图结构内部包括一自定义算子(Custom Op),该自定义算子在作为该图结构的一部分。该自定义算子可以用于获取图结构外部的数据,例如大数据场景中面对数据服务的需求常需要使用的大规模的候选数据。自定义算子可以注入于神经网络图结构内的任一节点上,如图1中所示,通过某节点的自定义算子进行对图外候选数据集合的访问。
参见图2,该图为本申请实施例提供的一种数据服务方法的流程图。如图2所示的数据服务方法包括:
S201:目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部目标数据服务对应的候选数据集合。
本申请实施例所提及的数据服务是指:需要将大量候选数据作为数据基础在线进行的运算过程。本申请实施例中,为了便于说明,定义了目标数据服务。目标数据服务具体是指具有某一特定目的且亟待执行的数据服务。作为示例,目标数据服务可以是:基于搜索词提供搜索结果,或者,基于用户的历史购物信息推荐商品。
基于目标数据服务的不同,运算所需要的数据基础也存在差别。例如,当目标数据服务是基于搜索词提供搜索结果,则目标数据服务对应的候选数据可以是新闻报道;当目标数据服务是基于用户的历史购物信息推荐商品,则目标数据服务对应的候选数据可以是商品信息。
在进行目标数据服务之前,首先需要启动目标数据服务的进程。目标数据服务的进程的启动可以收到特定的操作触发。例如,响应于用户输入搜索词后的确认操作,触发目标数据服务的进程启动。再例如,响应于用户在商品页面的滑动操作,触发目标数据服务的进程启动。在实际应用中,不限于以上启动进程的触发机制,此处对于启动数据服务进程的触发机制不进行限制。
目标数据服务的进程启动后,结合图1示意,神经网络图结构中的自定义算子可以获取神经网络图结构外部目标数据服务对应的候选数据集合。在一种可选的实现方式中,候选数据预先封装在神经网络图结构外部的数据结构中。作为示例,该数据结构可以是矩阵,例如,矩阵中的一行或者一列可以代表一 条候选数据,矩阵中另一个维度则代表一条候选数据的组成维度。矩阵中的一条候选数据可以用向量形式表示。该数据结构因包含了大量的候选数据而可以作为候选数据集合。
在实际应用中,每一个候选数据集合具有名称,一个候选数据集合中每一条候选数据具有唯一的标识。例如可以将候选数据在候选数据集合中的行数或者列数作为候选数据的标识,当然也可以根据候选数据的内容或用途为候选数据分配标识。此处对于标识的表现形式不做限定。候选数据集合的名称可以是通过随机分配或者其他方式分配的唯一编码,也可以是基于候选数据集合的内容或作用形成的描述。不同候选数据集合的名称互不相同,因此,候选数据集合的名称可以用于唯一地确定候选数据集合。此外,一条候选数据集合在其所封装于的数据结构中具有唯一对应的指针地址,该指针地址可以用于后期获取候选数据集合。为了保证自定义算子对图结构外部的候选数据集合进行获取的可实现性,具体实现时,可以设定预设信息载体,将候选数据集合的名称作为该载体的名称,并将候选数据集合的指针地址加入到载体的内容中。另外,再将候选数据集合的名称设为自定义算子的固化参数。
如此,在执行本步骤S201时,具体地,可以由自定义算子根据固化参数和此前介绍的预设信息载体来获得目标数据服务对应的候选数据集合的指针地址。通过所述自定义算子根据所述固化参数获得预设信息载体(此时以固化参数中候选数据集合的名称作为索引)。接着根据所述预设信息载体查询其内容,获得所述候选数据集合的指针地址。最后,自定义算子根据指针地址访问获取图外的候选数据集合。
本申请实施例描述的预设信息载体,即是指,通过自身的名称和内容使对图外候选数据集合的获取成为可能的信息载体。在实际应用中,预设信息载体包括多种实现方式。例如,预设信息载体可以静态变量(static variable),共享内存(shared memory)中的共享变量(shared variable),或者文件(files)。以预设信息载体为共享变量为例,将候选数据集合名称作为共享变量名,将候选数据集合的指针地址作为共享变量的值。本申请实施例对于预设信息载体的实现形式不进行限定。
上述方案的实施实现基于候选数据集合的指针地址对候选数据集合的直 接获取。作为另一种实现方式,还可以预先对所述候选数据集合进行封装,得到所述候选数据集合的封装类。再由所述自定义算子通过调用封装类的接口函数,获取候选数据集合。需要说明的是,在实际应用中,也可以在提供目标数据服务之前,基于候选数据集合进行一些预设计算,获得相应的计算结果。预设计算的计算方式可以是预设设定好的,例如预设计算可以是求取平均数、最小值或者排序结果等。预设计算可以是与目标数据服务相关的计算方式,本申请实施例中对于预设计算不做限定。预设计算的计算结果也可以通过调用封装类的接口函数获得。具体实现时,可以根据目标数据服务的使用需求,选择获取候选数据集合,或是获取基于候选数据集合执行预设计算所得到的计算结果。
以上实现方式通过调用封装类的接口函数,实现了对候选数据集合或者其相关计算结果的间接获取。由于候选数据集合位于神经网络图结构的外部,因此,候选数据集合和神经网络图结构是相对脱离的。而图结构内的自定义算子作为图结构与图外候选数据集合之间的“桥梁”,使候选数据集合能够参与到图结构所执行的目标数据服务中。
S202:利用神经网络图结构和候选数据集合执行目标数据服务。
在执行过S201后,神经网络图结构已借助自定义算子获得图外的候选数据集合。接着,神经网络图结构便可以根据这些获取到的候选数据集合执行目标数据服务。需要说明的是,本申请实施例提及的神经网络图结构中图参数已经预先训练完毕。因此,本步骤S202描述的就是该神经网络图结构基于候选数据集合进行图计算,获得目标数据服务的执行结果(例如搜索结果、推荐结果)的过程。
在不同的应用场景中,涉及到的目标数据服务可能不同,另外,神经网络图结构基于实际需求也可能存在结构上和参数上的差异。此处对于神经网络图结构的结构及参数以及执行目标数据服务的实现过程不做限定。
以上即为本申请实施例提供的一种数据服务方法。在该方法中,借助于自定义算子实现了一种图内、图外的混合式图计算框架。其中,自定义算子位于图内(即图结构内),候选数据集合位于图外(即图结构外),图内的自定义算子可以访问获取图外的候选数据集合,使候选数据集合中的数据得以参与到目标数据服务中。在该方案中,候选数据集合并非固化于图结构中,因此实现候 选数据集合与图结构的解耦。从而,候选数据集合的更新和存储自由度提升。此外,候选数据集合是通过自定义算子访问读取,不作为整个图结构的输入参数,因此,避免了候选数据对图结构中参数的影响。从而避免了不必要计算资源开销,降低了图结构中参数传递和维护的实现难度。
在一些场景中,可能需要用到候选数据集合中的某一条或几条的候选数据来进行数据服务。为便于说明,此处将此类候选数据称为目标候选数据。
为了获取目标候选数据,可以首先获取目标候选数据的标识。在S202的实现时,具体可以根据所述目标候选数据的标识,从所述候选数据集合中提取出所述目标候选数据。再利用所述神经网络图结构和所述目标候选数据执行所述目标数据服务。在将候选数据集合封装为类的场景中,也可以根据目标候选数据的标识从所述封装类中对所述目标候选数据执行预设计算并得到计算结果,最后利用所述神经网络图结构和所述计算结果执行所述目标数据服务。
由于本申请实施例提供的技术方案中,相比于候选数据集合的图内使用方式和图外使用方式,候选数据集合从图结构中解耦合,因此当需要更新候选数据集合(更新整个集合或者部分候选数据)时,可以独立更新候选数据,不会影响到图结构,同时图结构所属的深度学习图计算框架也不会对候选数据集合的更新造成约束和限制。本申请实施例是实现了更加灵活、快速的数据更新机制。此外,图结构也可以独立于候选数据集合而单独更新。同样的,图结构的更新不影响已有的候选数据集合。实现更快速的图结构参数更新,不受限于大规模数据的更新的速度。
在一些可能的实现场景中,目标数据服务由多个神经网络计算设备实现的。此处所说的神经网络计算设备可以是显卡,也可以是或其他专用芯片。以显卡作为示例进行描述。具体地,神经网络图结构具有多个副本,目标数据服务启动后,多个副本一对一的加载在多张显卡中。由于候选数据通常是大规模的(以候选数据集合形式存在),而显卡的显存较小,分别存储候选数据集合将影响显卡的性能。由于本申请实施例中,神经网络图结构是与候选数据集合解耦合的,因此,可以将候选数据集合存储在多张显卡之外,例如保存一份候选数据至内存。图结构的复制不会造成候选数据的复制。对于多张显卡,图外的候选数据集合是共用的,不需要存储到各张显卡的显存中。如此,节省了显存资源, 提升了显卡的性能。
在这一场景中,利用神经网络图结构和候选数据集合执行目标数据服务,具体包括:多个神经网络计算设备分别基于自身加载的图结构副本和同一份候选数据集合执行目标数据服务。
以上实施例中,介绍了对候选数据集合和神经网络结构图分别更新的实现方式。在目标数据服务的进程启动后,可以将候选数据集合和神经网络图结构加载到该进程中,在执行S201-S202描述的操作。候选数据集合(中的部分或者全部候选数据)独立更新后,独立分发到目标数据服务的进程中。图结构更新后,单独分发到目标数据服务的进程中。
此外,在其他可能的实现方式中,还可能存在整体分发数据和图结构的需求。因此,不排除尽管实现了图结构与候选数据集合的解耦合,但是存在一些场景需要将二者整体分发和使用。因此,在本申请实施例提供的数据服务方法,还可以包括:
将候选数据集合和神经网络图结构打包为一个数据包;
当候选数据集合和/或神经网络图结构需要更新时,更新整个数据包。
在需要进行目标数据服务时,将新的数据包整体分发(加载)到目标数据服务的进程中。
前面实施例着重介绍了对自定义算子的使用方式。为了便于理解,下面结合实施例和附图介绍自定义算子的创建过程和图计算过程。图3为本申请实施例提供的另一种数据服务方法的流程图。如图3所示的数据服务方法包括:
S301:创建自定义算子。
在本申请实施例中所使用的自定义算子是神经网络图结构区别于其他已有的神经网络图结构的最显著的区别。为了创建自定义算子,首先需要进行对自定义算子访问候选数据的实现方式的封装。通过定义封装类A和管理类B实现。下面详细介绍:
具体地,在TensorFlow、PyTorch等框架下的公共库定义一个数据集(即是指大规模的候选数据所在的数据结构,例如矩阵,也可以理解为前述的候选数据集合)的封装类A,该类用于描述一个具有特定访问接口的数据集。在封装类A定义的接口包括:
1)将全量数据以矩阵参数或字节流的形式传入数据集对象的接口。该接口用于更新整个候选数据集合。
2)将增量数据以矩阵参数或字节流的形式传入数据集对象的接口,通过内部加锁或无锁队列的方式,保证增量写入的线程安全。该接口用于更新候选数据集合中的部分候选数据。
3)提供以数据标识查询单条或多条数据内容的接口,用于图内自定义算子访问数据。
4)定义数据集内部数据的序列化和反序列化的接口,用于数据集整体分发和加载。
此外,封装类A还需要支持的特性包括:可以通过参数控制内存的分配方式,比如是否分配透明大页内存、显存等。
在公共库定义一个单例的数据集的管理类B,对数据集的操作进行包装,定义的接口包括:
1)数据集管理。
2)将数据集对象通过数据集主键注册到管理类的接口。
3)根据数据集主键查询并得到数据集智能指针地址的接口。
4)以数据集主键替换数据集对象的接口。
5)将数据集主键删除数据集的接口。
下面介绍进程内单例的具体实现:
创建单例时,自动生成一个根据进程pid编号拼接得到的名字,并以此名字注册***共享内存块,并在单例对象初始化时,将单例的内存地址写入到共享内存块中。与一般的单例实现不同,该实现保证了在.so动态链接库内的代码也可以访问到相同的单例。从而使一个进程内,C++语言实现的C++代码与python虚拟机内的python代码,都可以访问到同一个单例。
通过封装类A和管理类B的定义,实现了自定义算子进行数据访问的统一封装,接下来介绍自定义算子的实现:
在Tensorflow、PyTorch等框架下定义本申请实施例技术方案中所需功能的自定义算子,具体地,需要定义这个算子在图内的输入参数和输出数据结构。作为示例,自定义算子在图内的输入参数可以是参与数据服务图计算的数据名 称列表;输出数据结构可以是向量查询结果张量,或向量点积结果张量等。此外,给自定义算子增加一个属性:自定义算子对应的数据集名字。
自定义算子引用公共库的封装类A和管理类B的头文件,在算子初始化函数内,访问单例的管理类B的对象b,通过算子自身对应的数据集名字查询获得数据集A的对象a,并保存其指针地址。自定义算子的执行函数内,通过调用对象a的地址,访问其数据查询方法,并通过简单计算后返回输出数据结构。将自定义算子编译得到一个动态链接库,从而可以在C++/Python代码里面将自定义算子注册到Tensorflow、PyTorch等框架,并在框架内导入自定义算子。
S302:获取原始图结构。
原始图结构具体是指导入自定义算子之前的神经网络图结构,为与导入自定义算子后的神经网络图结构进行区分,此处将其命名为原始图结构。原始图结构是基于目标数据服务的具体内容进行预先训练得到的。由于目标数据服务可能包括多种实现方式,故此处对于原始图结构的训练方式和训练数据不做限定。
S303:在原始图结构中导入自定义算子,获得神经网络图结构。
以Tensorflow框架为例,在线推理计算前,将自定义算子通过Tensorflow的python API等接口,将自定义算子融合到原始图结构中,使自定义算子能够参与到图结构的计算过程中。下面连同候选数据的收集处理过程,介绍图结构的修改。本申请实施例中深度学习图计算架构分为离线架构和在线架构,其中,离线架构是在线计算之前准备好的,在线架构则是针对目标数据服务的需求进行在线计算时使用的架构。在本步骤中,主要涉及离线计算架构的形成,即获得导入自定义算子后的网络图结构。
首先介绍离线状况下候选数据的批量处理:
1.初始化数据集的管理类B。
2.从候选数据中心扫描获得所有候选数据,并打包放入数据集的封装类A,分配全局唯一的数据集名字。
3.调用数据集的封装类A的数据序列化接口,将数据写入到文件。
4.在进程内启动python虚拟机,并初始化深度图运行环境相关依赖。
5.从训练中心拉取原始图结构,并加载到运行环境。
6.通过动态链接库的方式加载自定义算子到运行环境,并初始化数据集名字等属性。
7.通过深度学习框架的API对图结构进行修改,加入自定义算子到图结构。
8.重新序列化修改后的图结构(即神经网络图结构)到文件。
9.将以上步骤3和步骤8的文件打包,附加额外的匹配信息。
下面介绍离线状况下数据的实时处理和传输(涉及离线状况下候选数据的更新):
1.在批量处理的基础上,创建一个与数据集对应的分布式数据更新队列。
2.在批量处理的基础上,在第9步的额外的匹配信息里写入数据更新队列名。
3.监听候选数据中心的变更,得到更新的候选数据。
4.将更新的候选数据写入分布式数据更新队列。
S304:目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部目标数据服务对应的候选数据集合。
在线计算架构的实现包括:神经网络图结构和数据的加载过程、实时数据更新过程和数据批量替换过程。
1.初始化运行环境,初始化数据集管理类B。
2.通过动态链接库的方式加载自定义算子到运行环境。
3.下载并读取批量数据文件包,其中的候选数据通过数据集的封装类A加载,包含自定义算子的神经网络图结构通过深度学习运行时的接口加载。
4.数据和图结构加载完成后即可以图计算接口的形式提供对外服务能力。
具体地,图结构加载完毕后,当目标数据服务的进程启动,通过自定义算子即可通过所在数据集的封装类A和管理类B,获取数据集,即候选数据集合。
对于候选数据发生实时更新的场景,还涉及到以下步骤5:
5.可以根据匹配信息里面写入的数据更新队列名,订阅数据更新流,当候选数据需要实时更新时,将实时更新数据写入到数据集的封装类A,从而实 现数据实时更新。
在需要批量替换数据的场景下,当下一批批量数据到达后,重复执行本步骤S304下的步骤1-5,可以实现批量的候选数据替换,例如整体替换数据集。
S305:利用神经网络图结构和候选数据集合执行目标数据服务。
以上实施例中,通过构建自定义算子,使图结构内部可以调取图结构外的候选数据,并可以对候选数据进行实时、批量的更新替换,包括增量替换或者全量替换。满足实际使用需求,辅助目标数据服务的结果更加准确、稳定和匹配需求。
基于前述实施例提供的数据服务方法,相应地,本申请实施例还提供了一种数据服务装置。以下结合实施例对该装置进行详细说明。
图4为本申请实施例提供的一种数据服务装置的结构示意图。如图4所示的数据服务装置40包括:
候选数据集合获取模块41,用于在目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部目标数据服务对应的候选数据集合;
数据服务模块42,用于利用神经网络图结构和候选数据集合执行目标数据服务。
在本申请实施例中,借助于自定义算子实现了一种图内、图外的混合式图计算框架。其中,自定义算子位于图内(即图结构内),候选数据位于图外(即图结构外),图内的自定义算子可以访问获取图外的候选数据,使候选数据得以参与到目标数据服务中。在该方案中,候选数据并非固化于图结构中,因此实现候选数据与图结构的解耦。从而,候选数据的更新和存储自由度提升。此外,候选数据是通过自定义算子访问读取,不作为整个图结构的输入参数,因此,避免了候选数据对图结构中参数的影响。从而避免了不必要计算资源开销,降低了图结构中参数传递和维护的实现难度。
可选地,图5示意了另一种数据服务装置500的结构。如图5所示,数据服务装置500包含候选数据集合获取模块41和数据服务模块42,还包括:
数据封装模块43,用于将候选数据封装到神经网络图结构外部的数据结构中,形成所述候选数据集合;
固化参数设置模块44,用于将候选数据集合的名称设为自定义算子的固化参数;
候选数据集合获取模块41,包括:
载体获取单元,用于通过所述自定义算子根据所述固化参数获得预设信息载体;
地址获取单元,用于根据所述预设信息载体获得所述候选数据集合的指针地址;
数据获取单元,用于根据指针地址访问候选数据集合。
可选地,数据服务装置包含候选数据集合获取模块41和数据服务模块42,还包括:
数据封装模块43,将候选数据封装到所述神经网络图结构外部的数据结构中,形成所述候选数据集合;
数据集封装模块,用于对所述候选数据集合进行封装,得到所述候选数据集合的封装类;
候选数据集合获取模块41,用于所述自定义算子通过调用所述封装类的接口函数,获取所述候选数据集合,或获取基于所述候选数据集合执行预设计算得到的计算结果。
可选地,数据服务装置还包括:
数据标识获取模块,用于获取目标候选数据的标识;所述候选数据集合包含所述目标候选数据;
数据服务模块42包括:
数据提取单元,用于根据所述目标候选数据的标识,从所述候选数据集合中提取出所述目标候选数据,或者根据所述目标候选数据的标识从所述候选数据集合的封装类中对所述目标候选数据执行预设计算并得到计算结果;
执行单元,用于利用所述神经网络图结构和所述目标候选数据执行所述目标数据服务,或者利用所述神经网络图结构和所述计算结果执行所述目标数据服务。
可选地,神经网络图结构具有多个副本,多个副本一对一的加载在多个神经网络计算设备中;候选数据存储在多个神经网络计算设备之外。多个神经网 络计算设备为多个显卡。
数据服务模块42,具体用于通过多个神经网络计算设备分别基于自身加载的副本和同一份候选数据集合执行目标数据服务。
可选地,以上提及的数据服务装置还包括:
第一更新模块,用于独立更新候选数据集合,和/或,独立更新神经网络图结构。
图6为本申请实施例提供的又一种数据服务装置的结构示意图。如图6所示的数据服务装置600包括:数据服务装置600包含候选数据集合获取模块41,数据服务模块42,还包括:
算子创建模块601,用于创建自定义算子;
图结构获取模块602,用于获取原始图结构;
算子导入模块603,用于在原始图结构中导入自定义算子,获得神经网络图结构。
通过构建自定义算子,使图结构内部可以调取图结构外的候选数据集合,并可以对候选数据进行实时、批量的更新替换。满足实际使用需求,辅助目标数据服务的结果更加准确、稳定和匹配需求。
本申请实施例所提供数据服务装置可执行本申请任意实施例所提供的数据服务方法,具备执行数据服务方法相应的功能单元和有益效果。
值得注意的是,上述数据服务装置的实施例中,所包括的各个单元和单元只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本申请实施例的保护范围。
下面参考图7,其示出了适于用来实现本申请实施例的电子设备(例如运行有软件程序的终端设备)400的结构示意图。本申请实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图7示出的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图7所示,电子设备400可以包括处理装置(例如中央处理器、图形处理器等处理器)401,其可以根据存储在只读存储器(ROM)402中的程序或者从存储装置408加载到随机访问存储器(RAM)403中的程序而执行各种适当的动作和处理。在RAM403中,还存储有电子设备400操作所需的各种程序和数据。处理装置401、ROM402以及RAM403通过总线404彼此相连。输入/输出(I/O)接口405也连接至总线404。
通常,以下装置可以连接至I/O接口405:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置406;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置407;包括例如磁带、硬盘等的存储装置408;以及通信装置409。通信装置409可以允许电子设备400与其他设备进行无线或有线通信以交换数据。虽然图7示出了具有各种装置的电子设备400,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本申请的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本申请的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行图1所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置409从网络上被下载和安装,或者从存储装置408被安装,或者从ROM402被安装。在该计算机程序被处理装置401执行时,执行本申请实施例的方法中限定的上述功能。
本申请实施例提供的电子设备与上述实施例提供的数据服务方法属于同一发明构思,未在本申请实施例中详尽描述的技术细节可参见上述实施例,并且本申请实施例与上述实施例具有相同的有益效果。
本申请实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的数据服务方法。
需要说明的是,本申请实施例上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的***、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子 可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行***、装置或者器件使用或者与其结合使用。而在本申请实施例中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行***、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:
目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取神经网络图结构外部目标数据服务对应的候选数据集合;利用神经网络图结构和候选数据集合执行目标数据服务。
计算机可读存储介质可以以一种或多种程序设计语言或其组合来编写用于执行本申请实施例的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程 式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本申请各种实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上***(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本申请实施例的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行***、装置或设备使用或与指令执行***、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体***、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请实施例中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请实施例中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本申请实施例的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。
Claims (14)
- 一种数据服务方法,包括:目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取所述神经网络图结构外部所述目标数据服务对应的候选数据集合;利用所述神经网络图结构和所述候选数据集合执行所述目标数据服务。
- 根据权利要求1所述的数据服务方法,其中,还包括:将候选数据封装到所述神经网络图结构外部的数据结构中,形成所述候选数据集合;将所述候选数据集合的名称设为所述自定义算子的固化参数;所述通过神经网络图结构中的自定义算子获取所述神经网络图结构外部的候选数据集合,包括:通过所述自定义算子根据所述固化参数获得预设信息载体;根据所述预设信息载体获得所述候选数据集合的指针地址;根据所述指针地址访问所述候选数据集合。
- 根据权利要求1所述的数据服务方法,其中,还包括:将候选数据封装到所述神经网络图结构外部的数据结构中,形成所述候选数据集合;对所述候选数据集合进行封装,得到所述候选数据集合的封装类;所述通过神经网络图结构中的自定义算子获取所述神经网络图结构外部的候选数据集合,包括:所述自定义算子通过调用所述封装类的接口函数,获取所述候选数据集合,或获取基于所述候选数据集合执行预设计算得到的计算结果。
- 根据权利要求1所述的方法,其中,还包括:获取目标候选数据的标识;所述候选数据集合包含所述目标候选数据;所述利用所述神经网络图结构和所述候选数据集合执行所述目标数据服务,包括:根据所述目标候选数据的标识从所述候选数据集合中提取出所述目标候选数据,利用所述神经网络图结构和所述目标候选数据执行所述目标数据服务;或者根据所述目标候选数据的标识从所述候选数据集合的封装类中对所述目 标候选数据执行预设计算并得到计算结果,利用所述神经网络图结构和所述计算结果执行所述目标数据服务。
- 根据权利要求1所述的数据服务方法,其中,所述神经网络图结构具有多个副本,所述多个副本一对一的加载在多个神经网络计算设备中;所述候选数据集合存储在所述多个神经网络计算设备之外;所述利用所述神经网络图结构和所述候选数据集合执行所述目标数据服务,包括:所述多个神经网络计算设备分别基于自身加载的所述副本和同一份所述候选数据集合执行所述目标数据服务。
- 根据权利要求1-5任一项所述的数据服务方法,其中,还包括:独立更新候选数据集合,和/或,独立更新所述神经网络图结构。
- 根据权利要求1-4任一项所述的数据服务方法,其中,还包括:将所述候选数据集合和所述神经网络图结构打包为一个数据包;当所述候选数据集合和/或所述神经网络图结构需要更新时,更新所述数据包。
- 根据权利要求2所述的数据服务方法,其中所述预设信息载体包括:静态变量,共享内存中的共享变量,或者文件。
- 根据权利要求1-5任一项所述的数据服务方法,其中,还包括:创建所述自定义算子;获取原始图结构;在所述原始图结构中导入所述自定义算子,获得所述神经网络图结构。
- 根据权利要求5所述的数据服务方法,其中,所述神经网络计算设备为显卡。
- 一种数据服务装置,包括:候选数据集合获取模块,用于在目标数据服务的进程启动后,通过神经网络图结构中的自定义算子获取所述神经网络图结构外部所述目标数据服务对应的候选数据集合;数据服务模块,用于利用所述神经网络图结构和所述候选数据集合执行所述目标数据服务。
- 一种处理器,用于在程序运行时执行权利要求1-10任一项所述的数据服务方法。
- 一种用于数据服务的电子设备,所述电子设备包括:一个或多个处理器;存储器,用于存储一个或多个程序;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-10中任一所述的数据服务方法。
- 一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如权利要求1-10中任一所述的数据服务方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111173249.9A CN113901315B (zh) | 2021-10-08 | 2021-10-08 | 一种数据服务方法、装置及相关产品 |
CN202111173249.9 | 2021-10-08 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023056841A1 true WO2023056841A1 (zh) | 2023-04-13 |
Family
ID=79190498
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/120165 WO2023056841A1 (zh) | 2021-10-08 | 2022-09-21 | 一种数据服务方法、装置及相关产品 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113901315B (zh) |
WO (1) | WO2023056841A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113901315B (zh) * | 2021-10-08 | 2024-05-21 | 抖音视界有限公司 | 一种数据服务方法、装置及相关产品 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109933413A (zh) * | 2017-12-15 | 2019-06-25 | 北京嘀嘀无限科技发展有限公司 | 业务实现方法及装置、电子设备、存储介质 |
CN111752688A (zh) * | 2020-06-03 | 2020-10-09 | 五八有限公司 | 一种数据获取方法、装置、电子设备及存储介质 |
CN112257841A (zh) * | 2020-09-03 | 2021-01-22 | 北京大学 | 图神经网络中的数据处理方法、装置、设备及存储介质 |
CN112818195A (zh) * | 2019-11-15 | 2021-05-18 | 腾讯科技(深圳)有限公司 | 数据获取方法、装置、***及计算机存储介质 |
CN113065639A (zh) * | 2021-03-08 | 2021-07-02 | 深圳云天励飞技术股份有限公司 | 算子融合方法、***、设备及存储介质 |
CN113901315A (zh) * | 2021-10-08 | 2022-01-07 | 北京字节跳动网络技术有限公司 | 一种数据服务方法、装置及相关产品 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020160252A1 (en) * | 2019-01-30 | 2020-08-06 | Google Llc | Task-aware neural network architecture search |
CN110659728B (zh) * | 2019-09-24 | 2024-03-05 | 安徽寒武纪信息科技有限公司 | 神经网络优化方法、装置、计算机设备及存储介质 |
CN113469353A (zh) * | 2020-03-31 | 2021-10-01 | 上海商汤智能科技有限公司 | 神经网络模型的优化方法、数据处理方法及装置 |
CN112560985B (zh) * | 2020-12-25 | 2024-01-12 | 北京百度网讯科技有限公司 | 神经网络的搜索方法、装置及电子设备 |
-
2021
- 2021-10-08 CN CN202111173249.9A patent/CN113901315B/zh active Active
-
2022
- 2022-09-21 WO PCT/CN2022/120165 patent/WO2023056841A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109933413A (zh) * | 2017-12-15 | 2019-06-25 | 北京嘀嘀无限科技发展有限公司 | 业务实现方法及装置、电子设备、存储介质 |
CN112818195A (zh) * | 2019-11-15 | 2021-05-18 | 腾讯科技(深圳)有限公司 | 数据获取方法、装置、***及计算机存储介质 |
CN111752688A (zh) * | 2020-06-03 | 2020-10-09 | 五八有限公司 | 一种数据获取方法、装置、电子设备及存储介质 |
CN112257841A (zh) * | 2020-09-03 | 2021-01-22 | 北京大学 | 图神经网络中的数据处理方法、装置、设备及存储介质 |
CN113065639A (zh) * | 2021-03-08 | 2021-07-02 | 深圳云天励飞技术股份有限公司 | 算子融合方法、***、设备及存储介质 |
CN113901315A (zh) * | 2021-10-08 | 2022-01-07 | 北京字节跳动网络技术有限公司 | 一种数据服务方法、装置及相关产品 |
Also Published As
Publication number | Publication date |
---|---|
CN113901315B (zh) | 2024-05-21 |
CN113901315A (zh) | 2022-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111857720B (zh) | 用户界面状态信息的生成方法、装置、电子设备及介质 | |
CN110704833A (zh) | 数据权限配置方法、设备、电子设备及存储介质 | |
WO2023174013A1 (zh) | 显存分配方法、装置、介质及电子设备 | |
CN114035879A (zh) | 页面主题色更换方法、装置、电子设备和计算机可读介质 | |
WO2023056841A1 (zh) | 一种数据服务方法、装置及相关产品 | |
CN112416303B (zh) | 软件开发工具包热修复方法、装置及电子设备 | |
WO2021227953A1 (zh) | 图像特效配置方法、图像识别方法、装置及电子设备 | |
CN111752644A (zh) | 接口模拟方法、装置、设备及存储介质 | |
CN109669720B (zh) | 基于Promise的链式异步请求处理方法、装置及电子设备 | |
WO2023273564A1 (zh) | 虚拟机内存管理方法、装置、存储介质及电子设备 | |
WO2022017458A1 (zh) | 同步数据方法、装置、电子设备和介质 | |
CN111143464B (zh) | 数据获取方法、装置和电子设备 | |
CN111787043A (zh) | 数据请求方法和装置 | |
CN111857879B (zh) | 数据处理方法、装置、电子设备和计算机可读介质 | |
WO2023071629A1 (zh) | 网页的渲染方法、装置、设备及存储介质 | |
CN113282853B (zh) | 一种评论预加载方法、装置、存储介质及电子设备 | |
CN114647472B (zh) | 图片处理方法、装置、设备、存储介质和程序产品 | |
US11902340B2 (en) | Data processing method, apparatus, electronic device and storage medium | |
CN112084003B (zh) | 一种隔离数据的方法、装置、介质和电子设备 | |
CN113177174B (zh) | 特征构建方法、内容显示方法及相关装置 | |
CN113448550B (zh) | 实现类的收集管理方法、装置、电子设备及计算机介质 | |
CN111258670B (zh) | 组件数据的管理方法、装置、电子设备和存储介质 | |
CN116755889B (zh) | 应用于服务器集群数据交互的数据加速方法、装置与设备 | |
WO2023125163A1 (zh) | 一种图像特效处理方法、装置、设备及介质 | |
CN116562248A (zh) | 表格处理方法、装置、设备、存储介质和程序产品 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22877861 Country of ref document: EP Kind code of ref document: A1 |
|
WWE | Wipo information: entry into national phase |
Ref document number: 18571131 Country of ref document: US |
|
NENP | Non-entry into the national phase |
Ref country code: DE |