Speech synthesis model training method, device and synthesis method based on contrastive learning
Through the speech synthesis model training method based on contrastive learning, using the embedding vectors of text and conversational speaker encoders and the prosodic language model, the problem of the conversational speech synthesis system being unable to understand the historical context is solved, achieving more natural speech generation and improving User experience of human-computer dialogue.
Patent Information
- Application Number
- CN202311358990.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-10-19
AI Technical Summary
Existing conversational speech synthesis systems cannot effectively understand the historical context, resulting in the generated speech not matching the rhythm of natural human dialogue and failing to generate speech suitable for the contextual style.
Using a speech synthesis model training method based on contrastive learning, the embedding vector of the sample is obtained through the text training model and the interlocutor encoder, and the speech generator is trained to generate more natural conversational speech by combining the prosodic language model and the latent prosodic style vector sequence.
It improves the authenticity and user experience of speech synthesis, especially in human-machine dialogue scenarios, where the generated speech is closer to the naturalness of human dialogue.
Smart Images

Figure CN117392972B
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech synthesis, and in particular to a speech synthesis model training method, device and synthesis method based on contrastive learning. Background Art
[0002] Recent advances in speech synthesis systems have made it possible to generate high-quality speech, and have been applied to fields such as intelligent customer service assistants and audiobooks. However, these systems still fall short in scenarios such as human-computer interaction and cannot generate prosody that matches natural human conversation. Psychological findings show that when we understand an unfolding sentence, our brains very quickly use a wide range of information, including what was said before and who the speaker is, to help us understand what is being said to us. Similar to humans, some studies have verified that adding historical context information to speech synthesis systems can help improve prosodic naturalness. Therefore, conversational speech synthesis systems attempt to generate more natural speech that is closer to real human conversation based on understanding historical conversation information.
[0003] However, existing conversational speech synthesis systems are generally based on unsupervised training methods and do not have an effective understanding of historical context. Therefore, how to effectively model the context so that the conversational speech synthesis system can generate speech that suits the contextual style remains an unresolved problem. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a speech synthesis model training method, device and synthesis method based on contrastive learning to eliminate or improve one or more defects existing in the prior art.
[0005] The first aspect of the present application provides a speech synthesis model training method based on contrastive learning, the method comprising:
[0006] Based on the text training model and the interlocutor encoder, the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set are obtained respectively, wherein each sample in the historical sample set is selected from a conversation data set in advance, each sample in the positive sample set is selected from the historical sample set in advance, and the negative sample set is selected in advance based on each sample in the positive sample set; each of the samples includes: conversation text, conversation speech and interlocutor identification; based on the speech training model and the interlocutor encoder, the speech embedding vectors corresponding to each of the samples are obtained respectively;
[0007] Based on a preset triplet loss function, respectively calculating the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set;
[0008] Obtaining a latent prosodic style vector sequence based on a target dialogue text, a target interlocutor identifier, a pre-acquired prosodic language model and a preset latent prosodic style vector, wherein the target dialogue text, the target interlocutor identifier and a target dialogue speech constitute a target sample, and the target sample is pre-selected after each sample in a historical sample set in the dialogue data set;
[0009] Obtaining a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech;
[0010] A preset speech generator is trained based on the target dialogue text, the target interlocutor identifier, samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting dialogue text into dialogue speech.
[0011] In some embodiments of the present application, the text embedding vectors corresponding to the samples in the historical sample set, the positive sample set and the negative sample set are obtained based on the text training model and the dialogue encoder, respectively, including:
[0012] Inputting the dialogue texts in each of the samples into the text training model, and outputting dialogue text vectors corresponding to each of the dialogue texts;
[0013] Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications;
[0014] Each of the dialogue text vectors is concatenated with the corresponding interlocutor identification vector to obtain a text embedding vector corresponding to each of the dialogue texts.
[0015] In some embodiments of the present application, the obtaining of speech embedding vectors corresponding to the respective samples based on the speech training model and the speaker encoder includes:
[0016] Inputting the conversational speech in each of the samples into a pre-acquired speech training model, and outputting a conversational speech vector corresponding to each of the conversational speech;
[0017] Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications;
[0018] Each of the dialogue speech vectors is concatenated with the corresponding interlocutor identification vector to obtain a speech embedding vector corresponding to each of the dialogue speech.
[0019] In some embodiments of the present application, the step of obtaining a latent prosodic style vector sequence based on a target dialogue text, a target dialogue person identifier, a pre-acquired prosodic language model, and a preset latent prosodic style vector includes:
[0020] Inputting the target dialogue text into the prosodic language model to obtain a target dialogue prosodic vector;
[0021] Inputting the latent prosodic style vector into a preset attention mechanism module to obtain a target latent prosodic style vector;
[0022] The target dialogue prosody vector, the target latent prosody style vector and the target interlocutor identifier are added and normalized to obtain the latent prosody style vector sequence.
[0023] In some embodiments of the present application, obtaining a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech includes:
[0024] Converting the target dialogue text into a corresponding phoneme sequence based on a phoneme converter;
[0025] Inputting each of the historical conversation text vectors and the historical speech vector, as well as the phoneme sequence and the latent prosodic style vector sequence into a text encoder to obtain a target text embedding sequence;
[0026] Inputting the target text embedding sequence into a linear mapping layer to obtain a speech distribution sequence;
[0027] The target synthesized speech corresponding to the speech distribution sequence is obtained based on a monotone alignment search algorithm, a decoder and a vocoder.
[0028] In some embodiments of the present application, the step of obtaining the target synthesized speech corresponding to the speech distribution sequence based on the monotone alignment search algorithm, the decoder and the vocoder includes:
[0029] Converting the target conversation speech into a mel spectrum;
[0030] Expanding the speech distribution sequence into a Mel embedding vector sequence having the same length as the Mel spectrum based on a loss monotone alignment search algorithm;
[0031] Inputting the target speaker identifier into a speaker encoder to obtain a target speaker embedding vector;
[0032] Inputting the Mel embedding vector sequence and the target speaker embedding vector into a decoder to obtain a target Mel spectrum;
[0033] The target Mel spectrum is input into a lossy vocoder to obtain the target synthesized speech.
[0034] The second aspect of the present application also provides a speech synthesis method based on contrastive learning, the method comprising:
[0035] Determining the dialogue text to be synthesized and the dialogue person identifier of the dialogue text to be synthesized from the current multi-person dialogue data record;
[0036] The dialogue text to be synthesized and the interlocutor identification are input into the speech synthesis model trained by the speech synthesis model training method based on contrastive learning described in the first aspect, so as to output the synthesized speech corresponding to the dialogue text to be synthesized.
[0037] The third aspect of the present application provides a speech synthesis model training device based on contrastive learning, the device comprising:
[0038] A sample encoding module, used for obtaining text embedding vectors corresponding to each sample in a historical sample set, a positive sample set and a negative sample set based on a text training model and a conversation person encoder, wherein each sample in the historical sample set is selected from a conversation data set in advance, each sample in the positive sample set is selected from the historical sample set in advance, and the negative sample set is selected based on each sample in advance in the positive sample set; each sample includes: conversation text, conversation speech and conversation person identification; based on the speech training model and the conversation person encoder, each speech embedding vector corresponding to each sample is obtained;
[0039] A loss calculation module, used to calculate the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set based on a preset triple loss function;
[0040] a prosody calculation module, configured to obtain a latent prosody style vector sequence based on a target dialogue text, a target dialogue person identifier, a pre-acquired prosody language model and a preset latent prosody style vector, wherein the target dialogue text and the target dialogue person identifier and a target dialogue speech constitute a target sample, and the target sample is pre-selected from each sample in a historical sample set in the dialogue data set;
[0041] A speech synthesis module, configured to obtain a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech;
[0042] A model training module is used to train a preset speech generator based on the target dialogue text, the target dialogue person identifier, samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting the dialogue text into dialogue speech.
[0043] The fourth aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the speech synthesis model training method based on contrastive learning described in the first aspect is implemented, or the speech synthesis method based on contrastive learning described in the second aspect is implemented.
[0044] The fifth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the speech synthesis model training method based on contrastive learning described in the first aspect, or implements the speech synthesis method based on contrastive learning described in the second aspect.
[0045] The present application provides a speech synthesis model training method, device and synthesis method based on contrastive learning, the method comprising: obtaining the text embedding vector and speech embedding vector corresponding to each sample in the historical sample set, positive sample set and negative sample set respectively based on the text training model and the interlocutor encoder; calculating the text loss and speech loss between each sample in the historical sample set, positive sample set and negative sample set respectively based on the preset triple loss function; obtaining a potential prosodic style vector sequence based on a target dialogue text, a target interlocutor identifier and a pre-acquired prosodic language model, and then obtaining the target synthesized speech; finally, training the preset speech generator based on the target dialogue text, the target interlocutor identifier, each sample and the target synthesized speech, and obtaining the speech synthesis model. The present application can effectively improve the authenticity of the simulated speech, and then improve the user experience in specific application scenarios such as human-computer dialogue.
[0046] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.
[0047] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:
[0049] Figure 1 Schematic diagram of the flow of a speech synthesis model training method based on contrastive learning in one embodiment of the present application.
[0050] Figure 2 It is a structural diagram of a speech synthesis model training device based on contrastive learning in another embodiment of the present application.
[0051] Figure 3 Schematic diagram of the architecture of a speech synthesis model training method based on contrastive learning in one embodiment of the present application.
[0052] Figure 4 Schematic diagram of a flow chart of a speech synthesis method based on contrastive learning in one embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.
[0054] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.
[0055] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0056] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0057] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0058] The details are described in detail through the following examples.
[0059] The present application embodiment provides a speech synthesis model training method based on contrastive learning that can be performed by a speech synthesis model training device based on contrastive learning or a client device, see Figure 1 The speech synthesis model training method based on contrastive learning specifically includes the following contents:
[0060] Step 110: Based on the text training model and the interlocutor encoder, the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set are obtained respectively, wherein each sample in the historical sample set is pre-selected from a conversation data set, each sample in the positive sample set is pre-selected from the historical sample set, and the negative sample set is pre-selected based on each sample in the positive sample set; each of the samples includes: conversation text, conversation speech and interlocutor identification; based on the speech training model and the interlocutor encoder, the speech embedding vectors corresponding to each of the samples are obtained respectively.
[0061] Step 120: Based on a preset triplet loss function, the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set are respectively calculated.
[0062] Step 130: Obtain a latent prosodic style vector sequence based on a target conversation text, a target conversation person identifier, a pre-acquired prosodic language model, and a preset latent prosodic style vector, wherein the target conversation text, the target conversation person identifier, and a target conversation speech constitute a target sample, and the target sample is pre-selected from each sample in a historical sample set in the conversation data set.
[0063] Step 140: Obtain a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech.
[0064] Step 150: Train a preset speech generator based on the target dialogue text, the target interlocutor identifier, samples in each historical sample set and the target synthesized speech. During the training process, determine the loss of the target synthesized speech based on the target dialogue speech, and iteratively train the speech generator based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting dialogue text into dialogue speech.
[0065] Specifically, see Figure 3 , the client device first trains the model based on the text (i.e. Figure 3 The text context encoder in the text context encoder) and the dialogue encoder respectively obtain the text embedding vectors corresponding to each sample in the historical sample set, positive sample set and negative sample set (i.e. Figure 3 H text Negative, H textAnchor and H text Positive in the above formula, wherein each sample in the historical sample set is selected from a conversation data set in advance, each sample in the positive sample set is selected from the historical sample set in advance, and the negative sample set is selected based on each sample in the positive sample set in advance; each sample includes: conversation text, conversation speech and conversation person identification; at the same time, based on the speech training model, i.e. Figure 3 The acoustic context encoder in the codec) and the speaker encoder in the codec obtain the speech embedding vectors corresponding to each sample (i.e. Figure 3 H audio Negative, H audio Anchor, and H audio Positive in .
[0066] Then, based on the preset triplet loss function, the text loss between the text embedding vectors corresponding to each sample in the historical sample set, positive sample set and negative sample set, as well as the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, positive sample set and negative sample set are calculated respectively.
[0067] The triplet loss function is shown in Formula 1:
[0068]
[0069] m represents a preset hyperparameter. The interval parameter m is used to specify the distance between negative samples and positive samples, which should be greater than m.
[0070] Among them, anchor represents the text embedding vector or speech embedding vector of the historical sample, positive represents the text embedding vector or speech embedding vector of the positive sample, and negative represents the text embedding vector or speech embedding vector of the negative sample.
[0071] Then based on a target dialogue text (i.e. Figure 3 The synthetic text in the target dialogue person identification (i.e. Figure 3 The speaker ID, the pre-acquired prosodic language model and the preset latent prosodic style vector in the conversation data set are used to obtain a latent prosodic style vector sequence, wherein the target conversation text, the target conversation speaker identifier and a target conversation speech constitute a target sample, and the target sample is pre-selected from each sample in the historical sample set in the conversation data set.
[0072] Then, based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech, the target synthesized speech corresponding to the target dialogue text is obtained.
[0073] Finally, the preset speech generator is trained based on the target dialogue text, the target interlocutor identifier, the samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting the dialogue text into dialogue speech, thereby effectively improving the authenticity of the simulated speech, and thereby improving the user experience in specific application scenarios such as human-computer dialogue.
[0074] The loss of determining the target synthesized speech based on the target conversational speech includes:
[0075] The reconstruction loss is shown in Equation 2:
[0076]
[0077] x mel represents the Mel spectrum of the target conversation speech, Represents the Mel spectrum corresponding to the target synthesized speech.
[0078] Adversarial loss, as shown in Equation 3 and Equation 4:
[0079]
[0080]
[0081] D represents the discriminator, G represents the decoder, z represents the target dialogue text, and y represents the waveform corresponding to the target synthesized speech.
[0082] KL divergence loss, as shown in Formula 5:
[0083] L kl =log q φ (z|x lin )-log p θ (z|c text , A) (5)
[0084] c text represents the phoneme sequence corresponding to the target dialogue text, x lin represents the target conversation speech, z represents the target conversation text, q φ represents the posterior encoder, p θ Represents a stream structured neural network.
[0085] The feature matching loss is shown in Equation 6:
[0086]
[0087] Among them, T represents the number of layers of the discriminator, D l Represents the output feature map of the l-th layer discriminator, N l Indicates the number of feature maps.
[0088] The overall loss is shown in Equation 7:
[0089] L vae =L recon +L kl +L dur +L adv +L fm (G) (7)
[0090] Among them, L adv Including L adv (D) and L adv (G), L dur It is expressed as shown in formula 8:
[0091]
[0092] Among them, c text represents the phoneme sequence corresponding to the target dialogue text, q φ represents the posterior encoder, p θ represents a flow structure neural network, d represents the duration calculated by the MAS algorithm, and u and v represent the posterior probability parameters used to fit q(u,v|d,ctext).
[0093] In order to improve the simulation effect of speech, the text-based training model and the dialogue encoder in step 110 respectively obtain text embedding vectors corresponding to each sample in the historical sample set, the positive sample set, and the negative sample set, including:
[0094] Inputting the dialogue texts in each of the samples into the text training model, and outputting dialogue text vectors corresponding to each of the dialogue texts;
[0095] Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications;
[0096] Each of the dialogue text vectors is concatenated with the corresponding interlocutor identification vector to obtain a text embedding vector corresponding to each of the dialogue texts.
[0097] Specifically, the client device inputs the conversation text in each sample into the text training model, and outputs the conversation text vector corresponding to each conversation text; then inputs the interlocutor identification in each sample into the interlocutor encoder, and outputs the interlocutor identification vector corresponding to each interlocutor identification; finally, each conversation text vector is concatenated with the corresponding interlocutor identification vector to obtain the text embedding vector corresponding to each conversation text, thereby effectively improving the speech simulation effect.
[0098] In order to improve the speech simulation effect, the speech embedding vectors corresponding to the samples are obtained based on the speech training model and the speaker encoder in step 110, including:
[0099] Inputting the conversational speech in each of the samples into a pre-acquired speech training model, and outputting a conversational speech vector corresponding to each of the conversational speech;
[0100] Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications;
[0101] Each of the dialogue speech vectors is concatenated with the corresponding interlocutor identification vector to obtain a speech embedding vector corresponding to each of the dialogue speech.
[0102] Specifically, the client device inputs the conversational speech in each sample into a pre-acquired speech training model, and outputs the conversational speech vector corresponding to each conversational speech; then the interlocutor identification in each sample is input into the interlocutor encoder, and outputs the interlocutor identification vector corresponding to each interlocutor identification; finally, each conversational speech vector is concatenated with the corresponding interlocutor identification vector to obtain the speech embedding vector corresponding to each conversational speech, thereby effectively improving the speech simulation effect.
[0103] In order to improve the accuracy of speech synthesis, step 130 includes:
[0104] Inputting the target dialogue text into the prosodic language model to obtain a target dialogue prosodic vector;
[0105] Inputting the latent prosodic style vector into a preset attention mechanism module to obtain a target latent prosodic style vector;
[0106] The target dialogue prosody vector, the target latent prosody style vector and the target interlocutor identifier are added and normalized to obtain the latent prosody style vector sequence.
[0107] Specifically, the client device inputs the target dialogue text into the prosodic language model to obtain the target dialogue prosodic vector; then the latent prosodic style vector is input into the preset attention mechanism module (i.e. Figure 3 The target latent prosodic style vector is obtained by using the attention mechanism in the speech recognition algorithm; finally, the target dialogue prosodic vector, the target latent prosodic style vector and the target interlocutor identifier are added and normalized to obtain a latent prosodic style vector sequence, which can effectively improve the accuracy of speech synthesis.
[0108] In order to further improve the simulation effect of the voice, step 140 includes:
[0109] Step 141: Convert the target dialogue text into a corresponding phoneme sequence based on a phoneme converter.
[0110] Step 142: Input each of the historical dialogue text vectors and historical speech vectors, as well as the phoneme sequence and the latent prosodic style vector sequence into a text encoder to obtain a target text embedding sequence.
[0111] Step 143: Input the target text embedding sequence into a linear mapping layer to obtain a speech distribution sequence.
[0112] Step 144: Obtain the target synthesized speech corresponding to the speech distribution sequence based on the monotone alignment search algorithm, the decoder and the vocoder.
[0113] Specifically, the client device converts the target conversation text into a corresponding phoneme sequence based on a phoneme converter; then, each historical conversation text vector and historical speech vector, as well as the phoneme sequence and the latent prosodic style vector sequence are input into the text encoder to obtain a target text embedding sequence; then, the target text embedding sequence is input into the linear mapping layer to obtain a speech distribution sequence; finally, based on the monotone alignment search algorithm, decoder and vocoder, the target synthetic speech corresponding to the speech distribution sequence is obtained, thereby further improving the speech simulation effect.
[0114] In order to ensure the integrity of the target synthesized speech, step 144 includes:
[0115] Converting the target conversation speech into a Mel spectrum;
[0116] Expanding the speech distribution sequence into a Mel embedding vector sequence having the same length as the Mel spectrum based on a loss monotone alignment search algorithm;
[0117] Inputting the target speaker identifier into a speaker encoder to obtain a target speaker embedding vector;
[0118] Inputting the Mel embedding vector sequence and the target speaker embedding vector into a decoder to obtain a target Mel spectrum;
[0119] The target Mel spectrum is input into a lossy vocoder to obtain the target synthesized speech.
[0120] Specifically, the client device first converts the target conversation speech into a Mel spectrum; then, based on the lossy monotone alignment search algorithm, the speech distribution sequence is expanded into a Mel embedding vector sequence with the same length as the Mel spectrum; then, the target speaker identifier is input into the speaker encoder to obtain the target speaker embedding vector; then, the Mel embedding vector sequence and the target speaker embedding vector are input into the decoder to obtain the target Mel spectrum; finally, the target Mel spectrum is input into the lossy vocoder to obtain the target synthesized speech, thereby effectively ensuring the integrity of the target synthesized speech.
[0121] The present application also provides a speech synthesis method based on contrastive learning that can be executed by a client device, see Figure 4 The speech synthesis method based on contrastive learning specifically includes the following contents:
[0122] Step 210: Determine the dialogue text to be synthesized and the identifier of the dialogue party of the dialogue text to be synthesized from the current multi-person dialogue data record.
[0123] Step 220: Input the dialogue text to be synthesized and the interlocutor identification into the speech synthesis model trained by the aforementioned speech synthesis model training method based on contrastive learning, so as to output the synthesized speech corresponding to the dialogue text to be synthesized.
[0124] Specifically, the client device determines the dialogue text to be synthesized and the interlocutor identifier of the dialogue text to be synthesized from the current multi-person dialogue data record. Then, the dialogue text to be synthesized and the interlocutor identifier are input into the speech synthesis model trained by the speech synthesis model training method based on contrastive learning, so as to output the synthesized speech corresponding to the dialogue text to be synthesized, thereby effectively improving the authenticity of the simulated speech, and further improving the user experience in specific application scenarios such as human-computer dialogue.
[0125] From the software level, the present application also provides a speech synthesis model training device based on contrastive learning for executing all or part of the speech synthesis model training method based on contrastive learning, see Figure 2 The speech synthesis model training device based on contrastive learning specifically includes the following contents:
[0126] The sample encoding module 10 is used to obtain the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set based on the text training model and the interlocutor encoder, wherein each sample in the historical sample set is pre-selected from a conversation data set, each sample in the positive sample set is pre-selected from the historical sample set, and the negative sample set is pre-selected based on each sample in the positive sample set; each sample includes: conversation text, conversation speech and interlocutor identification; based on the speech training model and the interlocutor encoder, the speech embedding vectors corresponding to each sample are obtained;
[0127] A loss calculation module 20, used to calculate the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set based on a preset triple loss function;
[0128] A prosody calculation module 30, configured to obtain a latent prosody style vector sequence based on a target dialogue text, a target dialogue person identifier, a pre-acquired prosody language model and a preset latent prosody style vector, wherein the target dialogue text and the target dialogue person identifier and a target dialogue speech constitute a target sample, and the target sample is pre-selected from each sample in the historical sample set in the dialogue data set;
[0129] A speech synthesis module 40, configured to obtain a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech;
[0130] The model training module 50 is used to train a preset speech generator based on the target dialogue text, the target interlocutor identifier, samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting the dialogue text into dialogue speech.
[0131] The embodiment of the speech synthesis model training device based on contrastive learning provided in the present application can be specifically used to execute the processing flow of the embodiment of the speech synthesis model training method based on contrastive learning in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the embodiment of the speech synthesis model training method based on contrastive learning mentioned above.
[0132] The present application provides a speech synthesis model training device based on contrastive learning, and the method performed by the device includes: obtaining the text embedding vector and speech embedding vector corresponding to each sample in the historical sample set, positive sample set and negative sample set respectively based on the text training model and the interlocutor encoder; calculating the text loss and speech loss between each sample in the historical sample set, positive sample set and negative sample set respectively based on the preset triple loss function; obtaining a potential prosodic style vector sequence based on a target dialogue text, a target interlocutor identifier and a pre-acquired prosodic language model, and then obtaining the target synthesized speech; finally, training the preset speech generator based on the target dialogue text, the target interlocutor identifier, each sample and the target synthesized speech, and obtaining the speech synthesis model. The present application can effectively improve the authenticity of the simulated speech, and then improve the user experience of the user in specific application scenarios such as human-computer dialogue.
[0133] The embodiment of the present application also provides an electronic device, such as a central server, which may include a processor, a memory, a receiver and a transmitter, wherein the processor is used to execute the speech synthesis model training method based on contrastive learning or the speech synthesis method based on contrastive learning mentioned in the above embodiment, wherein the processor and the memory may be connected via a bus or other means, such as by bus connection. The receiver may be connected to the processor and the memory via wired or wireless means.
[0134] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0135] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the speech synthesis model training method based on contrastive learning or the program instructions / modules corresponding to the speech synthesis method based on contrastive learning in the embodiments of the present application. The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, realizing the speech synthesis model training method based on contrastive learning or the speech synthesis method based on contrastive learning in the above method embodiments.
[0136] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0137] The one or more modules are stored in the memory, and when executed by the processor, perform the speech synthesis model training method based on contrastive learning or the speech synthesis method based on contrastive learning in the embodiment.
[0138] In some embodiments of the present application, the user equipment may include a processor, a memory, and a transceiver unit, which may include a receiver and a transmitter. The processor, memory, receiver, and transmitter may be connected through a bus system. The memory is used to store computer instructions, and the processor is used to execute the computer instructions stored in the memory to control the transceiver unit to send and receive signals.
[0139] As an implementation method, the functions of the receiver and the transmitter in the present application can be considered to be implemented through a transceiver circuit or a dedicated chip for transceiver, and the processor can be considered to be implemented through a dedicated processing chip, a processing circuit or a general chip.
[0140] As another implementation method, it is possible to use a general-purpose computer to implement the server provided in the embodiment of the present application, that is, to store the program code for implementing the functions of the processor, receiver, and transmitter in a memory, and the general-purpose processor implements the functions of the processor, receiver, and transmitter by executing the code in the memory.
[0141] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the speech synthesis model training method based on contrastive learning or the speech synthesis method based on contrastive learning are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0142] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0143] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0144] In the present application, features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0145] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A speech synthesis model training method based on contrastive learning, characterized in that: include: Based on the text training model and the interlocutor encoder, the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set are obtained respectively, wherein each sample in the historical sample set is selected from a conversation data set in advance, each sample in the positive sample set is selected from the historical sample set in advance, and the negative sample set is selected in advance based on each sample in the positive sample set; each of the samples includes: conversation text, conversation speech and interlocutor identification; based on the speech training model and the interlocutor encoder, the speech embedding vectors corresponding to each of the samples are obtained respectively; Based on a preset triplet loss function, respectively calculating the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set; Obtaining a latent prosodic style vector sequence based on a target dialogue text, a target interlocutor identifier, a pre-acquired prosodic language model and a preset latent prosodic style vector, wherein the target dialogue text, the target interlocutor identifier and a target dialogue speech constitute a target sample, and the target sample is pre-selected after each sample in a historical sample set in the dialogue data set; Based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech, a target synthesized speech corresponding to the target dialogue text is obtained; the target dialogue text is converted into a corresponding phoneme sequence based on a phoneme converter, each historical dialogue text vector and historical speech vector, as well as the phoneme sequence and the latent prosodic style vector sequence are input into a text encoder to obtain a target text embedding sequence, the target text embedding sequence is input into a linear mapping layer to obtain a speech distribution sequence, and a target synthesized speech corresponding to the speech distribution sequence is obtained based on a monotone alignment search algorithm, a decoder and a vocoder; A preset speech generator is trained based on the target dialogue text, the target interlocutor identifier, samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting dialogue text into dialogue speech.
2. The speech synthesis model training method based on contrastive learning according to claim 1, characterized in that: The text-based training model and the dialog encoder respectively obtain text embedding vectors corresponding to each sample in the historical sample set, the positive sample set, and the negative sample set, including: Inputting the dialogue texts in each of the samples into the text training model, and outputting dialogue text vectors corresponding to each of the dialogue texts; Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications; Each of the dialogue text vectors is concatenated with the corresponding interlocutor identification vector to obtain a text embedding vector corresponding to each of the dialogue texts.
3. The speech synthesis model training method based on contrastive learning according to claim 1, characterized in that: The method of obtaining speech embedding vectors corresponding to the samples based on the speech training model and the speaker encoder includes: Inputting the conversational speech in each of the samples into a pre-acquired speech training model, and outputting a conversational speech vector corresponding to each of the conversational speech; Inputting the interlocutor identification in each of the samples into the interlocutor encoder, and outputting the interlocutor identification vector corresponding to each of the interlocutor identifications; Each of the dialogue speech vectors is concatenated with the corresponding interlocutor identification vector to obtain a speech embedding vector corresponding to each of the dialogue speech.
4. The speech synthesis model training method based on contrastive learning according to claim 1, characterized in that: The method of obtaining a latent prosodic style vector sequence based on a target dialogue text, a target dialogue person identifier, a pre-acquired prosodic language model and a preset latent prosodic style vector comprises: Inputting the target dialogue text into the prosodic language model to obtain a target dialogue prosodic vector; Inputting the latent prosodic style vector into a preset attention mechanism module to obtain a target latent prosodic style vector; The target dialogue prosody vector, the target latent prosody style vector and the target interlocutor identifier are added and normalized to obtain the latent prosody style vector sequence.
5. The speech synthesis model training method based on contrastive learning according to claim 1, characterized in that: The method of obtaining the target synthesized speech corresponding to the speech distribution sequence based on the monotone alignment search algorithm, the decoder and the vocoder includes: Converting the target conversation speech into a mel spectrum; Expanding the speech distribution sequence into a Mel embedding vector sequence having the same length as the Mel spectrum based on a loss monotone alignment search algorithm; Inputting the target speaker identifier into a speaker encoder to obtain a target speaker embedding vector; Inputting the Mel embedding vector sequence and the target speaker embedding vector into a decoder to obtain a target Mel spectrum; The target Mel spectrum is input into a lossy vocoder to obtain the target synthesized speech.
6. A speech synthesis method based on contrastive learning, characterized in that: include: Determining the dialogue text to be synthesized and the dialogue person identifier of the dialogue text to be synthesized from the current multi-person dialogue data record; The dialogue text to be synthesized and the interlocutor identification are input into the speech synthesis model trained by the speech synthesis model training method based on contrastive learning described in any one of claims 1-5 to output the synthesized speech corresponding to the dialogue text to be synthesized, and the speech synthesis method based on contrastive learning is executed by a client device.
7. A speech synthesis model training device based on contrastive learning, characterized in that: include: A sample encoding module, used for obtaining text embedding vectors corresponding to each sample in a historical sample set, a positive sample set and a negative sample set based on a text training model and a conversation person encoder, wherein each sample in the historical sample set is selected from a conversation data set in advance, each sample in the positive sample set is selected from the historical sample set in advance, and the negative sample set is selected based on each sample in advance in the positive sample set; each sample includes: conversation text, conversation speech and conversation person identification; based on the speech training model and the conversation person encoder, each speech embedding vector corresponding to each sample is obtained; A loss calculation module, used to calculate the text loss between the text embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set, and the speech loss between the speech embedding vectors corresponding to each sample in the historical sample set, the positive sample set and the negative sample set based on a preset triple loss function; a prosody calculation module, configured to obtain a latent prosody style vector sequence based on a target dialogue text, a target dialogue person identifier, a pre-acquired prosody language model and a preset latent prosody style vector, wherein the target dialogue text and the target dialogue person identifier and a target dialogue speech constitute a target sample, and the target sample is pre-selected from each sample in a historical sample set in the dialogue data set; A speech synthesis module is used to obtain a target synthesized speech corresponding to the target dialogue text based on the latent prosodic style vector sequence, the target dialogue text and the target dialogue speech; the target dialogue text is converted into a corresponding phoneme sequence based on a phoneme converter, each historical dialogue text vector and historical speech vector, as well as the phoneme sequence and the latent prosodic style vector sequence are input into a text encoder to obtain a target text embedding sequence, the target text embedding sequence is input into a linear mapping layer to obtain a speech distribution sequence, and a target synthesized speech corresponding to the speech distribution sequence is obtained based on a monotone alignment search algorithm, a decoder and a vocoder; A model training module is used to train a preset speech generator based on the target dialogue text, the target dialogue person identifier, samples in each historical sample set and the target synthesized speech. During the training process, the loss of the target synthesized speech is determined based on the target dialogue speech, and the speech generator is iteratively trained based on the loss, the text loss and the speech loss to obtain a speech synthesis model for converting the dialogue text into dialogue speech.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the speech synthesis model training method based on contrastive learning as described in any one of claims 1 to 5, or implements the speech synthesis method based on contrastive learning as described in claim 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the speech synthesis model training method based on contrastive learning as described in any one of claims 1 to 5, or implements the speech synthesis method based on contrastive learning as described in claim 6.
