Processing method of long text in deep learning, control device and storage medium

By segmenting long text and using memory memory to fuse feature vectors, the problem of contextual information loss in the Transformer model when processing long text is solved, a comprehensive understanding and processing of long text is achieved, and the coherence and accuracy of the generated results are improved. .

CN118734898APending Publication Date: 2024-10-01GUANGZHOU YUNCONG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410944736.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When the existing Transformer model processes long text, due to the sequence length limit, contextual information is lost, and the long text cannot be fully understood and processed, resulting in unsatisfactory output.

Method used

The input text is divided into segments according to the preset length and input into the deep learning model for processing respectively, and the output results are spliced ​​in sequence. The historical feature vectors in the memory memory are used to fuse the feature vectors to enhance the model's context understanding ability.

Benefits of technology

It achieves comprehensive understanding and processing of long texts, ensures the coherence and accuracy of generated results, and improves the effect and performance of the model when processing long articles or conversations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734898A_ABST
    Figure CN118734898A_ABST
Patent Text Reader

Abstract

The invention relates to a long text processing method in deep learning, a control device and a storage medium, and the method comprises the steps: segmenting an input text according to a preset length, and obtaining a plurality of subsequences; inputting the subsequences into a trained deep learning model to obtain an output result; and splicing the output results according to the sequence to obtain a complete processing result. According to the technical scheme, the input text is segmented according to the preset length to obtain a plurality of subsequences, the subsequences are respectively input into the trained deep learning model to be processed, and then all output results are spliced according to the sequence to obtain a complete processing result. Through the method, the technology realizes comprehensive understanding and processing of the long text, ensures the continuity and accuracy of the generated result, and improves the effect and performance of the model in processing long articles or dialogues, so that the model can be better applied to actual complex text processing tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine learning, and specifically provides a method, a control device and a storage medium for processing long text in deep learning. Background Art

[0002] With the development of neural networks, the demand for text processing is increasing. When processing long articles or conversations, some current models such as Transformer are often affected by their inherent sequence length limitations.

[0003] In the prior art, the original Transformer model usually has a context length limit of 1024 tokens. Therefore, when processing text exceeding this length, the information will be truncated, resulting in the loss of context information, and the inability to fully understand and process long texts, resulting in unsatisfactory final output.

[0004] Accordingly, this field needs a new long text processing solution in deep learning to solve the above problems. Summary of the invention

[0005] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution or at least partially solve the problem that context information is easily lost when the model in the prior art processes long texts.

[0006] In a first aspect, the present invention provides a method for processing long text in deep learning, the method comprising: segmenting the input text according to preset lengths to obtain multiple subsequences; inputting the subsequences into a trained deep learning model to obtain output results; and splicing the output results in sequence to obtain a complete processing result.

[0007] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, wherein the output result includes a first output and a second output, the inputting of the subsequence into a trained deep learning model to obtain the output result includes: inputting the subsequence at the first position into the trained deep learning model to obtain a first output and a first intermediate vector, wherein the deep learning model processes text in units of characters; storing the first intermediate vector into a memory storage device; inputting the subsequence at a non-first position into the trained deep learning model to obtain a second intermediate vector; querying the memory storage device based on the second intermediate vector, and obtaining a fused feature vector in combination with the query result; obtaining a second output based on the fused feature vector and the trained deep learning model; and splicing the output results in sequence to obtain a complete processing result includes: splicing the first output and the second output in sequence to obtain a complete processing result.

[0008] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the deep learning model includes a memory layer, and the inputting of the non-first-place subsequence into the trained deep learning model to obtain a second intermediate vector includes: inputting the non-first-place subsequence into the trained deep learning model, and outputting it from the memory layer to obtain a second intermediate vector, wherein the second intermediate vector includes at least a query vector and a feature vector; querying from a memory storage device based on the second intermediate vector, and obtaining a fused feature vector in combination with the query result, including: obtaining N historical feature vectors with the highest similarity from the memory storage device based on the query vector, wherein N is a preset positive integer; merging the N historical feature vectors and the feature vector in the second intermediate vector to obtain a fused feature vector; the method also includes: storing the feature vector in the second intermediate vector in the memory storage device.

[0009] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the non-first-place subsequence is input into a trained deep learning model and output from a memory layer to obtain a second intermediate vector, including: inputting the non-first-place subsequence into the layer structure of the deep learning model in the form of characters, and outputting from the memory layer to obtain a second intermediate vector, wherein the second intermediate vector is an intermediate vector corresponding to the characters in the non-first-place subsequence; wherein the feature vectors in the memory storage device all correspond to the corresponding characters.

[0010] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, obtaining a second output based on the fused feature vector and the trained deep learning model includes: inputting the fused feature vector and the query vector into the layer structure after the memory layer in the deep learning model to obtain a second output.

[0011] As an alternative or supplement to the above solution, in a method according to an embodiment of the present invention, the deep learning model adopts a Transformer architecture, and the feature vector includes: a label vector and a content vector.

[0012] As an alternative or supplement to the above solution, in a method according to an embodiment of the present invention, the memory layer does not contain position coding, so that the feature vector does not contain position coding information.

[0013] As an alternative or supplement to the above scheme, in a method according to an embodiment of the present invention, the layer structure of the deep learning model includes at least two memory layers, wherein non-memory layers are located between different memory layers.

[0014] In a second aspect, a control device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple computer programs, and the computer programs are suitable for being loaded and run by the processor to execute the method for processing long text in deep learning described in any one of the technical solutions of the above-mentioned method for processing long text in deep learning.

[0015] In a third aspect, a computer-readable storage medium is provided, which stores a plurality of computer programs, wherein the computer programs are suitable for being loaded and run by a processor to execute the method for processing long text in deep learning described in any one of the technical solutions of the method for processing long text in deep learning.

[0016] The above one or more technical solutions of the present invention have at least one or more of the following Beneficial effects:

[0017] In the technical solution of the present invention, the input text is segmented according to the preset length to obtain multiple subsequences, and these subsequences are respectively input into the trained deep learning model for processing, and then all the output results are spliced ​​in order to obtain a complete processing result. In this way, the technology realizes the comprehensive understanding and processing of long texts, ensures the coherence and accuracy of the generated results, improves the effect and performance of the model when processing long articles or conversations, and enables the model to be better applied to actual complex text processing tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0019] Figure 1 It is a flowchart of main steps of a method for processing long text in deep learning according to one embodiment of the present invention;

[0020] Figure 2 is a schematic flow chart of sub-steps of a method for processing long text in deep learning according to an embodiment of the present invention;

[0021] Figure 3 It is a flowchart of detailed steps of a method for processing long text in deep learning according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0023] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as computer programs, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store computer programs, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.

[0024] See attached Figure 1 , Figure 1 FIG. 1 is a flow chart of the main steps of a method for processing long text in deep learning according to an embodiment of the present invention. Figure 1 and Figure 3 As shown, the method for processing long text in deep learning in the embodiment of the present invention mainly includes the following steps S10 to S30.

[0025] Step S10: Segment the input text according to preset lengths to obtain multiple subsequences.

[0026] In this embodiment, the input text refers to the original text data to be processed, which can be any form of natural language text, such as articles, paragraphs, sentences, etc. It can also be the previous answers and previous questions answered in the deep learning model.

[0027] In this embodiment, the length of the input text is greater than a preset length. The preset length is set according to the input length requirement of the deep learning model. In one embodiment, the preset length is the maximum length that the deep learning model can allow for processing. The setting of the preset length is usually based on the structure and computing power of the model. For example, the maximum input length of the Transformer model is usually 512 characters. The core purpose of this step is to divide the longer input text into multiple smaller segments suitable for deep learning model processing.

[0028] In one embodiment, specifically, when performing text segmentation, the input text is first scanned and the characters are counted. When the preset length is reached, the current character paragraph is marked as a subsequence. This process continues until the entire input text is completely divided into multiple subsequences. The length of each subsequence is close to the preset length. If the last subsequence is less than the preset length, it is filled with zeros (0) or other special characters. This filling ensures that the lengths of all subsequences are consistent, which is convenient for subsequent processing.

[0029] Preferably, in one embodiment, boundary processing is performed during the segmentation process to ensure that important semantic units, such as words or punctuation marks, are not interrupted. Specifically, segmentation can be performed at appropriate segmentation points (such as after spaces or punctuation marks).

[0030] In one embodiment, the preset length can be customized. By adjusting the preset length, the requirements of different models and application scenarios can be met, thereby enhancing the versatility and applicability of the method.

[0031] In summary, this step can effectively improve the model processing efficiency, maintain the semantic integrity of the text, and ensure the consistency of the model input by segmenting the input text according to preset lengths.

[0032] Step S20: Input the subsequence into the trained deep learning model to obtain the output result.

[0033] In one implementation, the deep learning model is a model of the Transformer architecture.

[0034] In one embodiment, the output result is the output result obtained by the subsequence through the deep learning model. In one embodiment, the output result includes a first output and a second output, wherein the first output and the second output are in text form.

[0035] In one embodiment, the subsequence is divided into a first-place subsequence and a non-first-place subsequence. The output result obtained by the deep learning model for the first-place subsequence is the first output, and the output result obtained by the deep learning model for the non-first-place subsequence is the second output.

[0036] In one implementation, through steps S201-S205, an output result is obtained. Figure 2 shown.

[0037] Step S201: Input the first subsequence into a trained deep learning model to obtain a first output and a first intermediate vector.

[0038] In one embodiment, the deep learning model processes text on a character-by-character basis, which means that when the model receives input data, it considers each character independently, thereby capturing character-level language features.

[0039] In this embodiment, the deep learning model specifically refers to a model based on the Transformer architecture, which allows the model to consider all other characters in the input subsequence when processing any character through the self-attention mechanism, so as to more effectively understand and generate responses (processing results). This processing method enables the model to capture long-distance dependencies while retaining local dependencies of the sequence.

[0040] In this embodiment, the first subsequence refers to the first subsequence after being divided by a preset length, and the first subsequence contains the beginning part of the text. In this embodiment, the first subsequence is processed separately to ensure that the model has established a preliminary understanding of the overall content before parsing subsequent subsequences. And at the same time, the first intermediate vector is output. In this embodiment, the deep learning model will consider the previous sequence part when parsing the subsequence, so that the output result is more relevant. However, the subsequence at the first position does not have the previous part, so the first output is directly output, and the first intermediate vector is output, wherein the first intermediate vector provides the previous content for the subsequence after the first position.

[0041] In this embodiment, the first output refers to the text result directly generated after processing the first subsequence, which represents the direct understanding and response to the first subsequence.

[0042] In this embodiment, the first intermediate vector is an internal mathematical representation generated in the process, which contains the deep feature information of the first subsequence. Specifically, the first intermediate vector includes a query vector and a feature vector, wherein the feature vector includes a label vector and a content vector.

[0043] The query vector represents the query requirements for each character in the input sequence, which is usually used to match the label vector in the memory to retrieve relevant information. The label vector represents the characteristics of each character in the input sequence, which is used to calculate the similarity with the query vector to find the most relevant information. The content vector contains the actual content information of each character in the input sequence, which is used to generate the final output in combination with the similarity weight.

[0044] In this embodiment, the label vector and the content vector together constitute the feature vector. Different from the label vector in the conventional Transformer architecture, the label vector of the conventional Transformer architecture usually contains position information to help the model retain the relative position relationship of the characters when processing the sequence. However, the label vector in this embodiment does not contain position encoding information, that is, it does not contain position information. The content vector contains the specific content information of the character and is the key part of generating the final output.

[0045] In summary, this step ensures that the text processing process can establish a basic understanding of the text at the beginning and generate an important first intermediate vector that is helpful for subsequent processing. It lays the foundation for information interaction and deep understanding in subsequent steps. Through such processing, the model can understand and respond to the input text more comprehensively, and the text answer generated in the end will be more accurate.

[0046] Step S202: Store the first intermediate vector in a memory.

[0047] In one embodiment, the memory storage is a storage structure for storing these intermediate vectors so that information can be efficiently retrieved and referenced in subsequent processing steps. The memory storage generally adopts an efficient storage method, such as storage in a memory, to ensure fast access and data consistency.

[0048] In this embodiment, the first intermediate vector is stored in a memory storage device, specifically, the identification vector and the content vector in the first intermediate vector are stored in the memory storage device. That is, the identification vector and the content vector in the first intermediate vector are respectively encoded and sorted to adapt to the storage format of the memory storage device. The efficiency of storage and retrieval can be improved by standardizing and compressing the data format. Afterwards, the identification vector and the content vector in the sorted first intermediate vector are stored in the memory storage device to ensure that they can be quickly retrieved and referenced.

[0049] In this embodiment, this step is to ensure that after processing the first subsequence, the important feature information generated by it can be preserved, which will provide contextual support when processing non-first subsequences, thereby enhancing the overall understanding and generation capabilities of the model.

[0050] Step S203: input the subsequence not located at the first position into a trained deep learning model to obtain a second intermediate vector.

[0051] In this embodiment, the deep learning model includes a memory layer and a non-memory layer.

[0052] In one embodiment, the memory layer is a special neural network layer used to store and retrieve previously processed information, so that the model can refer to historical data when processing new information, thereby improving the model's contextual understanding ability and generation accuracy. Non-memory layers refer to ordinary neural network layers, such as convolutional layers, fully connected layers, etc., which are mainly used for feature extraction and representation learning.

[0053] In one embodiment, a subsequence that is not in the first position is input into a trained deep learning model and output from a memory layer to obtain a second intermediate vector, wherein the second intermediate vector includes at least a query vector and a feature vector.

[0054] Furthermore, in one embodiment, the non-first subsequence is input into the layer structure of the deep learning model in the form of characters and output from the memory layer to obtain a second intermediate vector, wherein the second intermediate vector is an intermediate vector corresponding to the characters in the non-first subsequence; wherein the feature vectors in the memory storage device all correspond to the corresponding characters.

[0055] Specifically, first, the non-first subsequence is processed as a character unit. Each character is input into the deep learning model as an independent input unit. The deep learning model encodes and extracts features of the input characters through its multi-layer structure. Some layers of the neural network will perform nonlinear transformations on the input data and gradually extract higher-level feature information.

[0056] When input to the initial layer of the model, the characters are converted into corresponding vector representations. These vector representations are processed through multiple layers of neural networks until they reach the memory layer. The deep learning model then generates a second intermediate vector in the memory layer, which includes the query vector and the feature vector.

[0057] The main function of the memory layer is to combine the currently processed subsequence information with the historical information in the memory storage, thereby enhancing the model's ability to understand and generate long texts.

[0058] In this embodiment, the second intermediate vector output by the memory layer does not contain position coding information, wherein the memory layer itself does not contain position coding.

[0059] Step S204: querying the memory storage based on the second intermediate vector, and obtaining a fused feature vector in combination with the query result.

[0060] In one implementation, none of the historical feature vectors in the memory storage contains position encoding information.

[0061] In one implementation, the fused feature vector is obtained through steps S204-1 to S204-2, as follows:

[0062] Step S204-1: based on the query vector, obtain N historical feature vectors with the highest similarity from the memory storage, where N is a preset positive integer.

[0063] In one embodiment, the query vector is used to retrieve relevant information in the memory. In order to find the N historical feature vectors with the highest similarity, it is necessary to calculate the similarity between the query vector and each historical feature vector. Similarity calculation usually uses methods such as inner product operation or cosine similarity. In this embodiment, the inner product operation is used. The specific calculation process is as follows:

[0064] The query vector is inner-producted with all the historical feature vectors in the memory to obtain a similarity matrix. Assuming the dimension of the query vector is d and there are m historical feature vectors in the memory, the dimension of the similarity matrix is ​​1xm.

[0065] The similarity matrix is ​​sorted, and the N historical feature vectors with the highest similarity are selected. Here, N is a preset positive integer, which represents the number of the most relevant historical information selected from the memory storage.

[0066] As an example, assume that the size of the query vector is (1024 x 512), and the memory stores historical feature information of 10,000 tokens, that is, the size of the historical feature vector is (10000 x 512).

[0067] The query vector and the historical feature vector are calculated by inner product to obtain a similarity matrix. The size of this similarity matrix is ​​(1024x 10000), which represents the similarity between each token in the query vector and the 10,000 tokens to be queried. According to the similarity, the top N historical feature vectors with the highest similarity are selected. Assuming N = 30, the top 30 most similar historical feature vectors are selected. The size of these historical feature vectors is (30x 512).

[0068] Step S204 - 2 : merge the N historical feature vectors and the feature vector in the second intermediate vector to obtain a fused feature vector.

[0069] In one implementation, the selected N historical feature vectors are concatenated with the feature vector of the current subsequence. Assuming that the dimension of the feature vector of the current subsequence is d and the dimension of the N historical feature vectors is N x d, the dimension of the concatenated feature vector is (N+1) x d.

[0070] Through a linear transformation layer or attention mechanism, the concatenated feature vectors are fused to generate a new feature representation. This new feature representation is the fused feature vector, which contains the information of the current subsequence and the relevant information extracted from the historical feature vectors.

[0071] Next, using the example in step S204-1, the selected 30 historical feature vectors are merged with the feature vector of the current subsequence. The feature vector size of the current subsequence is (1024x512), and the size of the feature vector obtained after merging is (1054x512). The merged feature vector combines historical information and current information.

[0072] After that, the calculation method is similar to normal non-memory layer processing. First, the query vector (1024x 512) is inner-producted with the new feature vector (1054x 512) to obtain a new similarity matrix (1024x 1054). Then, this similarity matrix is ​​inner-producted with the merged content vector (1054x 512) to obtain the output of the model (1024x512). This output size should be consistent with the size of the query vector and serve as the input of the next layer.

[0073] In this embodiment, the previously processed historical information can be effectively utilized in the above manner, thereby enhancing the model's ability to understand and generate long texts. By combining the query vector and the historical feature vector, the model can better capture the contextual relationship in the text and achieve effective accumulation and utilization of information. This method not only improves the processing efficiency of the model, but also enhances the coherence and accuracy of the generated results, ensuring the quality of the final output text.

[0074] Step S205: Obtain a second output based on the fused feature vector and the trained deep learning model.

[0075] In one implementation, the fused feature vector and the query vector are input into a layer structure after a memory layer in a deep learning model to obtain a second output.

[0076] In this embodiment, it is then run based on the Transformer architecture. Specifically, the inner product of the query vector and the label vector is calculated to obtain a similarity matrix. This similarity matrix represents the similarity between the query vector and the label vector. The similarity matrix is ​​then normalized to obtain an attention weight matrix. Normalization is usually achieved through a softmax function to ensure that the sum of the attention weights is 1. Then, the attention weight matrix is ​​used to perform weighted summation on the content vector to obtain a weighted feature representation. This step combines the information of the query vector and the label vector to generate the final feature representation.

[0077] After that, after passing through multiple self-attention layers and feedforward neural network layers, the deep learning model generates the final output vector, which is the second output. The second output is a comprehensive understanding and generation result of the current subsequence, which contains a comprehensive representation of the current subsequence and its context information. This output vector can be a result in text form or an intermediate result for further processing.

[0078] In this implementation, the deep learning model can make full use of the historical information retrieved from the memory storage and the features of the current subsequence, combined with the powerful feature extraction and representation capabilities of the Transformer architecture, to generate high-quality output results. In this way, the model can maintain the coherence and accuracy of the generated results when processing long texts, thereby improving the performance and effect of overall text processing.

[0079] Step S30: splicing the output results in sequence to obtain a complete processing result.

[0080] In one implementation, step S30 further includes step S301, which is specifically as follows:

[0081] Step S301: splice the first output and the second output in sequence to obtain a complete processing result.

[0082] In one implementation, if the first output and the second output are in non-text form, they are first converted into text form and then concatenated.

[0083] In one implementation, the above independently generated output sequences (output results) are concatenated according to their order in the original input text. This process ensures that the generated text maintains logical continuity and semantic integrity.

[0084] In one embodiment, the concatenation operation is implemented by string operation, specifically connecting the end of one output result to the beginning of another output result. This operation ensures the fluency and reading consistency of the output text.

[0085] In one embodiment, specifically, the splicing operation includes detecting boundary conditions of each output result, such as punctuation at the end of a sentence or paragraph, and possible grammatical requirements, to ensure that the spliced ​​text is consistent in grammar and style. For example, if one output result ends with a complete sentence and the next output result begins with a complete sentence, appropriate punctuation is added between the two. If the output results involve incomplete sentences or phrases, appropriate adjustments are made to ensure the semantic coherence of the spliced ​​text.

[0086] In summary, this step is to ensure that the results of model processing are not only locally correct and efficient, but also globally coherent and complete, thereby improving the usability and readability of the final text output.

[0087] Furthermore, in another embodiment, the layer structure of the deep learning model includes at least two memory layers. When the layer structure of the deep learning model includes at least two memory layers, the processing method is similar to the above steps. The fused feature vector and the query vector are then input into the subsequent layer structure until a memory layer is encountered, and the fused feature vector is regarded as a feature vector in the second intermediate vector output by the memory layer and then processed.

[0088] Specifically, in this embodiment, in a deep learning model comprising two or more memory layers, the processing process is as follows: after the input vector passes through the first memory layer, a second intermediate vector is generated. The second intermediate vector combines the current input with the historical information retrieved from the memory storage. Then, the second intermediate vector continues to be input into the subsequent non-memory layer for further processing. When encountering the second memory layer, the deep learning model again interacts the second intermediate vector with the information in the memory storage to generate a new second intermediate vector. This new second intermediate vector further integrates more historical information, allowing the deep learning model to understand the context more deeply and comprehensively when processing long texts.

[0089] Preferably, in one embodiment, the number of non-memory layers in the two memory layers is greater than or equal to 3.

[0090] Preferably, in one embodiment, the number of non-memory layers between two memory layers is greater than or equal to 3. This means that between every two memory layers, there are at least three non-memory layers. The reason for this structural design is that by inserting multiple non-memory layers between memory layers, local features of the input data can be effectively extracted, and at the same time, the setting of the memory layer ensures that the model can capture and integrate global context information. This hierarchical structure improves the model's expressiveness and ability to process complex sequence data.

[0091] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of each of the above method embodiments when executed by the processor. Among them, the computer program includes a computer program, and the computer program can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0092] Furthermore, the present invention also provides a control device. In an embodiment of a control device according to the present invention, the control device includes a processor and a storage device, the storage device can be configured to store a program for executing the method for processing long text in deep learning of the above method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to the program for executing the method for processing long text in deep learning of the above method embodiment. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The control device can be a control device device formed by various electronic devices.

[0093] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the method for processing long texts in deep learning of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the above-mentioned method for processing long texts in deep learning. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.

[0094] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.

[0095] It is understood by those skilled in the art that the modules in the device can be adaptively split or merged. Such splitting or merging of specific modules will not cause the technical solution to deviate from the principle of the present invention, and therefore, the technical solutions after splitting or merging will fall within the protection scope of the present invention.

[0096] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A method for processing long text in deep learning, characterized in that: include: The input text is segmented according to the preset length to obtain multiple subsequences; Inputting the subsequence into a trained deep learning model to obtain an output result; The output results are spliced ​​in sequence to obtain a complete processing result.

2. The method for processing long text in deep learning according to claim 1, characterized in that: The output result includes a first output and a second output, and the subsequence is input into a trained deep learning model to obtain an output result, including: Input the first subsequence into a trained deep learning model to obtain the first output and the first intermediate vector; Storing the first intermediate vector in a memory; Input the subsequence that is not in the first position into the trained deep learning model to obtain the second intermediate vector; querying the memory storage device based on the second intermediate vector, and obtaining a fused feature vector in combination with the query result; Obtaining a second output based on the fused feature vector and the trained deep learning model; The output results are spliced ​​in sequence to obtain a complete processing result, including: The first output and the second output are spliced ​​in sequence to obtain a complete processing result.

3. The method for processing long text in deep learning according to claim 2, characterized in that: The deep learning model includes a memory layer, and the subsequence located at a non-first position is input into the trained deep learning model to obtain a second intermediate vector, including: Inputting the subsequence not in the first position into a trained deep learning model and outputting it from the memory layer to obtain a second intermediate vector, wherein the second intermediate vector includes at least a query vector and a feature vector; Searching the memory storage device based on the second intermediate vector and obtaining a fused feature vector in combination with the query result includes: Obtaining N historical feature vectors with the highest similarity from the memory storage device based on the query vector, where N is a preset positive integer; Merging the N historical feature vectors and the feature vector in the second intermediate vector to obtain a fused feature vector; The method further comprises: The feature vector in the second intermediate vector is stored in the memory.

4. The method for processing long text in deep learning according to claim 3, characterized in that: The step of inputting the subsequence located at a non-first position into a trained deep learning model and outputting it from the memory layer to obtain a second intermediate vector includes: The non-first subsequence is input into the layer structure of the deep learning model in the form of characters, and output from the memory layer to obtain a second intermediate vector, wherein the second intermediate vector is an intermediate vector corresponding to the characters in the non-first subsequence; wherein the feature vectors in the memory storage device all correspond to the corresponding characters.

5. The method for processing long text in deep learning according to claim 3, characterized in that: The obtaining of a second output based on the fused feature vector and the trained deep learning model includes: The fused feature vector and the query vector are input into a layer structure after the memory layer in the deep learning model to obtain a second output.

6. The method for processing long text in deep learning according to claim 3, characterized in that: The deep learning model adopts the Transformer architecture, and the feature vector includes: a label vector and a content vector.

7. The method for processing long text in deep learning according to claim 6, characterized in that: The memory layer does not contain position encoding, so that the feature vector does not contain position encoding information.

8. The method for processing long text in deep learning according to claim 3, characterized in that: The layer structure of the deep learning model includes at least two memory layers, and there is a non-memory layer between different memory layers.

9. A control device, comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of computer programs, characterized in that: The computer program is suitable for being loaded and run by the processor to execute the method for processing long text in deep learning according to any one of claims 1 to 8.

10. A computer-readable storage medium storing a plurality of computer programs, characterized in that: The computer program is suitable for being loaded and run by a processor to execute the method for processing long text in deep learning according to any one of claims 1 to 8.