Training methods for lyric generation models, lyric generation methods, and computer equipment
By training a lyric text generation model and a word structure generation model, lyrics that match the lyric style and word structure are generated, solving the problem of insufficient matching between lyric creation and music audio, and achieving high matching between lyric and audio generation.
Patent Information
- Application Number
- CN202210503777.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-05-10
AI Technical Summary
In existing technologies, the matching degree between lyrics and music audio is insufficient, resulting in a mismatch between the generated lyrics and audio.
By obtaining the original sequence of lyrics text and lyrics style tags from the lyrics samples, a scrambled sequence of lyrics text and a scrambled sequence of words are generated. The lyrics text generation model and the word generation model are trained using the scrambled sequence representation vector, the scrambled word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector. The model parameters are adjusted until the conditions are met, and the lyrics generation model is obtained.
It improves the matching degree between the generated lyrics and the song style, ensuring the matching between the lyrics and the music audio.
Smart Images

Figure CN114880516B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio processing technology, and in particular to a training method for a lyrics generation model, a lyrics generation method, an apparatus, a computer device, a storage medium, and a computer program product. Background Technology
[0002] With the development of computer technology, people can now play and create music using computers and other devices. The music production process includes both song composition and lyric writing. Lyrics, as an essential element of a complete piece of music, are particularly important in their creation, as they must match the music. Currently, the common method for creating lyrics for music audio is to generate lyrics based on the required number of words in the audio. However, this method of generating lyrics by specifying a word count can lead to a mismatch between the generated lyrics and the audio.
[0003] Therefore, current methods for generating text from song audio suffer from insufficient matching accuracy. Summary of the Invention
[0004] Therefore, it is necessary to provide a training method, lyric generation method, apparatus, computer device, computer-readable storage medium, and computer program product for a lyric generation model that can improve the matching degree of the generated text, in order to address the above-mentioned technical problems.
[0005] Firstly, this application provides a method for training a lyrics generation model, the method comprising:
[0006] Obtain the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style tag corresponding to the lyrics sample, and generate a disordered sequence of lyrics text of the lyrics sample;
[0007] Obtain the original word sequence corresponding to the original sequence of the lyrics text and obtain the disordered word sequence corresponding to the disordered sequence of the lyrics text;
[0008] Based on the disordered sequence of lyrics text and the disordered word sequence, we obtain the disordered sequence representation vector of lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector;
[0009] The disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text are input into the lyrics text generation model to be trained to obtain the lyrics text prediction result; based on the comparison result of the lyrics text prediction result and the original lyrics text sequence, the model parameters of the lyrics text generation model to be trained are adjusted until the model training conditions are met to obtain the lyrics text generation model;
[0010] The disordered word pattern sequence representation vector and lyric style labels are input into the word pattern generation model to be trained to obtain the word pattern prediction result. Based on the comparison between the word pattern prediction result and the original word pattern sequence, the model parameters of the word pattern generation model to be trained are adjusted until the model training conditions are met to obtain the word pattern generation model.
[0011] Based on the lyric text generation model and the word form generation model, a lyric generation model is obtained.
[0012] In one embodiment, obtaining the original word sequence corresponding to the original sequence of the lyrics text and obtaining the disordered word sequence corresponding to the disordered sequence of the lyrics text includes:
[0013] Based on the part of speech corresponding to each word in the original sequence of lyrics text, a first part of speech sequence corresponding to the original sequence of lyrics text is obtained, and based on the original sequence of lyrics text and the first part of speech sequence, an original word grid sequence containing part of speech information is obtained;
[0014] Based on the part of speech corresponding to each word in the disordered sequence of the lyrics text, a second part of speech sequence corresponding to the disordered sequence of the lyrics text is obtained, and based on the disordered sequence of the lyrics text and the second part of speech sequence, a disordered word grid sequence containing part of speech information is obtained.
[0015] In one embodiment, obtaining a randomized word sequence containing part-of-speech information based on the randomized sequence of the lyrics text and the second part-of-speech sequence includes:
[0016] Based on the part of speech of each word in the disordered sequence of the lyrics text corresponding to the part of speech in the second part-of-speech sequence, and the position information of each character in each word in the word it belongs to, a disordered word grid sequence containing part-of-speech information is obtained.
[0017] In one embodiment, obtaining a randomized word sequence containing part-of-speech information based on the part-of-speech of each word in the randomized sequence of lyrics text in the second part-of-speech sequence, and the position information of each character in each word within its respective word, includes:
[0018] For each word in the disordered sequence of the lyrics text, obtain the number of characters for that word;
[0019] If the word is not a single character, add a first word segmentation position identifier containing the part of speech of the word to the first character of the word according to the second part of speech sequence, and add a second word segmentation position identifier containing the part of speech of the word to the other characters of the word;
[0020] If the word is a single character, a third word segmentation position identifier containing the word's part of speech is added to the word according to the second part-of-speech sequence; the first word segmentation position identifier, the second word segmentation position identifier, and the third word segmentation position identifier represent the position of the character in the word within the word;
[0021] The disordered word sequence is determined based on the first, second, and third word segmentation position identifiers corresponding to multiple words, as well as the parts of speech corresponding to multiple words.
[0022] In one embodiment, the step of obtaining the scrambled sequence representation vector, the scrambled word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector based on the scrambled sequence of the lyrics text and the scrambled word pattern sequence includes:
[0023] Based on the position of each character in the disordered sequence of the lyrics text within its sentence, determine the intra-sentence representation sequence;
[0024] A global position representation sequence is determined based on the position of each character in the disordered sequence of the lyrics text.
[0025] The disordered sequence of lyrics text, the disordered word sequence, the intra-sentence representation sequence, and the global position representation sequence are vectorized respectively to obtain the disordered sequence representation vector of lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector.
[0026] In one embodiment, the step of inputting the disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text into the lyrics text generation model to be trained to obtain the lyrics text prediction result; and adjusting the model parameters of the lyrics text generation model to be trained based on the comparison result of the lyrics text prediction result and the original lyrics text sequence until the model training conditions are met to obtain the lyrics text generation model, includes:
[0027] The sum of the disordered sequence representation vector of the lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector is input into the lyrics text generation model to be trained, and the lyrics text prediction result output by the lyrics text generation model to be trained is obtained.
[0028] Obtain the first similarity between the predicted lyrics text and the original lyrics text sequence;
[0029] If the first similarity is less than the preset lyrics text similarity threshold, then the model parameters of the lyrics generation model to be trained are adjusted according to the lyrics text prediction result, and the step of inputting the first training vector into the lyrics generation model to be trained is returned.
[0030] If the first similarity is greater than or equal to the preset lyrics text similarity threshold, then the current lyrics generation model to be trained is taken as the completed lyrics text generation model.
[0031] In one embodiment, the step of inputting the disordered word pattern sequence representation vector and lyric style labels into the word pattern generation model to be trained to obtain word pattern prediction results, and adjusting the model parameters of the word pattern generation model to be trained according to the comparison results between the word pattern prediction results and the original word pattern sequence, until the model training conditions are met to obtain the word pattern generation model, includes:
[0032] According to the preset mapping function, the lyrics style tags are converted into lyrics style vectors, and the sum of the lyrics style vectors and the disordered word grid sequence representation vectors is input into the word grid generation model to be trained, so as to obtain the word grid prediction result output by the word grid generation model to be trained;
[0033] Obtain the second similarity between the word case prediction result and the original word case sequence;
[0034] If the second similarity is less than the preset word pattern similarity threshold, then the word pattern generation model to be trained is adjusted according to the word pattern prediction result, and the step of inputting the second training vector into the word pattern generation model to be trained is returned.
[0035] If the second similarity is greater than or equal to the preset word case similarity threshold, then the current word case generation model to be trained is taken as the word case generation model that has been trained.
[0036] Secondly, this application provides a lyrics generation method, the method comprising:
[0037] Display multiple lyric styles, obtain the target lyric style selected by the user from the multiple lyric styles, and the number of characters corresponding to each line in the lyrics to be generated input by the user;
[0038] Based on the number of characters in each line of the lyrics to be generated input by the user, the target lyric style, and the word pattern generation model in the trained lyric generation model, the word pattern corresponding to each line is generated and displayed; the number of characters in each line generated by the word pattern generation model corresponds to the number of characters in each line of the lyrics to be generated input by the user.
[0039] Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence;
[0040] Input the target word grid corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics;
[0041] The lyrics generation model is trained using the method described above.
[0042] In one embodiment, generating and displaying the word grid corresponding to each sentence based on the number of characters in each line of the lyrics to be generated input by the user, the target lyric style, and the word grid generation model in the trained lyric generation model includes:
[0043] Input the target lyric style and the number of characters in each sentence of the lyrics to be generated into the word pattern generation model in the lyric generation model, obtain and display the word pattern output by the word pattern generation model according to the target lyric style and the number of characters in each sentence;
[0044] The step of inputting the target word pattern corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain lyrics includes:
[0045] Based on the target word pattern and number of characters corresponding to each sentence, obtain the disordered sequence representation vector of the lyrics text, the disordered word pattern representation vector, the intra-sentence position representation vector, and the global position representation vector of the lyrics to be generated, and input them into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0046] Thirdly, this application provides a lyrics generation method, the method comprising:
[0047] Display multiple lyric styles and obtain the target lyric style selected by the user from the multiple lyric styles;
[0048] Based on the target lyric style and the word pattern generation model in the trained lyric generation model, generate and display the word pattern corresponding to each sentence;
[0049] Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence;
[0050] Input the target word pattern corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics;
[0051] The lyrics generation model is trained using the method described above.
[0052] Fourthly, this application provides a training apparatus for a lyrics generation model, the apparatus comprising:
[0053] The first acquisition module is used to acquire the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style tag corresponding to the lyrics sample, and generate a disordered sequence of lyrics text of the lyrics sample.
[0054] The second acquisition module is used to acquire the original word grid sequence corresponding to the original sequence of the lyrics text and to acquire the disordered word grid sequence corresponding to the disordered sequence of the lyrics text.
[0055] The third acquisition module is used to obtain, based on the disordered sequence of the lyrics text and the disordered word sequence, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector;
[0056] The first input module is used to input the disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text into the lyrics text generation model to be trained, and obtain the lyrics text prediction result; based on the comparison result of the lyrics text prediction result and the original lyrics text sequence, the model parameters of the lyrics text generation model to be trained are adjusted until the model training conditions are met to obtain the lyrics text generation model;
[0057] The second input module is used to input the disordered word grid sequence representation vector and lyrics style labels into the word grid generation model to be trained, obtain word grid prediction results, and adjust the model parameters of the word grid generation model to be trained according to the comparison results between the word grid prediction results and the original word grid sequence, until the model training conditions are met to obtain the word grid generation model.
[0058] The lyrics generation module is used to obtain a lyrics generation model based on the lyrics text generation model and the word form generation model.
[0059] Fifthly, this application provides a lyrics generation apparatus, the apparatus comprising:
[0060] The first display module is used to display multiple lyric styles, obtain the target lyric style selected by the user from the multiple lyric styles, and the number of characters corresponding to each sentence in the lyrics to be generated input by the user;
[0061] The first word grid generation module is used to generate and display the word grid corresponding to each sentence based on the number of characters in each sentence of the lyrics to be generated input by the user, the target lyric style, and the word grid generation model in the trained lyric generation model; the number of characters in each sentence generated by the word grid generation model corresponds to the number of characters in each sentence of the lyrics to be generated input by the user.
[0062] The first word pattern determination module is used to obtain the target word pattern corresponding to each sentence determined by the user based on the word pattern corresponding to each sentence;
[0063] The first generation module is used to input the target word grids corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0064] The lyrics generation model is trained using the method described above.
[0065] Sixthly, this application provides a lyrics generation apparatus, the apparatus comprising:
[0066] The second display module is used to display multiple lyric styles and obtain the target lyric style selected by the user from the multiple lyric styles;
[0067] The second word grid generation module is used to generate and display the word grid corresponding to each sentence based on the target lyrics style and the word grid generation model in the trained lyrics generation model.
[0068] The second word form determination module is used to obtain the target word form corresponding to each sentence determined by the user based on the word form corresponding to each sentence;
[0069] The second generation module is used to input the target word grids corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics;
[0070] The lyrics generation model is trained using the method described above.
[0071] In a seventh aspect, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.
[0072] Eighthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0073] Ninthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method.
[0074] The aforementioned lyrics generation model training method, lyrics generation method, device, computer equipment, storage medium, and computer program product obtain the original sequence corresponding to the lyrics sample and the lyrics style label corresponding to the lyrics sample, generate a scrambled sequence of lyrics text, obtain the original word grid sequence and scrambled word grid sequence corresponding to the original lyrics text sequence, train the lyrics text generation model based on the lyrics text scrambled sequence representation vector, scrambled word grid sequence representation vector, intra-sentence position representation vector, and global position representation vector obtained from the lyrics text scrambled sequence and scrambled word grid sequence, and train the word grid generation model based on the scrambled word grid sequence representation vector and lyrics style label, and obtain the lyrics generation model based on the lyrics text generation model and the word grid generation model. Based on the number of characters in each sentence of the lyrics to be generated input by the user, the target lyrics style, and the trained lyrics generation model, the word grid corresponding to each sentence is generated, and then the lyrics are obtained based on the target word grid determined by the user and the lyrics text generation model. Compared with the traditional method of generating corresponding lyrics based only on the number of characters, this solution generates corresponding lyrics based on the word grid corresponding to the lyrics style, which can improve the matching degree between the generated lyrics and the song style. Attached Figure Description
[0075] Figure 1 This is a diagram illustrating the application environment of a lyrics generation method in one embodiment;
[0076] Figure 2 This is a flowchart illustrating the training method of a lyrics generation model in one embodiment;
[0077] Figure 3 This is a flowchart illustrating the training steps of a lyrics text generation model in one embodiment;
[0078] Figure 4 This is a flowchart illustrating the training steps of a word case generation model in one embodiment;
[0079] Figure 5 This is a flowchart illustrating a lyrics generation method in one embodiment;
[0080] Figure 6 This is a schematic diagram of the interface for the lyrics generation step in one embodiment;
[0081] Figure 7 This is a flowchart illustrating the lyrics generation steps in one embodiment;
[0082] Figure 8 This is a flowchart illustrating the lyrics generation method in another embodiment;
[0083] Figure 9 This is a structural block diagram of a training device for a lyrics generation model in one embodiment;
[0084] Figure 10 This is a structural block diagram of a lyrics generation device in one embodiment;
[0085] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0086] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0087] The training method and lyric generation method for the lyric generation model provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Terminal 102 can obtain lyric samples from server 104, and based on the lyric samples, obtain the corresponding text sequence and its corresponding representation vector. Based on the representation vector and lyric style labels, it trains a word grid generation model and a lyric text generation model, thus enabling terminal 102 to obtain a lyric generation model based on the lyric text generation model and the word grid generation model. During the application phase, terminal 102 can display various lyric styles and, based on the user-input target lyric style and / or the number of characters in each line of the lyrics to be generated, uses the word grid generation model to generate the corresponding word grid, and generates lyrics based on the user-selected target word grid and the lyric text generation model. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0088] In one embodiment, such as Figure 2 As shown, a training method for a lyrics generation model is provided, which is then applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:
[0089] Step S202: Obtain the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style tags corresponding to the lyrics sample, and generate a disordered sequence of lyrics text for the lyrics sample.
[0090] In the lyric generation process, terminal 102 can divide the process into a training phase and a generation phase. The training phase mainly refers to the internal model parameter tuning process before formal use. The generation phase is the process in which the user inputs style and word structure, and terminal 102 generates new lyrics based on these conditions during formal use. The user-input word structure may be in the form of information such as the number of characters per line or the separation within a line. During the training process, terminal 102 can obtain lyric samples from server 104 to train the relevant model. The lyric samples can be sample texts used to train the lyric generation model. The lyric samples can have corresponding lyric style tags, and the style of the lyric samples can include multiple styles. The style of lyrics can be different types of lyrics categorized according to musical style, emotion, etc. For example, according to musical style, lyric styles can be divided into: pop, folk, hip-hop, etc.; according to emotion, they can be divided into: sad, joyful, angry, etc., specifically such as lyrics of hip-hop songs, lyrics of folk songs, lyrics of pop songs, and lyrics of rock songs, etc.
[0091] Terminal 102 can acquire the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style label corresponding to the lyrics sample, and generate a randomized sequence of lyrics text for the lyrics sample. The original sequence of lyrics text can be a text sequence generated according to the original order of each line of lyrics in the lyrics sample. For example, terminal 102 can collect Chinese lyrics as training data and assign a lyrics style label to each lyrics style; then, the lyrics of a song can be represented as an original sequence of lyrics text. The style tag for lyrics is represented by y i ∈N, the label values are a finite set. It could be each word in the lyrics sample, X i Each of the The lyrics samples can be arranged according to their original order. To make the lyrics samples usable for training, terminal 102 can generate a corresponding disordered sequence of lyrics text based on the original sequence of lyrics text. For example, terminal 102 can adjust the above X... i Each of the The position of X is adjusted to disrupt the order of the words in the original sequence of the lyrics text, thus creating a new order based on the adjusted position of X. i The disordered sequence of lyrics text is obtained. Therefore, terminal 102 can train the corresponding lyrics generation model based on the disordered sequence of lyrics text.
[0092] Step S204: Obtain the original word sequence corresponding to the original sequence of the lyrics text and obtain the disordered word sequence corresponding to the disordered sequence of the lyrics text.
[0093] The original sequence of lyrics text can be a sequence obtained based on the order of lyrics in the lyrics sample, while the scrambled sequence of lyrics text can be a sequence obtained by shuffling the order of each character in the original sequence of lyrics text. Terminal 102 can obtain the corresponding original word pattern sequence based on the original sequence of lyrics text, and obtain the corresponding scrambled word pattern sequence based on the scrambled sequence of lyrics text. The original word pattern sequence can be determined based on the word pattern in the original sequence of lyrics text. Word pattern is not a strict concept in music theory or lyric writing theory, but rather an abstract representation of the correspondence between musical melody and lyrics that has gradually formed in lyric writing practice. Specifically, given the melody or rhythm of a musical phrase, lyricists usually analyze and obtain the corresponding number of characters and the segmentation within the phrase. For example, the melody of the first phrase of the popular music song "Sunny Day" is "551123". The lyricist analyzes and knows that the corresponding number of characters is 6. Further analysis reveals that the optimal segmentation is 3 / 3 or 3 / 1 / 2 (i.e., three-character word-three-character word, or three-character word-single-two-character word segmentation). The lyricist can further write lyrics such as "The story's / little / yellow flower" (3 / 1 / 2 separation) based on the word pattern. Terminal 102 can use the word separation method as the word pattern. Furthermore, each of the above word pattern sequences can also include the part-of-speech information corresponding to each word in the sequence of lyrics text. Part-of-speech can refer to the characteristics of a word as the basis for classifying words, such as adjectives, verbs, and nouns.
[0094] Since both the original word sequence and the disordered word sequence are based on words, terminal 102 can first segment the original and disordered lyric text sequences into words. For example, terminal 102 can use a Chinese word segmentation tool to segment the text sequence. Chinese word segmentation tools include, but are not limited to, LTP, jieba, snowNLP, and any other tool with Chinese character-level segmentation capabilities, to obtain the lyrics X. i Corresponding word-level representation in, For a word, it can be a single character or a word that is not a single character, and m is X. i The corresponding number of words, m≤n, This represents the part-of-speech tag of the j-th word in the word segmentation sequence. Then, terminal 102 can use this word segmentation sequence S... i This allows obtaining the corresponding original word sequence and disordered word sequence. For example, terminal 102 can use the word-to-BIS (Beginning-Intermittent-Singleon) annotation mapping function to... Mapped to a sequence of length n In this process, the original word sequence is obtained. Terminal 102 can obtain the disordered word sequence corresponding to the disordered sequence of lyrics text using the same method. This represents the k-th word fold, where each word fold can contain part-of-speech information and word separation information.
[0095] Step S206: Based on the disordered sequence of lyrics text and the disordered word sequence, obtain the disordered sequence representation vector of lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector.
[0096] The scrambled sequence of lyrics can be obtained by rearranging the word order of the original lyrics sequence, and the scrambled word sequence can be obtained based on the scrambled sequence of lyrics. Terminal 102 can obtain a scrambled sequence representation vector, a scrambled word sequence representation vector, an intra-sentence position representation vector, and a global position representation vector based on the aforementioned scrambled and scrambled word sequences. The scrambled and scrambled word sequence representation vectors can be obtained by vectorizing the scrambled and scrambled word sequences respectively, while the intra-sentence position representation vector can be obtained based on the position of each word in the lyrics within its respective sentence; the global position representation vector can be obtained based on the position of each word in the lyrics within its entire lyrics text. The intra-sentence position representation vector ensures the integrity of the generated sentences by the lyrics generation model, while the global position representation vector ensures the global fluency of the generated lyrics.
[0097] Step S208: Input the disordered sequence representation vector of the lyrics text, the disordered word lattice sequence representation vector, the intra-sentence position representation vector, and the global position representation vector into the lyrics text generation model to be trained to obtain the lyrics text prediction result; based on the comparison result between the lyrics text prediction result and the original lyrics text sequence, adjust the model parameters of the lyrics text generation model to be trained until the model training conditions are met to obtain the lyrics text generation model.
[0098] The lyrics text generation model to be trained can be a model used to generate lyrics text. Terminal 102 can input the aforementioned disordered sequence representation vector, disordered word pattern sequence representation vector, intra-sentence position representation vector, and global position representation vector into the lyrics text generation model to obtain the lyrics text prediction result. This prediction result can be the result of the training model determining the reasonable position of each word in the sequence after rationally adjusting the disordered sequence representation vector and disordered word pattern sequence representation vector. The training objective is to make the lyrics text prediction result as close as possible to the original lyrics text sequence. Terminal 102 can adjust the model parameters of the lyrics text generation model to be trained based on the comparison between the predicted lyrics text result and the original lyrics text sequence until the model training conditions are met, thus obtaining the lyrics text generation model. In practical applications, the lyrics text generation model can be used to generate corresponding lyrics information based on a lexicon and word patterns that match the style of the lyrics.
[0099] Step S210: Input the disordered word grid sequence representation vector and lyric style labels into the word grid generation model to be trained to obtain the word grid prediction result. Based on the comparison between the word grid prediction result and the original word grid sequence, adjust the model parameters of the word grid generation model to be trained until the model training conditions are met to obtain the word grid generation model.
[0100] The word pattern generation model to be trained can be a model used to generate word pattern sequences. Terminal 102 can input the aforementioned disordered word pattern sequence representation vector and lyric style labels into the word pattern generation model to be trained, obtaining the word pattern prediction result output by the model. This prediction result is the word pattern sequence that matches the lyric style, determined by the model after readjusting the disordered word pattern sequence based on the lyric style. The purpose of this training is to make the word pattern prediction result as close as possible to the original word pattern sequence. Terminal 102 can adjust the model parameters of the word pattern generation model to be trained based on the comparison between the word pattern prediction result and the original word pattern sequence until the training conditions are met, thus obtaining the word pattern generation model. In practical applications, the word pattern generation model can be used to determine word pattern information that matches the lyric style and number of characters in each line based on user-inputted lyric style and word count information.
[0101] Step S212: Based on the lyrics text generation model and the word form generation model, obtain the lyrics generation model.
[0102] The lyrics generation model can consist of two models: a lyrics text generation model and a word pattern generation model. The lyrics text generation model can be trained from the previously mentioned lyrics text generation model, and the word pattern generation model can be trained from the previously mentioned word pattern generation model. Terminal 102 can derive the lyrics generation model based on the lyrics text generation model and the word pattern generation model. In practical use, terminal 102 can determine a word pattern sequence that conforms to the lyrics style based on user input, such as the required number of characters and lyrics style. Then, based on this sequence and multiple words in the dictionary, it can generate lyrics information conforming to this word pattern sequence through the lyrics text generation model, thus realizing the lyrics generation process based on lyrics style and word pattern.
[0103] In the above-described lyrics generation method, the original sequence corresponding to the lyrics sample and the lyrics style label corresponding to the lyrics sample are obtained to generate a scrambled sequence of lyrics text. The original word grid sequence and the scrambled word grid sequence corresponding to the original lyrics text sequence are obtained. Based on the scrambled sequence representation vector, scrambled word grid sequence representation vector, intra-sentence position representation vector, and global position representation vector obtained from the scrambled sequence and scrambled word grid sequence, a lyrics text generation model is trained. A word grid generation model is trained based on the scrambled word grid sequence representation vector and the lyrics style label. The lyrics generation model is then obtained based on the lyrics text generation model and the word grid generation model. Based on the number of characters in each sentence of the lyrics to be generated input by the user, the target lyrics style, and the trained lyrics generation model, word grids corresponding to each sentence are generated. Finally, the lyrics are obtained based on the target word grids determined by the user and the lyrics text generation model. Compared to the traditional method of generating corresponding lyrics based solely on the number of characters, this solution generates corresponding lyrics based on word grids corresponding to the lyrics style, which can improve the matching degree between the generated lyrics and the song style.
[0104] In one embodiment, obtaining the original word grid sequence corresponding to the original sequence of lyrics text and obtaining the disordered word grid sequence corresponding to the disordered sequence of lyrics text includes: obtaining a first part-of-speech sequence corresponding to the original sequence of lyrics text based on the part of speech of each word in the original sequence of lyrics text; obtaining an original word grid sequence containing part-of-speech information based on the original sequence of lyrics text and the first part-of-speech sequence; obtaining a second part-of-speech sequence corresponding to the disordered sequence of lyrics text based on the part of speech of each word in the disordered sequence of lyrics text; and obtaining a disordered word grid sequence containing part-of-speech information based on the disordered sequence of lyrics text and the second part-of-speech sequence.
[0105] In this embodiment, the original sequence of lyrics text can be as described above. Terminal 102 can determine the original word grid sequence and the disordered word grid sequence based on each word and its part of speech in the original sequence of lyrics text. Terminal 102 can obtain the first part of speech sequence corresponding to the original sequence of lyrics text based on the part of speech of each word in the original sequence of lyrics text. For example, if Terminal 102 obtains the part of speech of each word in the original sequence of lyrics text, thus obtaining multiple parts of speech, then Terminal 102 can determine the first part of speech sequence based on these multiple parts of speech. Terminal 102 can obtain the original word grid sequence containing part of speech information based on the above-mentioned original sequence of lyrics text and the first part of speech sequence. For example, Terminal 102 can generate a word grid information containing part of speech information based on the number of characters of each word in the original sequence of lyrics text and the part of speech information corresponding to each word. If Terminal 102 obtains multiple word grid information based on multiple words, then Terminal 102 can obtain the original word grid sequence based on the multiple word grid information. The word order in the original word grid sequence can be consistent with the word order in the above-mentioned original sequence of lyrics text.
[0106] For a scrambled sequence of lyrics, terminal 102 can obtain the second part-of-speech information corresponding to the scrambled sequence based on the part-of-speech of each word in the scrambled sequence. For example, terminal 102 obtains the part-of-speech of each word in the scrambled sequence and determines the second part-of-speech sequence based on multiple parts of speech. Terminal 102 can also obtain a scrambled word grid sequence containing part-of-speech information based on the above scrambled sequence and second part-of-speech sequence. For example, terminal 102 can generate a word grid information containing part-of-speech information based on the number of characters of each word in the scrambled sequence and the part-of-speech of each word. Terminal 102 can obtain multiple word grid information based on multiple words, and then terminal 102 can determine the scrambled word grid sequence based on multiple word grid information. The order of word grids in the scrambled word grid sequence may not be consistent with the order in the original word grid sequence.
[0107] Through this embodiment, terminal 102 can determine the word sequence based on the lyrics text and the part-of-speech information of each word in the lyrics text. Thus, terminal 102 can train the lyrics generation model based on the original word sequence and the disordered word sequence, thereby improving the matching degree between the lyrics generated by the lyrics generation model and the lyrics style.
[0108] In one embodiment, obtaining a scrambled word grid sequence containing part-of-speech information based on a scrambled sequence of lyrics text and a second part-of-speech sequence includes: obtaining a scrambled word grid sequence containing part-of-speech information based on the part-of-speech corresponding to each word in the scrambled sequence of lyrics text in the second part-of-speech sequence, and the position information of each character in each word within the word it belongs to.
[0109] In this embodiment, the terminal 102 can determine the word grid information in the disordered word grid sequence based on the part of speech of each word in the disordered sequence of lyrics (i.e., the part of speech of the word in the second part of speech sequence) and the position information of each character in each word within its word, thereby obtaining a disordered word grid sequence containing part of speech information. Each word grid information in the word grid sequence can include the position information of the character within its word and the part of speech information of the word corresponding to the character. For example, in one embodiment, obtaining a disordered word grid sequence containing part of speech information based on the part of speech of each word in the disordered sequence of lyrics in the second part of speech sequence and the position information of each character in each word within its word includes: obtaining the number of characters in each word in the disordered sequence of lyrics; if the word is not a single character, adding a segmentation position identifier containing the part of speech of the word to the first character of the word according to the second part of speech sequence (this segmentation position identifier can be called the first segmentation position identifier to distinguish it from other segmentation position identifiers), and adding segmentation of the word containing the part of speech of the word to the other characters of the word. The first, second, and third segmentation position identifiers represent the positions of the characters in the word. The disordered word sequence is determined based on the first, second, and third segmentation position identifiers corresponding to multiple words and their corresponding parts of speech.
[0110] In this embodiment, terminal 102 can determine the information contained in each word grid in the word grid sequence based on the number of characters in each word in the disordered sequence of lyrics text and the part-of-speech information corresponding to each word. The disordered sequence of lyrics text can contain multiple words. For each word in the disordered sequence, terminal 102 can obtain the number of characters corresponding to that word and detect the number of characters. If terminal 102 detects that the word is not a single character, then terminal 102 can add a first word segmentation position identifier containing the part-of-speech of the word to the first character of the word according to the second part-of-speech sequence corresponding to the disordered sequence of lyrics text, and add a second word segmentation position identifier containing the part-of-speech of the word to the other characters of the word. If terminal 102 detects that the word is a single character, then terminal 102 can add a third word segmentation position identifier containing the part-of-speech of the word to the word according to the second part-of-speech sequence. The first, second, and third word segmentation position identifiers can respectively represent the position information of the character in the word. For example, the second part-of-speech sequence mentioned above may include the part-of-speech tag corresponding to each word in the disordered sequence of the lyrics text. For each word in the disordered sequence of the lyrics text, terminal 102 can first determine the number of characters in the word. For words that are not single-character words, it can determine the position of each character in the word, such as whether it is the first character or not, and determine the corresponding identifier. Terminal 102 can associate the part-of-speech tag of the word with the aforementioned identifier to obtain the word structure information corresponding to each word. For single-character words, terminal 102 can associate the part-of-speech tag of the word with the identifier corresponding to the single-character word to obtain the word structure information corresponding to each word.
[0111] After obtaining the aforementioned word pattern information, terminal 102 can determine the disordered word pattern sequence based on the first, second, and / or third word segmentation position identifiers corresponding to multiple words, as well as the parts of speech corresponding to multiple words. Specifically, the first word segmentation position identifier can be represented by B, indicating that the character is the first character in the word; the second word segmentation position identifier can be represented by I, indicating that the character is not the first character in the word; and the third word segmentation position identifier can be represented by S, indicating that the character is a single-character word. Terminal 102 can associate the aforementioned B, I, and S with the parts of speech of the words to obtain the word pattern information corresponding to each word. The word pattern sequence can be... in, This represents the k-th word fold, where each fold can contain part-of-speech information and word separation information. Each of these folds... The representation of can be as follows:
[0112]
[0113] in, Represents word segmentation sequence If the part of speech of the j-th word is determined, then j and k can correspond to the same word. B indicates that the character in the word is the first character of the word, I indicates that the character in the word is not the first character of the word, and S indicates that the word is a single-character word. Specifically, for example, in the original text sequence... For {story, event, of, small, yellow, flower}, its corresponding word segmentation sequence Let {N (representing a noun, corresponding to the story), U (representing a particle, corresponding to), A (representing an adjective, corresponding to small), N (representing a noun, corresponding to yellow flower)} be the word case sequence W obtained after mapping the text sequence. i Given {BN,IN,SU,SA,BN,IN}, the above-mentioned disordered word lattice sequence can be obtained by mapping based on the disordered text sequence. That is, terminal 102 can use the word segmentation result of the lyrics text sequence as the basis for calculating the word lattice of the lyrics text.
[0114] Through the above embodiments, the terminal 102 can determine the word sequence corresponding to each text sequence based on the position of each character in the lyrics within the words they belong to and the part of speech of each word. Thus, the terminal 102 can train a lyrics generation model based on the word sequence, thereby improving the matching degree between the generated lyrics and the style.
[0115] In one embodiment, based on the disordered sequence of lyrics and the disordered word sequence, the following steps are taken to obtain the disordered sequence representation vector, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector: determining the intra-sentence representation sequence based on the position of each character in the disordered sequence of lyrics within its sentence; determining the global position representation sequence based on the position of each character in the disordered sequence of lyrics; and vectorizing the disordered sequence of lyrics, the disordered word sequence, the intra-sentence representation sequence, and the global position representation sequence to obtain the disordered sequence representation vector, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector, respectively.
[0116] In this embodiment, terminal 102 can also determine the position information of each character in the lyrics text, thereby ensuring the fluency of the generated lyrics, including the position of each character in its sentence and the position of each character in the entire lyrics text. Terminal 102 can determine the intra-sentence position information of each character based on its position in the sentence within the disordered sequence of the lyrics text, thus allowing terminal 102 to obtain an intra-sentence representation sequence based on multiple intra-sentence position information. Terminal 102 can also determine the global position information of each character based on its position in the disordered sequence of the lyrics text, thus allowing terminal 102 to determine a global position representation sequence based on multiple global position information. Specifically, terminal 102 can obtain the above-mentioned lyrics text sequence through the intra-sentence position mapping of words. Corresponding intra-sentence representation sequence in This represents the position of the j-th word within its sentence; the global position representation vector is obtained through the global position mapping of words. in This indicates the global position of the j-th word within its corresponding lyrics text sequence.
[0117] After obtaining the above intra-sentence representation sequence and global position representation sequence, terminal 102 can vectorize each of the above sequences. For example, terminal 102 can vectorize the above-mentioned disordered lyrics text sequence, disordered word sequence, intra-sentence representation sequence, and global position representation sequence respectively, thereby obtaining the disordered lyrics text sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector respectively. Terminal 102 can use the Transformer model to vectorize the above sequences. The Transformer model is a sequence modeling algorithm and corresponding model with self-attention as its core. Specifically, given a text sequence X = {x1, x2, ..., x...} n The Transformer model uses the Embedding mapping function Emb(X) to map it as: Emb(X) = {e1, e2, ..., e} n},(e i ∈R d emb The mapping process transforms each character to obtain its corresponding vector, with a dimension of d. emb The Transformer model uses another mapping function, Enc(E), to transform Emb(X) into a semantic representation vector H: Enc(Emb(X)){h1,h2,…,h n},(h i ∈R d hThe semantic vector dimension is d. h Generally, Enc(E) is implemented using a multi-layered stacked neural network. Therefore, terminal 102 can use the same Embedding mapping function Emb(*) to map X. i W i L i G i The sequence is converted into the corresponding vector sequence, including in, This is the vector sequence corresponding to the lyrics text sequence. This is the vector sequence corresponding to the word case sequence. This represents the vector sequence corresponding to the sequence within the sentence. This represents the vector sequence corresponding to the global representation sequence; Let be the vectors of different types corresponding to word k. Specifically, when the subscript is x, the vector represents the word vector of word k; when the subscript is k, the vector represents the word case vector of word k; when the subscript is L, the vector represents the intra-sentence position vector of word k; and when the subscript is G, the vector represents the global position vector of word k.
[0118] Through this embodiment, terminal 102 can ensure the intra-sentence fluency of the trained lyrics generation model when generating lyrics based on the intra-sentence position of words, and ensure the global fluency of the trained lyrics generation model when generating lyrics based on the global position of words, thereby improving the matching degree between the generated lyrics and the style; furthermore, terminal 102 uses the same embedding mapping to uniformly model the words themselves, word cases, intra-sentence positions, and global positions, so that all information can be fully integrated in the same space, thereby improving the efficiency of training the lyrics generation model.
[0119] In one embodiment, the disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text are input into the lyrics text generation model to be trained to obtain the lyrics text prediction result. Based on the comparison between the lyrics text prediction result and the original lyrics text sequence, the model parameters of the lyrics text generation model to be trained are adjusted until the model training conditions are met, thus obtaining the lyrics text generation model. This includes: inputting the sum of the disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text into the lyrics text generation model to be trained to obtain the lyrics text prediction result output by the lyrics text generation model to be trained; obtaining the first similarity between the lyrics text prediction result and the original lyrics text sequence; if the first similarity is less than a preset lyrics text similarity threshold, then adjusting the model parameters of the lyrics text generation model to be trained based on the lyrics text prediction result, and returning to the step of inputting the first training vector into the lyrics text generation model to be trained; if the first similarity is greater than or equal to the preset lyrics text similarity threshold, then using the current lyrics text generation model to be trained as the completed lyrics text generation model.
[0120] In this embodiment, terminal 102 can train the lyrics text generation model using the aforementioned disordered lyrics text representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector. Terminal 102 can obtain the first training vector based on the sum of the aforementioned disordered lyrics text representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector. For example, terminal 102 can use the aforementioned... and Add them together to obtain the fused representation vector E. i : Terminal 102 can input the first training vector into the lyrics text generation model and obtain the lyrics text prediction result output by the model. This result can be a lyrics text sequence output by the model. Terminal 102 can compare the predicted lyrics text with the original lyrics text sequence to obtain a first similarity. If Terminal 102 detects that the first similarity is less than a preset lyrics text similarity threshold, it can adjust the model parameters of the lyrics generation model based on the predicted lyrics text and return to the step of inputting the first training vector into the model, thus allowing Terminal 102 to perform the next training iteration. If Terminal 102 detects that the first similarity is greater than or equal to the preset lyrics text similarity threshold, it can use the lyrics generation model obtained in the current training iteration as the completed lyrics text generation model.
[0121] Specifically, the generation process of the lyrics generation model to be trained can be implemented through an Autoregressive Language Model and a Transformer decoder. An Autoregressive Language Model is a model that models text in a certain direction. Specifically, it assumes a text sequence X = {x1, x2, ..., x...} n …}(where x) i (For characters), in a given continuous segment X 1:n ={x1,x2,…,x n After that, the language model LM(X) 1:n-1 (Accept this fragment as input and estimate the next character x) n+1 The probability of: This probability is a simplex form of dimension V-1, where V is the vocabulary size, typically around 10,000 to 20,000 in Chinese. The Transformer decoder is a type of autoregressive language model based on the Transformer. Specifically, the Transformer model obtains the semantic representation vector {h1, h2, ..., h...} corresponding to the text sequence. n After that, use the mapping function Cls({h1,h2,…,h) n}) Get the next character x n+1 The probability of: Then terminal 102 can use the Transformer decoder Trans(E) described above to receive the above E. i ,get That is, the probability of each word in a lyric being in each position; terminal 102 can use gradient descent optimization algorithm or its variants to... Fit the real text sequence and iteratively optimize the above Emb and Transformer decoder Trans.
[0122] like Figure 3 As shown, Figure 3 This is a flowchart illustrating the training steps of a lyrics text generation model in one embodiment. Terminal 102 inputs the text representation vector, word segmentation representation vector, sentence position representation vector, and global position representation vector into the Transformer decoder. Through the various levels of the decoder, a reasonable order of the lyrics output by the decoder is obtained, ensuring that the output lyrics sequence conforms to the style of word patterns and that both the sentences and the overall text flow smoothly. The aforementioned text representation vector is the scrambled sequence vector of the lyrics text, and the aforementioned word segmentation representation vector is the scrambled word pattern sequence representation vector.
[0123] Through this embodiment, terminal 102 can train a lyrics text generation model based on the disordered sequence representation vector of lyrics text, the disordered word pattern sequence representation vector, the intra-sentence position representation vector, and the global position representation vector. Thus, terminal 102 can use the model to generate lyrics that match the word pattern style, thereby improving the matching degree between the generated lyrics and the style.
[0124] In one embodiment, a scrambled word pattern sequence representation vector and lyric style labels are input into a word pattern generation model to be trained to obtain word pattern prediction results. Based on the comparison between the word pattern prediction results and the original word pattern sequence, the model parameters of the word pattern generation model to be trained are adjusted until the model training conditions are met to obtain a word pattern generation model. This includes: converting lyric style labels into lyric style vectors according to a preset mapping function; inputting the second training vector into the word pattern generation model to be trained based on the sum of the lyric style vector and the scrambled word pattern sequence representation vector to obtain the word pattern prediction results output by the word pattern generation model to be trained; obtaining a second similarity between the word pattern prediction results and the original word pattern sequence; if the second similarity is less than a preset word pattern similarity threshold, adjusting the word pattern generation model to be trained based on the word pattern prediction results and returning to the step of inputting the second training vector into the word pattern generation model to be trained; if the second similarity is greater than or equal to the preset word pattern similarity threshold, the current word pattern generation model to be trained is taken as the word pattern generation model that has been trained.
[0125] In this embodiment, terminal 102 can train the word generation model using the aforementioned disordered word sequence representation vector and lyric style tags. Terminal 102 can convert the lyric style tags into lyric style vectors according to a preset mapping function, and obtain a second training vector based on the sum of the lyric style vector and the disordered word sequence representation vector. For example, the aforementioned lyric style tag could be y i Terminal 102 can use the above mapping function Emb(*) to convert the tags into vectors. Will and Adding them together yields the word case prediction vector. That is, the second training vector mentioned above. Where 1 <j<n。
[0126] Terminal 102 can input the second training vector into the word grid generation model to obtain the word grid prediction result output by the word grid generation model. Terminal 102 can compare the word grid prediction result with the original word grid sequence to obtain a second similarity. Terminal 102 can detect whether the second similarity is less than a preset word grid similarity threshold. If it is less, terminal 102 can obtain the word grid generation model to be trained based on the word grid prediction result and return to the step of inputting the second training vector into the word grid generation model. If terminal 102 detects that the second similarity is greater than or equal to the preset word grid similarity threshold, terminal 102 can use the word grid generation model obtained in the current training as the trained word grid generation model.
[0127] Specifically, terminal 102 can predict word lattices using the aforementioned Transformer decoder. Input to Transformer decoder for word cases Obtain word case prediction results Terminal 102 can use the gradient descent optimization algorithm or its variants to perform the above-mentioned optimization. Fit the true word case sequence, i.e., the W mentioned above. i Sequence. Fitting can involve comparing the word case prediction results with the true W. i The process of comparing sequence similarity. Terminal 102 can iteratively optimize the Transformer decoder FTrans through multiple training iterations. For example... Figure 4 As shown, Figure 4 This is a flowchart illustrating the training steps of a word pattern generation model in one embodiment. Terminal 102 can input the word segmentation representation vector and the label representation vector into a Transformer decoder. Through the various layers of the Transformer decoder, it obtains a word pattern sequence output by the Transformer decoder that conforms to the lyric style. This sequence includes information such as the position of each character in its word, whether each word is a single character, the separation between words, and the part of speech of each word. The number of characters in the output word pattern sequence can be determined by the number of characters in the input word segmentation representation vector; the word segmentation representation vector can be the aforementioned disordered word pattern sequence representation vector, and the label representation vector can be the aforementioned lyric style vector.
[0128] In this embodiment, terminal 102 can train a word generation model based on lyric style tags and disordered word vectors, thereby outputting word patterns that conform to the lyric style. Terminal 102 can generate lyrics based on word patterns that conform to the lyric style, thus improving the matching degree between the generated lyrics and the style.
[0129] In one embodiment, such as Figure 5As shown, a lyrics generation method is provided, which can be applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:
[0130] Step S302: Display multiple lyric styles, obtain the target lyric style selected by the user from the multiple lyric styles, and the number of characters corresponding to each sentence in the lyrics to be generated input by the user.
[0131] The lyric style can correspond to the style of the song. For example... Figure 6 As shown, Figure 6 This is a schematic diagram of the lyrics generation steps in one embodiment. During the lyrics generation process, the user first specifies the lyrics style tag y. i Word cases can be directly specified W i Alternatively, the number of characters in each line can be specified. Terminal 102 can first display multiple lyric styles and obtain the target lyric style selected by the user from these styles, as well as the number of characters in each line of the lyrics to be generated input by the user. For example... Figure 6 As shown, users can select lyric style in area A. This style is not limited to genre, mood, or other tags. Users can also specify lyric structure in area B. Users can specify only the number of characters in each line, or they can directly edit the lyric structure based on the number of characters to obtain the corresponding lyric sequence.
[0132] Step S304: Based on the number of characters in each line of the lyrics to be generated input by the user, the target lyrics style, and the word grid generation model in the trained lyrics generation model, generate and display the word grid corresponding to each line; the number of characters in each line generated by the word grid generation model corresponds to the number of characters in each line of the lyrics to be generated input by the user.
[0133] The lyrics generation process described above can include a word grid generation process and a lyrics generation process. Terminal 102 can generate and display word grids corresponding to each line based on the user-inputted word count for each line of the lyrics to be generated, the target lyrics style, and the word grid generation model in the trained lyrics generation model. The word count for each line generated by the word grid generation model corresponds to the word count for each line in the user-inputted lyrics to be generated. For example, if the user specifies the word count for each line, terminal 102 can generate word grids corresponding to that word count. Specifically, terminal 102 can use y i With user-specified grammatical form W i The above FM model is used to predict style-related word cases.
[0134] Step S306: Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence.
[0135] The user can determine the word grid sequence generated by the word grid generation model. Before doing so, the user can edit the word grid sequence generated by the word grid generation model before determining it, or determine it directly. The user can determine the word grid sequence corresponding to each sentence. The terminal 102 can obtain the target word grid corresponding to each sentence determined by the user based on the word grid corresponding to each sentence, so the terminal 102 can generate lyrics based on the target word grid corresponding to each sentence.
[0136] Step S308: Input the target word grid corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0137] The target word grid can be a sequence of word grids generated by the word grid generation model and determined by the user. Terminal 102 can input the target word grids corresponding to each sentence into the lyrics text generation model within the lyrics generation model to obtain the lyrics output by the lyrics text generation model. Specifically, terminal 102 can use the aforementioned... Using the LM language model as input, which is the lyrics text generation model mentioned above, new lyrics that conform to the target word form are generated.
[0138] Specifically, such as Figure 7 As shown, Figure 7 This is a flowchart illustrating the lyrics generation steps in one embodiment. Terminal 102 can first obtain and determine the number of characters, lyric style, and word sequence for each line of lyrics. The word sequence can be generated autonomously by terminal 102 or specified by the user. Terminal 102, through the aforementioned word generation model, generates a target word sequence that conforms to the lyric style based on the vectors corresponding to the lyric style and the word sequence. Terminal 102 can use this target word sequence as input to the lyrics generation model, along with the intra-sentence position representation vector, global position representation vector, and disordered lyric text representation vector, to generate lyrics conforming to the target word sequence through a decoder. That is, terminal 102 can generate new lyrics based on the user-specified style and word sequence, and then... Figure 6 The generated lyrics are displayed in area C, where users can further edit, save, and perform other operations.
[0139] In the above-described lyrics generation method, the original sequence corresponding to the lyrics sample and the lyrics style label corresponding to the lyrics sample are obtained to generate a scrambled sequence of lyrics text. The original word grid sequence and the scrambled word grid sequence corresponding to the original lyrics text sequence are obtained. Based on the scrambled sequence representation vector, scrambled word grid sequence representation vector, intra-sentence position representation vector, and global position representation vector obtained from the scrambled sequence and scrambled word grid sequence, a lyrics text generation model is trained. A word grid generation model is trained based on the scrambled word grid sequence representation vector and the lyrics style label. The lyrics generation model is then obtained based on the lyrics text generation model and the word grid generation model. Based on the number of characters in each sentence of the lyrics to be generated input by the user, the target lyrics style, and the trained lyrics generation model, word grids corresponding to each sentence are generated. Finally, the lyrics are obtained based on the target word grids determined by the user and the lyrics text generation model. Compared to the traditional method of generating corresponding lyrics based solely on the number of characters, this solution generates corresponding lyrics based on word grids corresponding to the lyrics style, which can improve the matching degree between the generated lyrics and the song style.
[0140] In one embodiment, based on the number of characters in each line of the lyrics to be generated input by the user, the target lyrics style, and the word grid generation model in the trained lyrics generation model, the word grid corresponding to each line is generated and displayed. This includes: inputting the target lyrics style and the number of characters in each line of the lyrics to be generated into the word grid generation model in the lyrics generation model, obtaining and displaying the word grid output by the word grid generation model based on the target lyrics style and the number of characters in each line; inputting the target word grid corresponding to each line into the lyrics text generation model in the lyrics generation model to obtain the lyrics, including: obtaining the lyrics text randomized sequence representation vector, randomized word grid sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics to be generated based on the target word grid and the number of characters in each line, and inputting them into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0141] In this embodiment, during the word pattern generation process, terminal 102 can input the target lyric style and the number of characters corresponding to each sentence in the lyrics to be generated into the word pattern generation model in the lyric generation model. Terminal 102 can obtain and display the word pattern sequence output by the word pattern generation model according to the target lyric style and the number of characters corresponding to each sentence. Thus, terminal 102 can obtain the lyric text disordered sequence representation vector, disordered word pattern sequence representation vector, sentence position representation vector, and global position representation vector of the lyrics to be generated according to the target word pattern and the number of characters corresponding to each sentence. Terminal 102 can add the above sequences together and input them into the lyric text generation model in the lyric generation model to obtain the lyrics generated by the lyric text generation model.
[0142] Through the above embodiments, the terminal 102 can generate word patterns that match the style of the song and generate corresponding lyrics based on the word patterns, thereby improving the matching degree between the generated lyrics and the style.
[0143] In one embodiment, such as Figure 8 As shown, a lyrics generation method is provided, which can be applied to... Figure 1 Taking the terminal in the example, the explanation includes the following steps:
[0144] Step S310: Display multiple lyric styles and obtain the target lyric style selected by the user from the multiple lyric styles.
[0145] The lyric style can correspond to the style of the song. For example... Figure 6 As shown, Figure 6 This is a schematic diagram of the lyrics generation steps in one embodiment. During the lyrics generation process, the user first specifies the lyrics style tag y. i Word cases can be directly specified W i Alternatively, the user can specify the number of words in each line. Terminal 102 can first display multiple lyric styles and then obtain the target lyric style selected by the user from these styles. In this embodiment, the user can specify only the lyric style, without specifying the number of words in each line. For example... Figure 6 As shown, users can select the lyric style in area A. The style here is not limited to tags such as music style and mood.
[0146] Step S312: Generate and display the word grid corresponding to each sentence based on the target lyric style and the word grid generation model in the trained lyric generation model.
[0147] The aforementioned lyrics generation process can include a word pattern generation process and a lyrics generation process. Terminal 102 can use the user-input target lyrics style and the word pattern generation model from the trained lyrics generation model to generate and display the word pattern for each sentence and the number of characters for each sentence. Specifically, terminal 102 can use y i With user-specified grammatical form W i The above FM model is used to predict style-related word cases.
[0148] Step S314: Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence.
[0149] The user can determine the word grid sequence generated by the word grid generation model. Before doing so, the user can edit the word grid sequence generated by the word grid generation model before determining it, or determine it directly. The user can determine the word grid sequence corresponding to each sentence. The terminal 102 can obtain the target word grid corresponding to each sentence determined by the user based on the word grid corresponding to each sentence, so the terminal 102 can generate lyrics based on the target word grid corresponding to each sentence.
[0150] Step S316: Input the target word pattern corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics; wherein, the lyrics generation model is trained according to the above method.
[0151] The target word grid can be a sequence of word grids generated by the word grid generation model and determined by the user. Terminal 102 can input the target word grids corresponding to each sentence into the lyrics text generation model within the lyrics generation model to obtain the lyrics output by the lyrics text generation model. Specifically, terminal 102 can use the aforementioned... Using the LM language model as input, which is the lyrics text generation model mentioned above, new lyrics that conform to the target word form are generated.
[0152] In the above-described lyrics generation method, the original sequence corresponding to the lyrics sample and the lyrics style label corresponding to the lyrics sample are obtained to generate a scrambled sequence of lyrics text. The original word grid sequence and the scrambled word grid sequence corresponding to the original lyrics text sequence are obtained. Based on the scrambled sequence representation vector, scrambled word grid sequence representation vector, intra-sentence position representation vector, and global position representation vector obtained from the scrambled sequence and scrambled word grid sequence, a lyrics text generation model is trained. A word grid generation model is trained based on the scrambled word grid sequence representation vector and the lyrics style label. A lyrics generation model is obtained based on the lyrics text generation model and the word grid generation model. Based on the target lyrics style in the lyrics to be generated input by the user and the trained lyrics generation model, word grids corresponding to each sentence are generated. Finally, the lyrics are obtained based on the target word grids determined by the user and the lyrics text generation model. Compared to the traditional method of generating lyrics based solely on the number of characters, this solution generates lyrics based on word grids corresponding to the lyrics style, which improves the matching degree between the generated lyrics and the song style. Furthermore, it eliminates the need to specify the number of characters in each sentence when generating lyrics, thus improving the efficiency of lyrics generation.
[0153] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0154] Based on the same inventive concept, this application also provides a lyrics generation apparatus for implementing the lyrics generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the lyrics generation apparatus provided below can be found in the limitations of the lyrics generation method described above, and will not be repeated here.
[0155] In one embodiment, such as Figure 9 As shown, a lyrics generation device is provided, including: a first acquisition module 500, a second acquisition module 502, a third acquisition module 504, a first input module 506, a second input module 508, and a lyrics generation module 510, wherein:
[0156] The first acquisition module 500 is used to acquire the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style tag corresponding to the lyrics sample, and generate a disordered sequence of lyrics text of the lyrics sample.
[0157] The second acquisition module 502 is used to acquire the original word sequence corresponding to the original sequence of lyrics text and the disordered word sequence corresponding to the disordered sequence of lyrics text.
[0158] The third acquisition module 504 is used to obtain the scrambled sequence representation vector, the scrambled word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector based on the scrambled sequence of lyrics text and the scrambled word pattern sequence.
[0159] The first input module 506 is used to input the disordered sequence representation vector of the lyrics text, the disordered word fold sequence representation vector, the intra-sentence position representation vector, and the global position representation vector into the lyrics text generation model to be trained, and obtain the lyrics text prediction result; based on the comparison result of the lyrics text prediction result and the original lyrics text sequence, the model parameters of the lyrics text generation model to be trained are adjusted until the model training conditions are met, and the lyrics text generation model is obtained.
[0160] The second input module 508 is used to input the disordered word grid sequence representation vector and lyric style labels into the word grid generation model to be trained, obtain the word grid prediction result, and adjust the model parameters of the word grid generation model to be trained based on the comparison result between the word grid prediction result and the original word grid sequence until the model training conditions are met to obtain the word grid generation model.
[0161] The lyrics generation module 510 is used to obtain the lyrics generation model based on the lyrics text generation model and the word form generation model.
[0162] In one embodiment, the first acquisition module 500 is specifically configured to: obtain a first part-of-speech sequence corresponding to the original sequence of lyrics text based on the part-of-speech of each word in the original sequence of lyrics text; obtain an original word grid sequence containing part-of-speech information based on the original sequence of lyrics text and the first part-of-speech sequence; obtain a second part-of-speech sequence corresponding to the disordered sequence of lyrics text based on the part-of-speech of each word in the disordered sequence of lyrics text; and obtain a disordered word grid sequence containing part-of-speech information based on the disordered sequence of lyrics text and the second part-of-speech sequence.
[0163] In one embodiment, the first acquisition module 500 is specifically used to acquire a random word grid sequence containing part-of-speech information based on the part-of-speech corresponding to each word in the random sequence of lyrics text in the second part-of-speech sequence, and the position information of each character in each word in the word it belongs to.
[0164] In one embodiment, the first acquisition module 500 is specifically used to acquire the number of characters of each word in the disordered sequence of lyrics text; if the word is not a single character, add a first word segmentation position identifier containing the part of speech of the word to the first character of the word according to the second part of speech sequence, and add a second word segmentation position identifier containing the part of speech of the word to the other characters of the word; if the word is a single character, add a third word segmentation position identifier containing the part of speech of the word according to the second part of speech sequence; the first word segmentation position identifier, the second word segmentation position identifier, and the third word segmentation position identifier represent the position of the characters in the word; and determine the disordered word grid sequence according to the first word segmentation position identifier, the second word segmentation position identifier, and the third word segmentation position identifier corresponding to multiple words and the parts of speech corresponding to multiple words.
[0165] In one embodiment, the third acquisition module 504 is specifically used to determine the intra-sentence representation sequence based on the position of each character in the disordered sequence of lyrics text within its sentence; determine the global position representation sequence based on the position of each character in the disordered sequence of lyrics text; and vectorize the disordered sequence of lyrics text, the disordered word sequence, the intra-sentence representation sequence, and the global position representation sequence to obtain the disordered sequence representation vector, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector, respectively.
[0166] In one embodiment, the first input module 506 is specifically used to input the sum of the disordered sequence representation vector of the lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector into the lyrics text generation model to be trained, to obtain the lyrics text prediction result output by the lyrics text generation model to be trained; to obtain the first similarity between the lyrics text prediction result and the original lyrics text sequence; if the first similarity is less than a preset lyrics text similarity threshold, then the model parameters of the lyrics text generation model to be trained are adjusted according to the lyrics text prediction result, and the step of inputting the first training vector into the lyrics text generation model to be trained is returned; if the first similarity is greater than or equal to the preset lyrics text similarity threshold, then the current lyrics text generation model to be trained is used as the trained lyrics text generation model.
[0167] In one embodiment, the second input module 508 is specifically used to convert lyric style tags into lyric style vectors according to a preset mapping function, and input the sum of the lyric style vectors and the disordered word grid sequence representation vectors into the word grid generation model to be trained, thereby obtaining the word grid prediction result output by the word grid generation model to be trained; obtaining the second similarity between the word grid prediction result and the original word grid sequence; if the second similarity is less than a preset word grid similarity threshold, then adjusting the word grid generation model to be trained according to the word grid prediction result, and returning to the step of inputting the second training vector into the word grid generation model to be trained; if the second similarity is greater than or equal to the preset word grid similarity threshold, then using the current word grid generation model to be trained as the trained word grid generation model.
[0168] In one embodiment, such as Figure 10 As shown, a lyrics generation device is provided, including: a first display module 600, a first lyric generation module 602 and a first lyric determination module 604, a first generation module 606, a second display module 608, a second lyric generation module 610, a second lyric determination module 612, and a second generation module 614, wherein:
[0169] The first display module 600 is used to display multiple lyric styles, obtain the target lyric style selected by the user from the multiple lyric styles, and the number of characters corresponding to each line in the lyrics to be generated input by the user.
[0170] The first word grid generation module 602 is used to generate and display the word grid corresponding to each sentence based on the number of characters in each sentence of the lyrics to be generated input by the user, the target lyric style, and the word grid generation model in the trained lyric generation model; the number of characters in each sentence generated by the word grid generation model corresponds to the number of characters in each sentence of the lyrics to be generated input by the user.
[0171] The first word pattern determination module 604 is used to obtain the target word pattern for each sentence determined by the user based on the word pattern corresponding to each sentence.
[0172] The first generation module 606 is used to input the target word grid corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0173] or,
[0174] The second display module 608 is used to display multiple lyric styles and obtain the target lyric style selected by the user from the multiple lyric styles.
[0175] The second word pattern generation module 610 is used to generate and display the word pattern corresponding to each sentence based on the target lyric style and the word pattern generation model in the trained lyric generation model.
[0176] The second word grid determination module 612 is used to obtain the target word grid for each sentence determined by the user based on the word grid corresponding to each sentence.
[0177] The second generation module 614 is used to input the target word grid corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain lyrics; wherein, the lyrics generation model is trained according to the above method.
[0178] In one embodiment, the first word grid generation module 602 is specifically used to input the target lyric style and the number of characters corresponding to each sentence in the lyrics to be generated into the word grid generation model in the lyric generation model, and to obtain and display the word grid output by the word grid generation model according to the target lyric style and the number of characters corresponding to each sentence.
[0179] In one embodiment, the first generation module 606 is used to obtain the disordered sequence representation vector of the lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector of the lyrics to be generated according to the target word pattern and the number of characters corresponding to each sentence, and input them into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
[0180] Each module in the aforementioned lyrics generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0181] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a training method for a lyrics generation model and a lyrics generation method. The display screen can be an LCD screen or an e-ink display screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0182] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0183] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the training method and the lyrics generation method of the lyrics generation model described above.
[0184] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the training method and the lyrics generation method of the lyrics generation model described above.
[0185] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the training method and the lyrics generation method of the lyrics generation model described above.
[0186] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0187] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0188] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0189] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A training method for a lyrics generation model, characterized in that, The method includes: Obtain the original sequence of lyrics text corresponding to the lyrics sample and the lyrics style tag corresponding to the lyrics sample, and generate a disordered sequence of lyrics text of the lyrics sample; Obtain the original word sequence corresponding to the original sequence of the lyrics text and obtain the disordered word sequence corresponding to the disordered sequence of the lyrics text; Based on the disordered sequence of the lyrics text and the disordered word sequence, we obtain the disordered sequence representation vector, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector; The disordered sequence representation vector, disordered word sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text are input into the lyrics text generation model to be trained to obtain the lyrics text prediction result; based on the comparison result of the lyrics text prediction result and the original lyrics text sequence, the model parameters of the lyrics text generation model to be trained are adjusted until the model training conditions are met to obtain the lyrics text generation model; The disordered word pattern sequence representation vector and lyric style labels are input into the word pattern generation model to be trained to obtain the word pattern prediction result. Based on the comparison between the word pattern prediction result and the original word pattern sequence, the model parameters of the word pattern generation model to be trained are adjusted until the model training conditions are met to obtain the word pattern generation model. Based on the lyric text generation model and the word form generation model, a lyric generation model is obtained.
2. The method according to claim 1, characterized in that, The steps of obtaining the original word sequence corresponding to the original sequence of the lyrics text and obtaining the disordered word sequence corresponding to the disordered sequence of the lyrics text include: Based on the part of speech corresponding to each word in the original sequence of lyrics text, a first part of speech sequence corresponding to the original sequence of lyrics text is obtained, and based on the original sequence of lyrics text and the first part of speech sequence, an original word grid sequence containing part of speech information is obtained; Based on the part of speech corresponding to each word in the disordered sequence of the lyrics text, a second part of speech sequence corresponding to the disordered sequence of the lyrics text is obtained, and based on the disordered sequence of the lyrics text and the second part of speech sequence, a disordered word grid sequence containing part of speech information is obtained.
3. The method according to claim 2, characterized in that, The step of obtaining a randomized word sequence containing part-of-speech information based on the randomized sequence of the lyrics text and the second part-of-speech sequence includes: Based on the part of speech of each word in the disordered sequence of the lyrics text corresponding to the part of speech in the second part-of-speech sequence, and the position information of each character in each word in the word it belongs to, a disordered word grid sequence containing part-of-speech information is obtained.
4. The method according to claim 3, characterized in that The step of obtaining a randomized word sequence containing part-of-speech information based on the part-of-speech of each word in the randomized sequence of lyrics text in the second part-of-speech sequence, and the position information of each character in each word within its respective word, includes: For each word in the disordered sequence of the lyrics text, obtain the number of characters for that word; If the word is not a single character, add a first word segmentation position identifier containing the part of speech of the word to the first character of the word according to the second part of speech sequence, and add a second word segmentation position identifier containing the part of speech of the word to the other characters of the word; If the word is a single character, a third word segmentation position identifier containing the word's part of speech is added to the word according to the second part-of-speech sequence; the first word segmentation position identifier, the second word segmentation position identifier, and the third word segmentation position identifier represent the position of the character in the word within the word; The disordered word sequence is determined based on the first, second, and third word segmentation position identifiers corresponding to multiple words, as well as the parts of speech corresponding to multiple words.
5. The method according to claim 1, characterized in that, The process of obtaining a scrambled sequence representation vector, a scrambled word sequence representation vector, an intra-sentence position representation vector, and a global position representation vector based on the scrambled sequence and word sequence of the lyrics text includes: Based on the position of each character in the disordered sequence of the lyrics text within its sentence, determine the intra-sentence representation sequence; A global position representation sequence is determined based on the position of each character in the disordered sequence of the lyrics text. The disordered sequence of lyrics text, the disordered word sequence, the intra-sentence representation sequence, and the global position representation sequence are vectorized respectively to obtain the disordered sequence representation vector of lyrics text, the disordered word sequence representation vector, the intra-sentence position representation vector, and the global position representation vector.
6. The method according to any one of claims 1 to 5, characterized in that, The process involves inputting the disordered sequence representation vector, disordered word stanza sequence representation vector, intra-sentence position representation vector, and global position representation vector of the lyrics text into the lyrics text generation model to be trained, thereby obtaining the lyrics text prediction result; and adjusting the model parameters of the lyrics text generation model to be trained based on the comparison result between the lyrics text prediction result and the original lyrics text sequence, until the model training conditions are met to obtain the lyrics text generation model, including: The first training vector is obtained by summing the disordered sequence representation vector of the lyrics text, the disordered word case sequence representation vector, the intra-sentence position representation vector, and the global position representation vector. Input the first training vector into the lyrics text generation model to be trained, and obtain the lyrics text prediction result output by the lyrics text generation model to be trained; Obtain the first similarity between the predicted lyrics text and the original lyrics text sequence; If the first similarity is less than the preset lyrics text similarity threshold, then the model parameters of the lyrics text generation model to be trained are adjusted according to the lyrics text prediction result, and the step of inputting the first training vector into the lyrics text generation model to be trained is returned. If the first similarity is greater than or equal to the preset lyrics text similarity threshold, then the current lyrics text generation model to be trained is taken as the completed lyrics text generation model.
7. The method according to any one of claims 1 to 5, characterized in that, The process of inputting the disordered word pattern sequence representation vector and lyric style labels into the word pattern generation model to be trained to obtain word pattern prediction results, and adjusting the model parameters of the word pattern generation model to be trained based on the comparison results between the word pattern prediction results and the original word pattern sequence until the model training conditions are met to obtain the word pattern generation model, includes: According to the preset mapping function, the lyrics style tags are converted into lyrics style vectors, and the second training vector is obtained by summing the lyrics style vectors and the disordered word sequence representation vectors. Input the second training vector into the word lattice generation model to obtain the word lattice prediction result output by the word lattice generation model to obtain the word lattice prediction result. Obtain the second similarity between the word case prediction result and the original word case sequence; If the second similarity is less than the preset word pattern similarity threshold, then the word pattern generation model to be trained is adjusted according to the word pattern prediction result, and the step of inputting the second training vector into the word pattern generation model to be trained is returned. If the second similarity is greater than or equal to the preset word case similarity threshold, then the current word case generation model to be trained is taken as the word case generation model that has been trained.
8. A method for generating lyrics, characterized in that, The method includes: Display multiple lyric styles, obtain the target lyric style selected by the user from the multiple lyric styles, and the number of characters corresponding to each line in the lyrics to be generated input by the user; Based on the number of characters in each line of the lyrics to be generated input by the user, the target lyric style, and the word pattern generation model in the trained lyric generation model, the word pattern corresponding to each line is generated and displayed; the number of characters in each line generated by the word pattern generation model corresponds to the number of characters in each line of the lyrics to be generated input by the user. Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence; Input the target word grid corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics; The lyrics generation model is trained using the method described in any one of claims 1 to 7.
9. The method according to claim 8, characterized in that, The step of inputting the target word pattern corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain lyrics includes: Based on the target word pattern and number of characters corresponding to each sentence, obtain the disordered sequence representation vector of the lyrics text, the disordered word pattern representation vector, the intra-sentence position representation vector, and the global position representation vector of the lyrics to be generated, and input them into the lyrics text generation model in the lyrics generation model to obtain the lyrics.
10. A method for generating lyrics, characterized in that, The method includes: Display multiple lyric styles and obtain the target lyric style selected by the user from the multiple lyric styles; Based on the target lyric style and the word pattern generation model in the trained lyric generation model, generate and display the word pattern corresponding to each sentence; Obtain the target word pattern for each sentence as determined by the user based on the word pattern corresponding to each sentence; Input the target word pattern corresponding to each sentence into the lyrics text generation model in the lyrics generation model to obtain the lyrics; The lyrics generation model is trained using the method described in any one of claims 1 to 7.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 10.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Model training method and device, lyric generation method and device, electronic equipment and medium
CN111428487A
Apparatus for generating text and method thereof
KR102173382B1