Lyrics generation model training method, lyrics generation method, device and storage medium

By adding lyrics format information when training the lyrics generation model, it solves the problem that the existing model cannot strictly comply with the format requirements, realizes the generation of lyrics that meet the format requirements, and improves the generation efficiency.

CN115114474BActive Publication Date: 2024-10-25BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202110286728.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-17
Publication Date
2024-10-25
Estimated Expiration
2041-03-17

AI Technical Summary

Technical Problem

Existing neural network models cannot strictly comply with the format requirements of lyrics, such as the number of sentences and words, when generating lyrics, resulting in the generated lyrics not meeting the format requirements of the lyrics to be generated.

Method used

When training the lyrics generation model, add feature information such as word count information, sentence number information, and lyrics beginning and ending information in the lyrics text. The model trained with this information can generate lyrics that meet the format requirements according to the input constraints.

Benefits of technology

The efficiency of the lyrics generation model in generating lyrics that meet the format requirements is improved, so that the generated lyrics can strictly meet the requirements of the number of words and sentences of the lyrics to be generated, and the efficiency of the model in generating lyrics is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114474B_ABST
    Figure CN115114474B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method for training a lyrics generation model, a lyrics generation method, a device and a storage medium, and relates to the field of artificial intelligence. It includes: obtaining a first lyrics text, the first lyrics text at least includes the lyrics of one or more songs, and the word count information of each line of lyrics in the song; converting the first lyrics text into training characters; training a preset network model according to the training characters to obtain a lyrics generation model; the lyrics generation model is used to generate lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints at least include: the input text and the word count of each line of lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model has the ability to recognize the training characters. Based on this, the lyrics generation model training device can improve the ability of the lyrics generation model to generate lyrics that meet the word count requirements by adding word count information to the training lyrics text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence, and in particular to a lyrics generation model training method, a lyrics generation method, a device and a storage medium. Background Art

[0002] Lyrics creation is an important part of music creation. Currently, the main way to create lyrics is manual creation. The process of manual creation depends on the knowledge accumulation and creative ability of the creator, and it takes a long time to create lyrics.

[0003] In the related art, a method of generating lyrics text using artificial intelligence (AI) technology is proposed. Using a network model in AI technology to generate lyrics is a common method at present. When training a network model, the obtained lyrics text is usually input into the network model for training, and the lyrics are generated according to the trained network model.

[0004] However, since lyrics usually have strict format requirements (for example, the number of sentences, the number of words, etc.), the format requirements of lyrics are not considered when training the current neural network model, resulting in the trained neural network model being unable to strictly generate lyrics according to the format of the lyrics to be generated. Summary of the invention

[0005] The present disclosure provides a lyrics generation model training method, lyrics generation method, device and storage medium, so as to at least solve the problem in the related art that the neural network model cannot generate lyrics strictly according to the format of the lyrics to be generated. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a lyrics generation model training method is provided, comprising:

[0007] Acquire a first lyric text, where the first lyric text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs;

[0008] Converting the first lyrics text into training characters;

[0009] According to the training characters, a preset network model is trained to obtain a lyrics generation model; the lyrics generation model is used to generate the lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints include at least: the input text and the number of words in each sentence of the lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model can recognize the training characters.

[0010] Optionally, obtaining the first lyrics text includes:

[0011] Acquire a second lyrics text, where the second lyrics text includes lyrics of the one or more songs;

[0012] Adding feature information to the second lyrics text to obtain a processed text; the feature information at least includes word count information of each line of lyrics in the song, and the word count information is used to identify the number of words;

[0013] The first lyrics text is determined according to the processed text.

[0014] Optionally, the characteristic information also includes any one of the following: sentence number information of each song in the songs, start information of each song, and end information of each song.

[0015] Optionally, determining the first lyrics text according to the processed text includes:

[0016] Arranging the words of each lyric in the processed text in reverse order to obtain a text arranged in reverse order;

[0017] The text after the reverse order arrangement is determined to be the first text.

[0018] Optionally, training a preset network model according to the training characters to obtain a lyrics generation model includes:

[0019] According to the processing length of the preset network model, an input sequence and an output sequence are obtained from the training characters, the lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters;

[0020] The preset network model is trained according to the input sequence and the output sequence to obtain the lyrics generation model.

[0021] Optionally, the lyrics generation model includes a decoder and an output layer; the output layer is used to output the characters predicted by the lyrics generation model;

[0022] The decoder is used for:

[0023] Get rhyme rules;

[0024] Determining rhyming characters in the lyrics to be generated according to the rhyming rule;

[0025] In the process of generating the rhyming characters, the output layer is inhibited from generating non-rhyming characters.

[0026] According to a second aspect of an embodiment of the present disclosure, a method for generating lyrics is provided, comprising:

[0027] Obtaining constraint conditions; the constraint conditions at least include: the input text and the number of words in each line of the lyrics to be generated, the lyrics to be generated include the input text;

[0028] Inputting the constraint conditions into the lyrics generation model to generate lyrics corresponding to the constraint conditions;

[0029] Wherein, the lyrics generation model is a lyrics generation model trained according to the lyrics model generation training method according to any one of claims 1-6.

[0030] Optionally, the constraint condition also includes at least one of the following: the number of lyrics and rhyme.

[0031] According to a third aspect of an embodiment of the present disclosure, there is provided a lyrics generation model training device, comprising: a communication module and a processing module;

[0032] The communication module is configured to obtain a first lyrics text, wherein the first lyrics text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs;

[0033] The processing module is configured to convert the first lyrics text into training characters;

[0034] The processing module is also configured to train a preset network model according to the training characters to obtain a lyrics generation model; the lyrics generation model is used to generate the lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints include at least: the input text and the number of words in each sentence of the lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model can recognize the training characters.

[0035] Optionally, the communication module is further configured to obtain a second lyrics text, wherein the second lyrics text includes lyrics of the one or more songs;

[0036] The processing module is further configured to add characteristic information to the second lyrics text to obtain a processed text; the characteristic information at least includes word count information of each line of lyrics in the song, and the word count information is used to identify the number of words;

[0037] The processing module is further configured to determine the first lyric text based on the processed text.

[0038] Optionally, the characteristic information also includes any one of the following: sentence number information of each song in the songs, start information of each song, and end information of each song.

[0039] Optionally, the processing module is specifically configured as follows:

[0040] Arranging the words of each lyric in the processed text in reverse order to obtain a text arranged in reverse order;

[0041] The text after the reverse order arrangement is determined to be the first text.

[0042] Optionally, the processing module is specifically configured as follows:

[0043] According to the processing length of the preset network model, an input sequence and an output sequence are obtained from the training characters, the lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters;

[0044] The preset network model is trained according to the input sequence and the output sequence to obtain the lyrics generation model.

[0045] Optionally, the lyrics generation model includes a decoder and an output layer; the output layer is used to output the characters predicted by the lyrics generation model;

[0046] The decoder is configured as follows:

[0047] Get rhyme rules;

[0048] Determining rhyming characters in the lyrics to be generated according to the rhyming rule;

[0049] In the process of generating the rhyming characters, the output layer is inhibited from generating non-rhyming characters.

[0050] According to a fourth aspect of an embodiment of the present disclosure, there is provided a lyrics generating device, comprising: a communication module and a processing module;

[0051] The communication module is configured to obtain constraint conditions; the constraint conditions at least include: the input text and the number of words in each line of the lyrics to be generated, and the lyrics to be generated include the input text;

[0052] The processing module is configured to input the constraint conditions into the lyrics generation model to generate lyrics corresponding to the constraint conditions;

[0053] The lyrics generation model is a lyrics generation model trained by a lyrics model generation training device according to the first aspect and any optional lyrics model generation training device in the first aspect.

[0054] Optionally, the constraint condition also includes at least one of the following: the number of lyrics and rhyme.

[0055] According to a fifth aspect of an embodiment of the present disclosure, a computer device is provided, including:

[0056] processor;

[0057] a memory for storing instructions executable by the processor;

[0058] Wherein, the processor is configured to execute the instructions to implement the above-mentioned first aspect and any optional lyrics generation model training method in the first aspect.

[0059] According to a sixth aspect of an embodiment of the present disclosure, a computer device is provided, including:

[0060] processor;

[0061] a memory for storing instructions executable by the processor;

[0062] Wherein, the processor is configured to execute the instructions to implement the above-mentioned second aspect and any optional lyrics generation method in the second aspect.

[0063] According to the seventh aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute the lyrics generation model training method as described in the first aspect and any one of the optional aspects of the first aspect.

[0064] According to an eighth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute the lyrics generation method as described in the second aspect and any one of the optional aspects of the second aspect.

[0065] According to a ninth aspect of an embodiment of the present disclosure, a computer program product is provided, the computer program product comprising computer instructions, which, when executed on a computer device, enables the computer device to execute the above-mentioned first aspect and any one of the optional lyrics generation model training methods in the first aspect.

[0066] According to a tenth aspect of an embodiment of the present disclosure, a computer program product is provided, the computer program product comprising computer instructions, which, when executed on a computer device, enables the computer device to execute the above-mentioned second aspect and any one of the optional lyrics generation methods in the second aspect.

[0067] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: adding word count information and other information that can reflect the format requirements of lyrics, such as the number of sentences, the beginning of lyrics, the end of lyrics, the connection between sentences, etc. to the lyrics text to be trained. In this way, when the lyrics generation model is trained using these lyrics texts to be trained, in addition to characterizing the correlation features between the characters in the original lyrics, the lyrics generation model can also characterize the correlation features between the characters under different word count conditions when generating lyrics texts.

[0068] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0070] Figure 1 is a schematic diagram of a lyrics generation system according to an exemplary embodiment;

[0071] Figure 2 is a flowchart of a lyrics generation model training method according to an exemplary embodiment;

[0072] Figure 3 is a flowchart of another method for training a lyrics generation model according to an exemplary embodiment;

[0073] Figure 4 is a flow chart of a method for generating lyrics according to an exemplary embodiment;

[0074] Figure 5 is a structural schematic diagram of a lyrics generation model training device according to an exemplary embodiment;

[0075] Figure 6 is a structural schematic diagram of a lyrics generating device according to an exemplary embodiment;

[0076] Figure 7 is a structural block diagram of a computer device according to an exemplary embodiment;

[0077] Figure 8 The present invention is a structural block diagram of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION

[0078] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0079] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0080] Before introducing the model training method of the embodiment of the present disclosure in detail, the application scenario and implementation environment of the embodiment of the present disclosure are first introduced.

[0081] First, the application scenarios of the embodiments of the present disclosure are introduced.

[0082] The lyrics generation model training method of the embodiment of the present disclosure is applied to train the training sample (lyrics text) to obtain the scenario of the lyrics generation model. The training sample can be the lyrics text of the song. For example, the training sample can be the lyrics of one or more songs exported from the server storing the lyrics corresponding to the music player. The lyrics generation model can be an autoregressive language model, such as a Transformer model, or the lyrics generation model can also be other network models, which is not limited by the present disclosure. The lyrics generation model is used to generate lyrics. In this way, when the user enters the constraints of the lyrics to be generated in the lyrics generation model (for example, the number of words in each sentence of the lyrics, etc.), the lyrics generation model can automatically generate lyrics that meet the constraints according to the constraints entered by the user.

[0083] However, in the related art method of using a network model to generate lyrics, since the strict formal requirements of the lyrics are not considered when training the model, the trained model cannot strictly generate lyrics according to the requirements of the number of sentences, the number of words, etc. of the lyrics.

[0084] For example, a current method for training a lyrics generation model is to obtain lyrics text, input the lyrics text into a network model for training, and obtain a lyrics generation model.

[0085] The method for generating lyrics using the lyrics generation model is as follows: after inputting the subject words of the lyrics to be generated into the model, the lyrics generated by the lyrics generation model according to the subject words are obtained. It is judged whether the generated lyrics meet the format requirements (for example, the word count requirements) of the lyrics to be generated. If not, the lyrics are regenerated and judged again until the generated lyrics meet the format requirements.

[0086] The lyrics generation model trained by the above method has low efficiency in generating lyrics and cannot directly obtain lyrics that meet the format requirements of the lyrics to be generated.

[0087] In order to enable the trained lyrics generation model to directly generate lyrics that meet the lyrics format requirements and improve the efficiency of the model in generating lyrics, the disclosed embodiment provides a model training method, and when training the lyrics generation model, the word count information of each sentence in the lyrics text is added to the lyrics text. In this way, during the model training process, the parameters of the model training will include the word count information of each sentence in the lyrics text, and then when using the model to generate lyrics, the word count information of each round of lyrics in the required lyrics can be input into the model, so that the number of sentences of the lyrics generated by the model meets the word count requirements of the required lyrics.

[0088] Next, the implementation environment of the embodiment of the present disclosure is introduced.

[0089] Figure 1 FIG. 1 is a schematic diagram of a lyrics generation system according to an exemplary embodiment. Figure 1 As shown, the lyrics generation system may include: a lyrics generation model training device 11 and a lyrics generation device 12. The lyrics generation model training device 11 communicates with the lyrics generation device 12 via a wired communication method or a wireless communication method, and after the lyrics generation model training device 11 completes the training of the lyrics generation model, the lyrics generation device may obtain the lyrics generation model and use the lyrics generation model to generate lyrics. In some embodiments, the lyrics generation model training device 11 may be a server.

[0090] After introducing the application scenarios and implementation environment of the embodiments of the present disclosure, the model training method provided by the embodiments of the present disclosure is introduced in detail.

[0091] Figure 2 is a flowchart of a lyrics generation model training method according to an exemplary embodiment. Figure 2 As shown, the method may include:

[0092] S201. The lyrics generation model training device obtains a first lyrics text.

[0093] The first lyrics text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs.

[0094] In a possible implementation, the method for the lyrics generation model training device to obtain the first lyrics text includes: after the lyrics generation model training device obtains the lyrics text including one or more songs, the number of words in each line of lyrics in the lyrics text is determined. The lyrics generation model training device adds the number of words in each line of lyrics to the lyrics text to obtain the first lyrics text.

[0095] S202: The lyrics generation model training device converts the first lyrics text into training characters.

[0096] The training characters are characters that can be recognized by the preset network model.

[0097] In one example, the preset network model is a network model that can recognize digital numbers, and the training characters can be digital number characters determined after the lyrics generation model training device converts the characters in the first lyrics text into digital numbers. In this scenario, the lyrics generation model training device can determine the digital numbers corresponding to the characters through a dictionary. The dictionary is a dictionary with a correspondence between characters and digital numbers.

[0098] S203, the lyrics generation model training device trains the preset network model according to the training characters to obtain the lyrics generation model.

[0099] The lyrics generation model is used to generate lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints at least include: the input text and the number of words in each sentence of the lyrics to be generated. The lyrics to be generated include the input text, and the lyrics generation model can recognize training characters.

[0100] The input text may be a subject word of the lyrics to be generated. For example, when lyrics related to friendship need to be generated, the input text may be words such as "friends", "friendship", "friendship", etc. The input text may also be the title of the lyrics to be generated.

[0101] The technical solution provided by the above embodiment brings at least the following beneficial effects: when training the lyrics generation model, the lyrics generation model training device can make the trained lyrics generation model related to both the association relationship between text characters and the number of words in each line of the lyrics by adding the word count information of the lyrics to the lyrics text. In this way, when using the lyrics generation model, the lyrics generation model can generate corresponding lyrics according to the theme information and word count information of the lyrics to be generated, so that the generated lyrics strictly meet the format requirements of the lyrics to be generated.

[0102] In one possible implementation, combining Figure 2 ,like Figure 3 As shown, the above S201 can be implemented specifically through the following S301-S303. The following is a specific description of S301-S303:

[0103] S301. The lyrics generation model training device obtains a second lyrics text.

[0104] The second lyrics text includes lyrics of one or more songs.

[0105] Optionally, the lyrics generation model training device can obtain the lyrics of the song from a currently commonly used music player.

[0106] Specifically, the method for the lyrics generation model training device to obtain the lyrics of a song from a music player includes:

[0107] The lyrics generation model training device establishes a communication connection with a lyrics storage module in the music player that stores lyrics, and the lyrics generation model training device can obtain lyrics of one or more songs in the second lyrics text from the lyrics storage module through the communication connection. The communication connection can be a wireless connection such as Bluetooth, wireless network connection, etc.; it can also be a wired connection such as USB interface connection, bus connection, etc., which is not limited to this.

[0108] It should be noted that when the lyrics generation model training device obtains lyrics, it can obtain all lyrics stored in the module storing lyrics, or it can only obtain lyrics of one or more styles, such as pop music, rock music, jazz music, folk music, and Chinese style.

[0109] For example, when training for generating lyrics of ancient Chinese style, only the lyrics of songs corresponding to ancient Chinese style in the module are obtained; when training for generating lyrics of pop music, only the lyrics of songs corresponding to pop music in the module are obtained. The lyrics generation model training device can generate lyrics of different types according to the lyrics training model and obtain lyrics of corresponding types of songs, which is not limited in the present disclosure.

[0110] S302: The lyrics generation model training device adds feature information to the second lyrics text to obtain a processed text.

[0111] The characteristic information at least includes the word count information of each line of lyrics in the song, and the word count information is used to identify the number of words.

[0112] In a possible implementation, the method for the lyrics generation model training device to add feature information to the second lyrics text includes:

[0113] The lyrics generation model training device determines the word count information of each line of lyrics; the lyrics generation model training device adds the word count information corresponding to the lyrics to each line of lyrics.

[0114] Among them, the lyrics generation model training device can add the word count information corresponding to the lyrics at the beginning of each sentence of the lyrics.

[0115] In one example, the lyrics text of the song obtained by the lyrics generation model training device is: AABBC, BBCCA, CADHBQHHF, AHFKHQIUE, QWUIBSKB, AKDSADKJLK.

[0116] After the lyrics generation model training device adds word count information to the lyrics text, the processed text obtained is:

[0117] <c5>AABC <c5>BBCCA <c9>CADHBQHHF <c9>AHFKHQIUE <c8>QWUIBSKB <c10>AKDSADKJLK.

[0118] in, <cy>Indicates that the lyrics contain 5 words. In the above example, the values ​​of y are 5, 5, 9, 9, 8, and 10 respectively.

[0119] In another possible implementation, the feature information further includes any of the following: sentence number information of each song in the song, start information of each song, and end information of each song.

[0120] The following is an example in which the characteristic information includes: the number of sentences in each song, the start information of each song, the end information of each song, and the connection information between sentences.

[0121] Specifically, after obtaining the lyrics information of the song, the lyrics generation model training device determines the starting position and the ending position of the lyrics of each song respectively. The lyrics generation model training device adds a start mark at the starting position of the lyrics of each song to indicate that the lyrics of a song start from here, and adds an end mark at the ending position of the lyrics of each song to indicate that the lyrics of a song end here.

[0122] The lyrics generation model training device determines the number of sentences included in the lyrics of a song and adds the number of sentences of the lyrics to the beginning of the lyrics.

[0123] Combined with the above example, after adding the word count information, further adding the sentence count information, start information, and end information, the processed text obtained is:

[0124] <sos> <s6> <c5>AABC <next> <c5>BBCCA <next> <c9>CADHBQHHF <next> <c9>AHFKHQIUE <next> <c8>QWUIBSKB <next> <c10>AKDSADKJLK <eos>.

[0125] in, <sos>Indicates the beginning of the lyrics of a song. <sx>Indicates the number of sentences in the lyrics of a song. <next>Indicates the connection between two sentences. <eos>The end of a song's lyrics.

[0126] In this way, the lyrics generation model training device can train a lyrics generation model affected by the number of words, number of sentences, start information and end information by further adding the sentence number information of each song, the start information of each song, and the end information of each song in the second lyrics text.

[0127] S303: The lyrics generation model training device obtains a first lyrics text based on the processed text.

[0128] In a possible implementation, the server arranges the text of each line of lyrics in the processed text in reverse order to obtain a text arranged in reverse order.

[0129] The server determines that the text arranged in reverse order is the first text.

[0130] Specifically, considering that when the lyrics generation model training device generates the first lyrics text, if the lyrics require rhyme, then it is more conducive to the model generation process for the training model to generate the rhyme first. Therefore, when generating lyrics, you can first generate them in reverse order, and then after the generation is completed, arrange the reversed lyrics in normal order.

[0131] Based on the reverse order method of generating lyrics, the lyrics generation model training device can arrange the words of each line of lyrics in the text after adding feature information in reverse order when using the lyrics text to train the lyrics generation model to obtain the reverse order text.

[0132] The lyrics generation model training device determines that the text after reverse arrangement is the first lyrics text.

[0133] Combining the above examples, the text in reverse order is: <sos> <s6> <c5>CBBAA <next> <c5>ACCBB <next> <c9>FHHQBHDAC <next> <c9>EUIQHKFHA <next> <c8>BKSBIUWQ <next> <c10>KLJKDASDKAAKDSADKJLK <eos>.

[0134] In this way, in order to make the lyrics rhyme better, the lyrics can also be arranged in reverse order. Based on the above technical solution, these lyrics texts to be trained are used for model training, so that the lyrics generation model obtained by training can generate lyrics texts that better meet the format requirements.

[0135] The technical solution provided by the above embodiment brings at least the following beneficial effects: the lyrics generation model training device obtains the first lyrics text by adding feature information to the original lyrics generation model obtained, so that the obtained first lyrics text can represent the association relationship between words in different formats.

[0136] Combination Figure 2 ,like Figure 3 The above S203 can be implemented by the following S304-S305. The following is a specific description of S304-S305:

[0137] S304. The lyrics generation model training device obtains an input sequence and an output sequence from training characters according to a processing length of a preset network model.

[0138] The lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters.

[0139] In one possible implementation, the lyrics generation model training device determines the processing length of a preset network model, and the processing length of the preset network model is used to represent the maximum number of characters that the neural network model can process each time.

[0140] The lyrics generation model training device divides the first lyrics text into one or more continuous input sequences according to the processing length of the preset network model. The number of characters included in each input sequence is less than or equal to the maximum number of characters that the preset neural network model can process.

[0141] The lyrics generation model training device determines an output sequence according to an input sequence, including: the lyrics generation model training device uses the i+1th character of the input sequence as the ith character of the output sequence.

[0142] S305. The lyrics generation model training device trains a preset network model according to the input sequence and the output sequence to obtain a lyrics generation model.

[0143] The technical solution provided by the above embodiment brings at least the following beneficial effects: the lyrics generation model training device divides the training characters into multiple input sequences, and the character length of each input sequence meets the requirement that the preset network model can process the character length, so that the preset network model can directly perform model training according to the input sequence. After the lyrics generation model training device determines the output sequence corresponding to the input sequence, it can compare the output characters corresponding to the input sequence actually output by the preset network model with the output sequence to determine whether the preset network model obtained in this round of training meets the requirements.

[0144] In a possible implementation, the output layer of the preset network model includes j nodes, and the j nodes correspond to j character vectors (eg, vectors of text word conversion).

[0145] After the preset network model converts the known characters into vectors, it undergoes a series of prediction processes to generate a vector of the next character predicted based on the known data. The known characters can be characters that are sequentially input into the preset network model in the input sequence of the lyrics generation model training device.

[0146] The process of outputting the next character in the output layer of the preset network model is:

[0147] The preset network model calculates the distance between the vector of the next character and the j character vectors. The preset network model determines the probability values ​​output by the j nodes based on the distances corresponding to the j character vectors. The preset network model uses the top-k algorithm, the top-p algorithm, or the temperature sampling algorithm to select a probability value from the probability values ​​output by the above j nodes. The preset network model determines that the character corresponding to the node that outputs the selected probability value is the next character.

[0148] The closer the distance between the vector of the next character and one of the j character vectors is, the greater the probability that the character vector is the next character; the farther the distance between the next character vector and one of the j character vectors is, the smaller the probability that the character vector is the next character.

[0149] In a specific implementation of S305, the process of training the neural network model by the lyrics generation model training device includes:

[0150] The lyrics generation model training device inputs the input sequence into the preset network model. The preset network model predicts the first character to be output based on the first character in the input sequence, and outputs the first character. The preset network model predicts the second character to be output based on the first character and the second character in the input sequence, and outputs the second character. According to this method, the preset network model predicts the i-th character to be output based on the 1st to i-th characters of the input sequence, and outputs the i-th character. Until k output characters are output based on all k characters of the input sequence.

[0151] The lyrics generation model training device determines the similarity between the k output characters and the above output sequence, determines whether the similarity meets the preset condition, and determines that the current preset network model is the trained lyrics generation model if the similarity meets the preset condition. If the similarity does not meet the preset condition, the parameters of the preset network model are adjusted according to the similarity, and the adjusted preset network model is continuously trained according to the above method according to the input sequence and the output sequence, until the similarity between the k characters output by the preset network model and the output sequence meets the preset condition, and determines that the preset network model at this time is the lyrics generation model.

[0152] It should be noted that the lyrics generation model determined according to the above method includes a decoding layer and an output layer, the output layer is used to output the characters predicted by the lyrics generation model. The decoder is used to obtain rhyme rules and determine the rhyming characters in the lyrics to be generated according to the rhyme rules.

[0153] In this way, the lyrics generation model can generate rhyming characters according to rhyming rules when generating rhyming characters, so that the generated lyrics meet the rhyming requirements of the lyrics to be generated.

[0154] The technical solution provided by the above embodiment brings at least the following beneficial effects: adding word count information and other information that can reflect the format requirements of lyrics, such as the number of sentences, the beginning of lyrics, the end of lyrics, the connection between sentences, etc. to the lyrics text to be trained. In this way, when the lyrics generation model is trained using these lyrics texts to be trained, in addition to characterizing the correlation features between the characters in the original lyrics, the lyrics generation model can also characterize the correlation features between the characters under different word count conditions when generating lyrics texts.

[0155] like Figure 4 As shown, the embodiment of the present disclosure further provides a lyrics generation method for generating a lyrics model using a training model obtained according to the above lyrics generation model training method. The lyrics generation method includes the following S401-S403:

[0156] S401, the lyrics generation device obtains constraint conditions.

[0157] The constraints include at least: the number of words in the input text and each line of the lyrics to be generated, and the lyrics to be generated include the input text.

[0158] In a possible implementation, the constraint condition further includes at least one of the following: the number of lyrics and the rhyme.

[0159] S402: The lyrics generation device inputs the constraint conditions into the lyrics generation model to generate lyrics corresponding to the preset conditions.

[0160] The lyrics generation model is a lyrics generation model obtained by the method described in the above steps S201-S203 or S301-S306.

[0161] S403: The lyrics generation device performs post-processing on the generated lyrics to determine the final lyrics.

[0162] The above-mentioned post-processing may include: filtering target words, checking the integrity of lyrics, determining the relevance between lyrics and subject words, etc.

[0163] The target words are words that are not suitable to appear in the lyrics content.

[0164] Checking the integrity of lyrics can determine whether the number of sentences, words, rhymes, etc. of the lyrics meet the constraints and whether the lyrics are coherent.

[0165] Determining the relevance between lyrics and subject words can prevent the generated lyrics from having too low relevance to the subject words, thereby preventing the desired lyrics from being obtained.

[0166] The technical solution provided by the above embodiment brings at least the following beneficial effects: the lyrics generation device uses the number of words and keywords as constraints to constrain the lyrics generated by the lyrics generation model, so that the lyrics generation model can directly generate lyrics that meet the word count requirements and fit the keywords, thereby improving the efficiency of the lyrics generation model in generating lyrics.

[0167] In addition, when the constraints also include the number of lyrics and rhymes, the lyrics generation model can further generate lyrics that meet the requirements of the number of lyrics and rhymes, further improving the ability of the lyrics generation model to generate lyrics.

[0168] In a possible implementation, the output layer of the lyrics generation model trained according to the above preset network model also includes j nodes, and the j nodes correspond to j character vectors (such as vectors converted from text).

[0169] After the lyrics generation model converts the known characters into vectors, it undergoes a series of prediction processes to generate the vector of the next character predicted based on the known data. The known characters may include the theme words in the constraints of the lyrics generation device and the characters output by the lyrics generation model based on the theme words.

[0170] The process of the output layer of the lyrics generation model outputting the next character is:

[0171] The lyrics generation model calculates the distance between the vector of the next character and the j character vectors; the lyrics generation model determines the probability values ​​of the j node outputs based on the distances corresponding to the j character vectors. The lyrics generation model uses the top-k algorithm, top-p algorithm or temperature sampling algorithm to select a probability value from the probability values ​​output by the above j nodes. The lyrics generation model determines that the character corresponding to the node that outputs the selected probability value is the next character.

[0172] The closer the distance between the vector of the next character and one of the j character vectors is, the greater the probability that the character vector is the next character; the farther the distance between the next character vector and one of the j character vectors is, the smaller the probability that the character vector is the next character.

[0173] In one example, the process of the lyrics generation device selecting nodes using the top-k algorithm is as follows: the lyrics generation device selects k nodes with the largest probability values ​​from j nodes, and the lyrics generation device uses a random selection method to select a node from the k nodes, and uses the character corresponding to the node as the predicted next character.

[0174] In one example, the lyrics generation model includes 10 nodes, namely: the first node, corresponding to the character "one"; the second node, corresponding to the character "two"; the third node, corresponding to the character "three"; the fourth node, corresponding to the character "four"; the fifth node, corresponding to the character "five"; the sixth node, corresponding to the character "six"; the seventh node, corresponding to the character "seven"; the eighth node, corresponding to the character "eight"; the ninth node, corresponding to the character "nine"; the tenth node, corresponding to the character "ten".

[0175] In a prediction process, the probability value generated by the first node is 0.87; the probability value generated by the second node is 0.52; the probability value generated by the third node is 0.11; the probability value generated by the fourth node is 0.90; the probability value generated by the fifth node is 0.49; the probability value generated by the sixth node is 0.64; the probability value generated by the seventh node is 0.56; the probability value generated by the eighth node is 0.22; the probability value generated by the ninth node is 0.25; and the probability value generated by the tenth node is 0.71.

[0176] The lyrics generation device determines that the value of parameter k in the top-k algorithm is 2. The lyrics generation device uses the top-k algorithm to select two nodes with the highest probability values ​​from the first node to the tenth node, namely: the first node and the fourth node.

[0177] The lyric generation device randomly selects one node from the first node and the fourth node as the final node. For example, if the node selected by the lyric generation device is the first node, the lyric generation device determines that the character "one" corresponding to the first node is the next character in the predicted generated lyric.

[0178] It should be noted that when the lyric generation model is a lyric generation model trained based on the lyric text arranged in reverse order, in the lyrics generated by the lyric generation model, the characters within each lyric sentence are also arranged in reverse order.

[0179] After the lyric generation device obtains the lyric arranged in reverse order generated by the lyric generation model, it adjusts the lyric arranged in reverse order to a lyric arranged in sequential order to obtain the finally generated lyric text.

[0180] In a possible implementation, the constraint condition further includes: rhyme.

[0181] Based on the constraint condition of rhyme, in the case of reverse arrangement, when the lyric generation model determines the first character in a generated lyric sentence, it determines the rhyme nodes and non-rhyme nodes among the j nodes. The lyric generation model controls the probability value output by the non-rhyme nodes to be less than a preset value.

[0182] In this way, when the lyric generation model generates characters that need to rhyme, the probability value output by the non-rhyme nodes is less than the preset value. When the lyric generation model uses algorithms such as top-k to select nodes, it will not select non-rhyme nodes. Further, when the lyric generation model outputs the rhyming character, it will not output the character corresponding to the non-rhyme node either, but only output the character output by the rhyme node. In this way, the lyric generation model can generate rhyming characters according to the constraint condition of rhyme to ensure that the generated lyrics meet the constraint condition of rhyme.

[0183] It can be understood that the above-mentioned lyric generation model training method can be implemented by a lyric generation model training device, and the above-mentioned lyric generation method can be implemented by a lyric generation device. In order to implement the above functions, the lyric generation model training device and the lyric generation device include the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, combining the modules and algorithm steps of each example described in the embodiments disclosed in this article, the embodiments of the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present disclosure.

[0184] The embodiments of the present disclosure may divide the functional modules of the above-mentioned lyrics generation model training device and lyrics generation device according to the above-mentioned method examples. For example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiments of the present disclosure is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0185] Figure 5 The structure diagram of a lyrics generation model training device disclosed in an embodiment of the present disclosure includes: a communication module 501 and a processing module 502 .

[0186] The communication module 501 is configured to obtain a first lyrics text, wherein the first lyrics text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs;

[0187] The processing module 502 is configured to convert the first lyrics text into training characters;

[0188] The processing module 502 is also configured to train a preset network model according to the training characters to obtain a lyrics generation model; the lyrics generation model is used to generate the lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints include at least: the input text and the number of words in each sentence of the lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model can recognize the training characters.

[0189] In a possible implementation, the communication module 501 is further configured to obtain a second lyrics text, where the second lyrics text includes lyrics of the one or more songs.

[0190] The processing module 502 is further configured to add feature information to the second lyrics text to obtain a processed text; the feature information at least includes word count information of each line of lyrics in the song, and the word count information is used to identify the number of words.

[0191] The processing module 502 is further configured to determine the first lyric text according to the processed text.

[0192] In a possible implementation, the characteristic information further includes any one of the following: sentence number information of each song in the songs, start information of each song, and end information of each song.

[0193] In a possible implementation, the processing module 502 is specifically configured to: arrange the text of each line of lyrics in the processed text in reverse order to obtain a text arranged in reverse order.

[0194] The text after the reverse order arrangement is determined to be the first text.

[0195] In a possible implementation, the processing module 502 is specifically configured to:

[0196] According to the processing length of the preset network model, an input sequence and an output sequence are obtained from the training characters, the lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters.

[0197] The preset network model is trained according to the input sequence and the output sequence to obtain the lyrics generation model.

[0198] In a possible implementation, the lyrics generation model includes a decoder and an output layer; the output layer is used to output the characters predicted by the lyrics generation model.

[0199] The decoder is configured as follows:

[0200] Get the rhyme scheme.

[0201] According to the rhyme rule, rhyming characters in the lyrics to be generated are determined.

[0202] In the process of generating the rhyming characters, the output layer is inhibited from generating non-rhyming characters.

[0203] Figure 6 The structure diagram of a lyrics generation device disclosed in an embodiment of the present disclosure is as follows. The lyrics generation device comprises: a communication module 601 and a processing module 602 .

[0204] The communication module 601 is configured to obtain constraint conditions; the constraint conditions at least include: input text and the number of words in each line of the lyrics to be generated, and the lyrics to be generated include the input text.

[0205] The processing module 602 is configured to input the constraint conditions into the lyrics generation model to generate lyrics corresponding to the constraint conditions.

[0206] The lyrics generation model is a lyrics generation model obtained according to the method described in the above steps S201-S203 or S301-S306.

[0207] In a possible implementation, the constraint condition further includes at least one of the following: the number of lyrics and rhyme.

[0208] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0209] Figure 7 It is a block diagram of a computer device according to an exemplary embodiment. The computer device may have relatively large differences due to different configurations or performances, and may include one or more processors 71 and one or more memories 72. Among them, the memory 72 stores at least one instruction, and at least one instruction is loaded and executed by the processor 71 to implement the lyrics generation model training method provided by the above-mentioned various method embodiments. Of course, the computer device may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The computer device may also include other components for realizing the functions of the device, which will not be repeated here.

[0210] Figure 8 It is a block diagram of a computer device according to an exemplary embodiment. The computer device may have relatively large differences due to different configurations or performances, and may include one or more processors 81 and one or more memories 82. Among them, the memory 82 stores at least one instruction, and at least one instruction is loaded and executed by the processor 81 to implement the lyrics generation method provided by the above-mentioned various method embodiments. Of course, the computer device may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The computer device may also include other components for realizing the functions of the device, which will not be repeated here.

[0211] The present disclosure also provides a computer-readable storage medium including instructions, and the computer-readable storage medium stores instructions. When the instructions in the computer-readable storage medium are executed by the processor of a computer device, the computer is enabled to execute the lyrics generation model training method provided by the above-mentioned embodiment, or the lyrics generation method provided by the above-mentioned embodiment. For example, the computer-readable storage medium can be a memory 72 including instructions, and the above-mentioned instructions can be executed by the processor 71 of the computer device to complete the above-mentioned lyrics generation model training method. For another example, the computer-readable storage medium can be a memory 82 including instructions, and the above-mentioned instructions can be executed by the processor 81 of the computer device to complete the above-mentioned lyrics generation method. Optionally, the computer-readable storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0212] The present disclosure also provides a computer program product including instructions, which, when executed on a computer, enables the computer device to execute the lyrics generation model training method provided in the above-mentioned embodiment, or the lyrics generation method provided in the above-mentioned embodiment.

[0213] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0214] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / eos> < / next> < / next> < / next> < / next> < / next> < / s6> < / sos> < / eos> < / next> < / sx> < / sos> < / eos> < / next> < / next> < / next> < / next> < / next> < / s6> < / sos> < / cy>

Claims

1. A lyrics generation model training method, characterized in that: include: Acquire a second lyrics text, where the second lyrics text includes lyrics of one or more songs; Adding feature information to the second lyrics text to obtain a processed text; The characteristic information includes the word count information of each line of lyrics in the song, the sentence count information of each song in the song, the start information of each song, and the end information of each song; the word count information is used to identify the number of words; Determine a first lyric text according to the processed text, wherein the first lyric text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs; Converting the first lyrics text into training characters; According to the training characters, a preset network model is trained to obtain a lyrics generation model; The lyrics generation model is used to generate the lyrics to be generated corresponding to the constraints of the input lyrics to be generated, wherein the constraints include at least: input text and the number of words in each sentence of the lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model can recognize training characters.

2. The method according to claim 1, characterized in that Determining the first lyrics text according to the processed text includes: Arranging the words of each lyric in the processed text in reverse order to obtain a text arranged in reverse order; Determine that the text after reverse arrangement is the first lyrics text.

3. The method according to claim 1, characterized in that The method of training a preset network model according to the training characters to obtain a lyrics generation model includes: According to the processing length of the preset network model, an input sequence and an output sequence are obtained from the training characters, the lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters; The preset network model is trained according to the input sequence and the output sequence to obtain the lyrics generation model.

4. The method according to any one of claims 1 to 3, characterized in that: The lyrics generation model includes a decoder and an output layer; the output layer is used to output the characters predicted by the lyrics generation model; The decoder is used for: Get rhyme rules; Determining rhyming characters in the lyrics to be generated according to the rhyming rule; In the process of generating the rhyming characters, the output layer is inhibited from generating non-rhyming characters.

5. A method for generating lyrics, characterized in that: include: Get constraints; The constraint conditions at least include: the input text and the number of words in each line of the lyrics to be generated, and the lyrics to be generated include the input text; Inputting the constraint conditions into the lyrics generation model to generate lyrics corresponding to the constraint conditions; Wherein, the lyrics generation model is a lyrics generation model trained according to the lyrics generation model training method according to any one of claims 1-4.

6. The method according to claim 5, characterized in that The constraint conditions also include at least one of the following: the number of lyrics and rhyme.

7. A lyrics generation model training device, characterized in that: include: Communication module and processing module; The communication module is configured to obtain a second lyrics text, wherein the second lyrics text includes lyrics of one or more songs; The processing module is configured to add characteristic information to the second lyrics text to obtain a processed text; the characteristic information at least includes the word count information of each line of lyrics in the song, the sentence count information of each song in the song, the start information of each song, and the end information of each song; the word count information is used to identify the number of words; The processing module is further configured to determine a first lyric text according to the processed text; the first lyric text at least includes lyrics of one or more songs and word count information of each line of lyrics in the songs; The processing module is further configured to convert the first lyrics text into training characters; The processing module is also configured to train a preset network model according to the training characters to obtain a lyrics generation model; the lyrics generation model is used to generate the lyrics to be generated corresponding to the constraints of the input lyrics to be generated, and the constraints include at least: the input text and the number of words in each sentence of the lyrics to be generated, the lyrics to be generated include the input text, and the lyrics generation model can recognize the training characters.

8. The device according to claim 7, characterized in that The processing module is specifically configured as follows: Arranging the words of each lyric in the processed text in reverse order to obtain a text arranged in reverse order; Determine that the text after reverse arrangement is the first lyrics text.

9. The device according to claim 7, characterized in that The processing module is specifically configured as follows: According to the processing length of the preset network model, an input sequence and an output sequence are obtained from the training characters, the lengths of the input sequence and the output sequence are less than or equal to the processing length, and the output sequence includes the next character of each character in the input sequence in the training characters; The preset network model is trained according to the input sequence and the output sequence to obtain the lyrics generation model.

10. The device according to claim 7 or 8, characterized in that The lyrics generation model includes a decoder and an output layer; the output layer is used to output the characters predicted by the lyrics generation model; The decoder is configured as follows: Get rhyme rules; Determining rhyming characters in the lyrics to be generated according to the rhyming rule; In the process of generating the rhyming characters, the output layer is inhibited from generating non-rhyming characters.

11. A lyrics generating device, characterized in that: include: Communication module and processing module; The communication module is configured to obtain constraint conditions; The constraint conditions at least include: the input text and the number of words in each line of the lyrics to be generated, and the lyrics to be generated include the input text; The processing module is configured to input the constraint conditions into the lyrics generation model to generate lyrics corresponding to the constraint conditions; Wherein, the lyrics generation model is a lyrics generation model trained by the lyrics generation model training device according to any one of claims 7-10.

12. The device according to claim 11, characterized in that The constraint conditions also include at least one of the following: the number of lyrics and rhyme.

13. A computer device, characterized in that: The computer device comprises: processor; a memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the lyrics generation model training method as described in any one of claims 1-4.

14. A computer device, characterized in that: The computer device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the lyrics generation method as described in claim 5 or 6.

15. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a computer device, the computer device is enabled to execute the lyrics generation model training method as described in any one of claims 1 to 4, or the computer device is enabled to execute the lyrics generation method as described in claim 5 or 6.

16. A computer program product, characterized in that The computer program product includes computer instructions, which, when executed on a computer device, cause the computer device to execute the lyrics generation model training method as described in any one of claims 1 to 4, or cause the computer device to execute the lyrics generation method as described in claim 5 or 6.

Citation Information

Cited By

  • Autoencoder-based lyric generation

    US12346667B2

  • Autoencoder-based lyric generation

    US20230104417A1