Speech synthesis model training method, speech synthesis method, speech synthesis device and medium
By jointly training multiple modules in the speech synthesis model, the training steps are simplified, the cumulative error is reduced, the training efficiency and accuracy are improved, and the problems of training complexity and low efficiency in the existing technology are solved.
Patent Information
- Application Number
- CN202411060993.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-10-11
AI Technical Summary
In existing speech synthesis technology, the two-stage training method results in low model training efficiency and accuracy, and the training process is complex and the cumulative error is large.
The joint training method is used to integrate the language model, encoding module and decoding module in the speech synthesis model. Parameters are updated through the difference and quantification loss between the encoding sequence and the decoding sequence to simplify the training steps and reduce the cumulative error.
It improves the training efficiency and accuracy of the speech synthesis model, simplifies the training process, and improves the accuracy of speech synthesis for any text.
Smart Images

Figure CN118762684A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a training method for a speech synthesis model, a speech synthesis method, a device and a medium. Background Art
[0002] Speech synthesis technology refers to the technology that converts text sequences into natural and realistic speech waveforms. Speech synthesis technology is widely used in scenarios such as voice navigation and smart home. Speech synthesis technology is usually implemented with the help of language models. For example, in a voice navigation system, the input text is processed by a language model to output a fluent and natural navigation voice.
[0003] In the related art, a two-stage training method is usually used to train a language model. Specifically, the encoder is first pre-trained to encode the sample audio into a discrete code sequence (such as a token sequence) through the pre-trained encoder. Then, the language model is trained with the sample text corresponding to the sample audio and the above-mentioned code sequence, so that the language model can predict the code sequence based on the input text. Then, the decoder synthesizes the audio based on the predicted code sequence.
[0004] However, the above training method requires training the encoder first and then training the language model. The training process is relatively complicated and the cumulative error of training is large, resulting in low efficiency and accuracy of model training. Summary of the invention
[0005] The present disclosure provides a training method, a speech synthesis method, a device and a medium for a speech synthesis model, which can jointly train multiple modules in the speech synthesis model, simplify the training steps, reduce the cumulative error in the training process, improve the efficiency and accuracy of training the speech synthesis model, and improve the accuracy of speech synthesis of any text through the speech synthesis model. The technical solution of the present disclosure is as follows:
[0006] According to one aspect of an embodiment of the present disclosure, a method for training a speech synthesis model is provided, wherein a first speech synthesis model includes a language model, an encoding module, and a decoding module, wherein the language model is used to predict a coding sequence corresponding to an input text, the encoding module is used to encode an input audio into a coding sequence, and the decoding module is used to reconstruct the audio based on the coding sequence; the method includes:
[0007] The sample audio is encoded by the encoding module to obtain a first encoding sequence, the sample text is processed by the language model to obtain a second encoding sequence, and the first encoding sequence is processed by the decoding module to obtain a target audio, wherein the content of the sample text is consistent with the content of the sample audio;
[0008] Based on the first coding sequence and the second coding sequence, determining a first training loss, where the first training loss is used to represent a degree of difference between the first coding sequence and the second coding sequence;
[0009] Based on the sample audio and the target audio, determining a second training loss, wherein the second training loss is used to represent a degree of difference between the sample audio and the target audio;
[0010] Based on the first training loss, the second training loss and the third training loss, the first speech synthesis model is trained to obtain a second speech synthesis model, and the third training loss is a quantization loss generated during the encoding process.
[0011] In some embodiments, encoding the sample audio through the encoding module to obtain a first encoding sequence includes: encoding the Mel-spectrogram of the sample audio through the encoder in the encoding module to obtain an audio feature vector; and quantizing multiple rows of sub-feature vectors in the audio feature vector through the quantizer in the encoding module to obtain multiple encoding values in the first encoding sequence, and the multiple encoding values correspond one-to-one to the multiple rows of sub-feature vectors.
[0012] In some embodiments, the quantizer in the encoding module quantizes multiple rows of sub-feature vectors in the audio feature vector respectively to obtain multiple coding values in the first coding sequence, including: for any sub-feature vector, determining the similarity between the sub-feature vector and multiple codebook vectors through the quantizer, and the codebook vector is used to represent the reference audio feature; and quantizing the sub-feature vector into a coding value corresponding to a target codebook vector through the quantizer, and the target codebook vector is a codebook vector with the highest similarity to the sub-feature vector among the multiple codebook vectors.
[0013] In some embodiments, the process of determining the third training loss includes: for any sub-feature vector, based on the similarity between the sub-feature vector and the target codebook vector corresponding to the sub-feature vector, determining the quantization loss of the sub-feature vector, wherein the quantization loss is negatively correlated with the similarity; and determining the weighted sum of the quantization losses of the multiple rows of sub-feature vectors as the third training loss.
[0014] In some embodiments, the processing of the sample text through the language model to obtain the second encoding sequence includes: obtaining a phoneme sequence of the sample text, the phoneme sequence including phonemes of multiple keywords in the sample text; and processing the phoneme sequence through the language model to obtain the second encoding sequence.
[0015] In some embodiments, obtaining the phoneme sequence of the sample text includes: preprocessing the sample text, the preprocessing including at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on a phoneme dictionary, converting the preprocessed sample text into the phoneme sequence, the phoneme dictionary being used to record the correspondence between keywords and phonemes.
[0016] In some embodiments, the first training loss is a cross entropy loss, and the process of determining the first training loss includes: processing the first encoding sequence and the second encoding sequence based on a cross entropy loss function to obtain the first training loss.
[0017] In some embodiments, the processing of the first coding sequence by the decoding module to obtain the target audio includes: deconvolving the first coding sequence by a decoder in the decoding module to obtain a Mel-spectrogram of the target audio; reconstructing audio based on the Mel-spectrogram by a vocoder in the decoding module to obtain the target audio, and the vocoder is used to reconstruct audio based on the Mel-spectrogram.
[0018] In some embodiments, the second training loss is a mean square error loss, and the process of determining the second training loss includes: based on a mean square error loss function, determining the mean square error between the Mel-spectrogram of the target audio and the Mel-spectrogram of the sample audio as the second training loss.
[0019] In some embodiments, the first speech synthesis model is trained based on the first training loss, the second training loss and the third training loss to obtain the second speech synthesis model, including: determining a total training loss, where the total training loss is a weighted sum of the first training loss, the second training loss and the third training loss; and based on the total training loss, updating the parameters of the first speech synthesis model through a back propagation algorithm to obtain the second speech synthesis model.
[0020] According to one aspect of an embodiment of the present disclosure, a speech synthesis method is provided, the method comprising:
[0021] Acquire a phoneme sequence of an input text, wherein the input text is a text to be subjected to speech synthesis, and the phoneme sequence includes phonemes of a plurality of keywords in the input text;
[0022] Processing the phoneme sequence by a language model in a second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence, wherein the second speech synthesis model is trained based on the training method of the speech synthesis model;
[0023] The output audio is generated based on the coding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model, and the decoding module is used to reconstruct the audio based on the coding sequence.
[0024] In some embodiments, obtaining the phoneme sequence of the input text includes preprocessing the input text, wherein the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on a phoneme dictionary, converting the preprocessed input text into the phoneme sequence, wherein the phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0025] In some embodiments, generating output audio based on the encoding sequence corresponding to the phoneme sequence by a decoding module in the second speech synthesis model includes:
[0026] Deconvolving the encoded sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the output audio;
[0027] The output audio is obtained by performing audio reconstruction based on the mel-spectrogram through a vocoder in the decoding module.
[0028] According to another aspect of an embodiment of the present disclosure, a training device for a speech synthesis model is provided, wherein the first speech synthesis model includes a language model, an encoding module, and a decoding module, wherein the language model is used to predict a coding sequence corresponding to an input text, the encoding module is used to encode an input audio into a coding sequence, and the decoding module is used to reconstruct the audio based on the coding sequence; the device includes:
[0029] a processing unit configured to encode the sample audio through the encoding module to obtain a first encoding sequence, process the sample text through the language model to obtain a second encoding sequence, and process the first encoding sequence through the decoding module to obtain a target audio, wherein the content of the sample text is consistent with the content of the sample audio;
[0030] a determining unit configured to determine a first training loss based on the first coding sequence and the second coding sequence, wherein the first training loss is used to represent a degree of difference between the first coding sequence and the second coding sequence;
[0031] The determining unit is further configured to determine a second training loss based on the sample audio and the target audio, wherein the second training loss is used to represent a degree of difference between the sample audio and the target audio;
[0032] The training unit is configured to train the first speech synthesis model based on the first training loss, the second training loss and the third training loss to obtain the second speech synthesis model, wherein the third training loss is the quantization loss generated during the encoding process.
[0033] In some embodiments, the processing unit includes:
[0034] The encoding subunit is configured to encode the Mel-spectrogram of the sample audio through the encoder in the encoding module to obtain an audio feature vector;
[0035] The quantization subunit is configured to quantize the multiple rows of sub-feature vectors in the audio feature vector respectively through the quantizer in the encoding module to obtain multiple encoding values in the first encoding sequence, and the multiple encoding values correspond to the multiple rows of sub-feature vectors one by one.
[0036] In some embodiments, the quantization subunit is configured to:
[0037] For any sub-feature vector, determining, by the quantizer, a similarity between the sub-feature vector and a plurality of codebook vectors, wherein the codebook vectors are used to represent reference audio features;
[0038] The sub-feature vector is quantized into a coding value corresponding to a target codebook vector by the quantizer, and the target codebook vector is a codebook vector with the highest similarity to the sub-feature vector among the multiple codebook vectors.
[0039] In some embodiments, the determination unit is further configured to determine, for any sub-feature vector, a quantization loss of the sub-feature vector based on a similarity between the sub-feature vector and a target codebook vector corresponding to the sub-feature vector, wherein the quantization loss is negatively correlated with the similarity; and determine a weighted sum of the quantization losses of the multiple rows of sub-feature vectors as the third training loss.
[0040] In some embodiments, the processing unit includes:
[0041] The prediction subunit is configured to obtain a phoneme sequence of the sample text, wherein the phoneme sequence includes phonemes of multiple keywords in the sample text; and process the phoneme sequence through the language model to obtain the second encoding sequence.
[0042] In some embodiments, the prediction subunit is configured to preprocess the sample text, wherein the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on a phoneme dictionary, the preprocessed sample text is converted into the phoneme sequence, and the phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0043] In some embodiments, the first training loss is a cross entropy loss, and the determining unit is configured to process the first encoding sequence and the second encoding sequence based on a cross entropy loss function to obtain the second training loss.
[0044] In some embodiments, the processing unit includes:
[0045] The decoding subunit is configured to deconvolve the first coding sequence through the decoder in the decoding module to obtain a Mel-spectrogram of the target audio; and reconstruct the audio based on the Mel-spectrogram through the vocoder in the decoding module to obtain the target audio, wherein the vocoder is used to reconstruct the audio according to the Mel-spectrogram.
[0046] In some embodiments, the second training loss is a mean square error loss, and the determination unit is configured to determine the mean square error between the Mel-spectrogram of the target audio and the Mel-spectrogram of the sample audio as the second training loss based on a mean square error loss function.
[0047] In some embodiments, the training unit is configured to determine a total training loss, which is a weighted sum of the first training loss, the second training loss, and the third training loss; based on the total training loss, the parameters of the first speech synthesis model are updated through a back-propagation algorithm to obtain the second speech synthesis model.
[0048] According to another aspect of an embodiment of the present disclosure, a speech synthesis device is provided, the device comprising:
[0049] An acquisition unit is configured to acquire a phoneme sequence of an input text, wherein the input text is a text to be subjected to speech synthesis, and the phoneme sequence includes phonemes of a plurality of keywords in the input text;
[0050] A prediction unit is configured to process the phoneme sequence through a language model in a second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence, wherein the second speech synthesis model is trained based on the training method of the speech synthesis model;
[0051] The decoding unit is configured to generate output audio based on the encoding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model.
[0052] In some embodiments, the acquisition unit is configured to preprocess the input text, and the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on a phoneme dictionary, the preprocessed input text is converted into the phoneme sequence, and the phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0053] In some embodiments, the decoding unit is configured to deconvolve the encoded sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the output audio; and reconstruct audio based on the Mel-spectrogram through a vocoder in the decoding module to obtain the output audio.
[0054] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device comprising:
[0055] one or more processors;
[0056] A memory for storing program codes executable by the processor;
[0057] Among them, the processor is configured to execute the program code to implement the training method of the above-mentioned speech synthesis model, or to implement the above-mentioned speech synthesis method.
[0058] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to execute the above-mentioned training method of the speech synthesis model, or execute the above-mentioned speech synthesis method.
[0059] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the training method of the above-mentioned speech synthesis model, or implements the above-mentioned speech synthesis method.
[0060] The disclosed embodiment provides a training scheme for a speech synthesis model, which can jointly train the language model, encoding module, and decoding module in the speech synthesis model based on sample audio and sample text with consistent content. Compared with the multi-stage training method, the joint training method can integrate the training processes of multiple modules in the speech synthesis model together, thereby simplifying the training steps, reducing the cumulative error in the training process, and improving the efficiency and accuracy of training the speech synthesis model.
[0061] 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
[0062] 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.
[0063] Figure 1 The figure is a schematic diagram of an implementation environment according to an exemplary embodiment.
[0064] Figure 2 The present invention is a flowchart of a method for training a speech synthesis model according to an exemplary embodiment.
[0065] Figure 3 The present invention is a flowchart of another method for training a speech synthesis model according to an exemplary embodiment.
[0066] Figure 4 It is a schematic diagram of a training process of a speech synthesis model according to an exemplary embodiment.
[0067] Figure 5 The figure is a flow chart of a speech synthesis method according to an exemplary embodiment.
[0068] Figure 6 It is a schematic diagram showing a speech synthesis process according to an exemplary embodiment.
[0069] Figure 7 It is a block diagram of a training device for a speech synthesis model according to an exemplary embodiment.
[0070] Figure 8 It is a block diagram of another apparatus for training a speech synthesis model according to an exemplary embodiment.
[0071] Fig. 9 The invention is a block diagram of a speech synthesis device according to an exemplary embodiment.
[0072] Fig.10 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0073] 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.
[0074] 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.
[0075] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the sample text, sample audio, input text, etc. involved in this disclosure are all obtained with full authorization.
[0076] Figure 1 FIG. 1 is a schematic diagram of an implementation environment according to an exemplary embodiment. Figure 1 The implementation environment specifically includes: a terminal 101 and a server 102. The terminal 101 can be connected to the server 102 via a wireless network or a wired network.
[0077] Terminal 101 can be at least one of a smart phone, a smart watch, a desktop computer, a laptop, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, and a laptop computer. A target application is installed or running on terminal 101. The target application is any type of application, such as a video application, a social application, a navigation application, or a voice assistant. For example, when the target application is a voice assistant, the user can interact with the voice assistant through terminal 101. Accordingly, the voice assistant can understand the questions input by the user, generate answer text for the questions, and convert the answer text into answer audio through speech synthesis technology to play the answer audio to the user. The target application is associated with server 102, and server 102 provides background services.
[0078] Optionally, the terminal 101 may generally refer to one of a plurality of terminals. This embodiment is described by taking the terminal 101 as an example. Those skilled in the art may know that the number of the above terminals may be more or less. For example, the above terminals may be several, or the above terminals may be dozens or hundreds, or a greater number. The embodiment of the present disclosure does not limit the number and device type of the terminals.
[0079] In some embodiments, the server 102 is at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Optionally, the number of the above servers may be more or less, which is not limited in the embodiments of the present disclosure. Of course, the server 102 may also include other functional servers to provide more comprehensive and diversified services. In some embodiments, the server 102 undertakes the main computing work, and the terminal 101 undertakes the secondary computing work; or, the server 102 undertakes the secondary computing work, and the terminal 101 undertakes the main computing work; or, the server 102 and the terminal 101 use a distributed computing architecture for collaborative computing. The server 102 can be connected to the terminal 101 and other terminals via a wireless network or a wired network. Optionally, the number of the above servers may be more or less, which is not limited in the embodiments of the present disclosure.
[0080] Figure 2 is a flowchart of a method for training a speech synthesis model according to an exemplary embodiment. Figure 2 As shown, the method is performed by an electronic device and includes the following steps:
[0081] In step S201, the sample audio is encoded by the encoding module in the first speech synthesis model to obtain a first encoding sequence, the sample text is processed by the language model in the first speech synthesis model to obtain a second encoding sequence, and the first encoding sequence is processed by the decoding module in the first speech synthesis model to obtain the target audio.
[0082] In the disclosed embodiment, the first speech synthesis model is a speech synthesis model to be trained. The first speech synthesis model is used for speech synthesis. Speech synthesis technology refers to the technology of converting text into natural and realistic audio. The first speech synthesis model includes a language model, an encoding module and a decoding module. Among them, the language model is used to predict the encoding sequence corresponding to the input text; the encoding module is used to encode the input audio into the encoding sequence; the decoding module is used to reconstruct the audio based on the encoding sequence.
[0083] Among them, a coding sequence refers to a text sequence composed of multiple coding values. For example, a coding sequence is a discrete token sequence. A token sequence refers to a text sequence composed of multiple tokens. Token is the basic unit in natural language processing. A token can be a Chinese character, a word, a punctuation mark, a number, or other special characters. For example, when a coding sequence is a token sequence, a token in the coding sequence is a digital coding value.
[0084] The electronic device inputs the sample audio into the encoding module in the speech synthesis model to encode the sample audio through the encoding module to obtain a first encoding sequence. The multiple encoding values in the first encoding sequence can reflect the audio characteristics of the sample audio. The first training loss is the quantization loss generated by the encoding module during the above encoding process.
[0085] The electronic device inputs the sample text corresponding to the sample audio into the language model in the speech synthesis model to predict the second coding sequence corresponding to the sample text through the language model. The content of the sample text is consistent with the content of the sample audio. Optionally, the sample text is obtained by performing speech-to-text processing on the sample audio. The second coding sequence can also be referred to as a coding sequence predicted by the language model, and the first coding sequence can also be referred to as a true coding sequence.
[0086] The electronic device inputs the first coding sequence into a decoding module in the speech synthesis model, so that the decoding module performs audio reconstruction according to the first coding sequence to obtain target audio, wherein the content of the target audio is the same as that of the sample audio.
[0087] In step S202, a first training loss is determined based on the first encoding sequence and the second encoding sequence.
[0088] In the disclosed embodiment, the first training loss is used to represent the degree of difference between the first coding sequence and the second coding sequence. The larger the first training loss, the greater the degree of difference between the first coding sequence and the second coding sequence; the smaller the first training loss, the smaller the degree of difference between the first coding sequence and the second coding sequence.
[0089] In step S203, a second training loss is determined based on the sample audio and the target audio.
[0090] In the disclosed embodiment, the second training loss is used to represent the degree of difference between the sample audio and the target audio. The larger the second training loss, the greater the degree of difference between the sample audio and the target audio; the smaller the second training loss, the smaller the degree of difference between the sample audio and the target audio.
[0091] In step S203, the first speech synthesis model is trained based on the first training loss, the second training loss and the third training loss to obtain a second speech synthesis model.
[0092] In the disclosed embodiment, the third training loss is a quantization loss generated during the encoding process of the electronic device through the encoding module. The electronic device updates the parameters of the first speech synthesis model in a multi-round iteration manner according to the first training loss, the second training loss and the third training loss, until the second speech synthesis model obtained after the parameter update meets the end training condition. The end training condition includes but is not limited to at least one of the following: the total training loss is less than a preset threshold, the number of iterations reaches a preset number, etc.
[0093] The disclosed embodiment provides a method for training a speech synthesis model, which can jointly train the language model, encoding module, and decoding module in the speech synthesis model based on sample audio and sample text with consistent content. Compared with the multi-stage training method, the joint training method can integrate the training processes of multiple modules in the speech synthesis model together, thereby simplifying the training steps, reducing the cumulative error in the training process, and improving the efficiency and accuracy of training the speech synthesis model.
[0094] In some embodiments, encoding the sample audio by an encoding module to obtain a first encoding sequence includes:
[0095] The Mel-spectrogram of the sample audio is encoded by an encoder in the encoding module to obtain an audio feature vector;
[0096] The multiple rows of sub-feature vectors in the audio feature vector are quantized respectively by a quantizer in the encoding module to obtain multiple encoding values in the first encoding sequence, and the multiple encoding values correspond to the multiple rows of sub-feature vectors one by one.
[0097] In the disclosed embodiment, by using the encoder and quantizer in the encoding module, the Mel-spectrogram features of the sample audio can be quantized into a discrete coding sequence relatively quickly, while ensuring that the multiple coding values in the coding sequence can reflect the audio features of the sample audio, thereby improving the coding efficiency and accuracy.
[0098] In some embodiments, a quantizer in the encoding module quantizes multiple rows of sub-feature vectors in the audio feature vector respectively to obtain multiple encoding values in the first encoding sequence, including:
[0099] For any sub-feature vector, a similarity between the sub-feature vector and a plurality of codebook vectors is determined by a quantizer, where the codebook vectors are used to represent reference audio features;
[0100] The sub-feature vector is quantized into a coding value corresponding to a target codebook vector through a quantizer, and the target codebook vector is a codebook vector with the highest similarity to the sub-feature vector among multiple codebook vectors.
[0101] In the embodiment of the present disclosure, since the similarity between the target codebook vector and the sub-feature vector is the highest, by quantizing the sub-feature vector into the coding value corresponding to the target codebook vector, the coding value in the first coding sequence can effectively characterize the audio characteristics of the sample audio, thereby improving the coding accuracy.
[0102] In some embodiments, the process of determining the third training loss includes:
[0103] For any sub-feature vector, based on the similarity between the sub-feature vector and the target codebook vector corresponding to the sub-feature vector, the quantization loss of the sub-feature vector is determined, and the quantization loss is negatively correlated with the similarity;
[0104] The weighted sum of the quantization losses of multiple rows of sub-feature vectors is determined as the third training loss.
[0105] In the disclosed embodiment, since the quantizer can quantize the sub-feature vector into a target codebook vector, by determining the third training loss based on the similarity between the sub-feature vector and the target codebook vector, the third training loss can more accurately reflect the error generated in the process of quantizing the sub-feature vector, thereby improving the accuracy of the third training loss.
[0106] In some embodiments, the sample text is processed by a language model to obtain a second encoding sequence, including:
[0107] Acquire a phoneme sequence of a sample text, where the phoneme sequence includes phonemes of multiple keywords in the sample text;
[0108] The phoneme sequence is processed through the language model to obtain a second encoding sequence.
[0109] In the disclosed embodiment, by inputting the phoneme sequence of the sample into the language model, the language model can be trained to have the ability to predict the coding sequence based on the phoneme sequence, thereby improving the accuracy of the language model in predicting the coding sequence.
[0110] In some embodiments, obtaining a phoneme sequence of a sample text includes:
[0111] Preprocessing the sample text, the preprocessing including at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic character pronunciation tagging;
[0112] Based on the phoneme dictionary, the preprocessed sample text is converted into a phoneme sequence. The phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0113] In the embodiment of the present disclosure, by preprocessing the sample text, at least one of the content and pronunciation of the sample text can be standardized, so that the sample text can be converted into a phoneme sequence more accurately, thereby improving the accuracy of the phoneme sequence.
[0114] In some embodiments, the first training loss is a cross entropy loss, and the process of determining the first training loss includes:
[0115] Based on the cross entropy loss function, the first encoding sequence and the second encoding sequence are processed to obtain a first training loss.
[0116] In the embodiment of the present disclosure, by determining the cross entropy loss between the first coding sequence and the second coding sequence as the first training loss of the speech synthesis model, the first training loss can accurately reflect the difference between the coding sequence predicted by the language model and the actual coding sequence, thereby improving the accuracy and efficiency of training the speech synthesis model through the first training loss.
[0117] In some embodiments, the first coding sequence is processed by a decoding module to obtain a target audio, including:
[0118] Deconvolving the first encoding sequence through a decoder in a decoding module to obtain a Mel-spectrogram of the target audio;
[0119] The target audio is obtained by reconstructing the audio based on the Mel-spectrogram through the vocoder in the decoding module. The vocoder is used to reconstruct the audio based on the Mel-spectrogram.
[0120] In the disclosed embodiment, by performing audio reconstruction according to the decoder and vocoder in the decoding module, the decoder can have the ability to restore a low-dimensional coding sequence into a high-dimensional Mel-spectrogram, which is beneficial to improving the accuracy and efficiency of audio reconstruction according to the decoding module.
[0121] In some embodiments, the second training loss is a mean square error loss, and the process of determining the second training loss includes:
[0122] Based on the mean square error loss function, the mean square error between the mel spectrogram of the target audio and the mel spectrogram of the sample audio is determined as the second training loss.
[0123] In the embodiment of the present disclosure, by determining the mean square error loss between the sample audio and the target audio as the second training loss of the speech synthesis model, the second training loss can accurately reflect the difference between the target audio and the sample audio synthesized by the speech synthesis model, thereby improving the accuracy and efficiency of training the speech synthesis model through the second training loss.
[0124] In some embodiments, training a speech synthesis model based on the first training loss, the second training loss, and the third training loss includes:
[0125] Determine the total training loss, which is the weighted sum of the first training loss, the second training loss, and the third training loss;
[0126] Based on the total training loss, the parameters of the first speech synthesis model are updated through the back propagation algorithm to obtain the second speech synthesis model.
[0127] In the embodiment of the present disclosure, by jointly training multiple modules in the speech synthesis model according to the total training loss, the training processes of the multiple modules in the speech synthesis model can be integrated together, thereby simplifying the training steps of the speech synthesis model, reducing the cumulative error in the training process, and improving the efficiency and accuracy of training the speech synthesis model.
[0128] Above Figure 2 The figure shows a process of a training method of a speech synthesis model of the present disclosure. The training method of the speech synthesis model provided by the present disclosure is further described below. Figure 3 is a flowchart of another method for training a speech synthesis model according to an exemplary embodiment, the method being executed by an electronic device, see Figure 3 , the method comprising:
[0129] In step S301, the sample audio is encoded by the encoding module in the first speech synthesis model to obtain a first encoding sequence.
[0130] In the embodiment of the present disclosure, the first speech synthesis model is a speech synthesis model to be trained. The first speech synthesis model is used for speech synthesis. Speech synthesis technology refers to the technology of converting text into natural and realistic speech. The speech synthesis model can convert any text into audio while ensuring that the content of the audio is consistent with the content of the text.
[0131] The first speech synthesis model includes a language model, an encoding module and a decoding module. The language model is used to predict the encoding sequence corresponding to the input text. The input text is the text to be speech synthesized. The encoding module is used to encode the input audio into the encoding sequence. The decoding module is used to reconstruct the audio based on the encoding sequence. For example, the decoding module can reconstruct the target audio based on the encoding sequence predicted by the speech model.
[0132] In some embodiments, a coding sequence refers to a text sequence consisting of multiple coding values. For example, the coding sequence is a discrete token sequence. A token sequence refers to a text sequence consisting of multiple tokens. A token is a basic unit in natural language processing. A token can be a Chinese character, a word, a punctuation mark, a number, or other special character. For example, in the case where the coding sequence is a token sequence, the token in the coding sequence is a coding value in digital form.
[0133] In the process of training the first speech synthesis model, the electronic device inputs the sample audio into the first speech synthesis model, and encodes the sample audio through the encoding module in the first speech synthesis model to obtain a first encoding sequence. Among them, the multiple encoding values in the first encoding sequence can reflect the audio features of the sample audio, such as at least one of the content features, frequency features, pitch features, timbre features, etc.
[0134] In some embodiments, the encoding module includes an encoder and a quantizer. The encoder is used to encode the sample audio into a continuous feature vector, and the quantizer is used to quantize the continuous feature vector into a discrete code sequence. The following steps (1)-(2) illustrate the process of an electronic device encoding the sample audio into a first code sequence through the encoder and the quantizer.
[0135] (1) The electronic device encodes the Mel-spectrogram of the sample audio through an encoder in the encoding module to obtain an audio feature vector.
[0136] Among them, the Mel-spectrogram is used to reflect the relationship between the frequency of the sample audio and time. The Mel-spectrogram is usually converted from the spectrogram. For example, the Mel-spectrogram can be obtained by mapping the ordinate (frequency) of the spectrogram of the sample audio to the Mel scale. The horizontal axis of the Mel-spectrogram is time, and the vertical axis is the Mel frequency. Since the above transformation conforms to the human ear's perception characteristics of sounds of different frequencies, the resolution of the low-frequency part in the Mel-spectrogram is relatively high, and the resolution of the high-frequency part is relatively low, so that the Mel-spectrogram can more accurately reflect the sensitivity of the human ear to sounds of different frequencies.
[0137] For example, the encoder in the encoding module is VQ-VAE (Vector Quantized-VariationalAutoEncoder). Through VQ-VAE, the electronic device can encode 100 frames of 80-dimensional Mel-spectrograms into 25*512-dimensional audio feature vectors. Among them, 100 frames are used to indicate that the Mel-spectrogram has 100 sampling points in the time dimension, and 80 dimensions are used to indicate that the Mel-spectrogram has 80 sampling points in the Mel-frequency dimension. The above 25*512-dimensional audio feature vector includes 25 rows of sub-feature vectors. The dimension of each sub-feature vector is 512 dimensions.
[0138] In some embodiments, the electronic device can extract the Mel spectrogram of the sample audio through an audio processing tool. For example, the electronic device extracts the Mel spectrogram of the sample audio through the Librosa audio processing library. Then, the electronic device inputs the Mel spectrogram of the sample audio into an encoder in the first speech synthesis model to encode the Mel spectrogram into an audio feature vector through the encoder.
[0139] (2) The electronic device quantizes the multiple rows of sub-feature vectors in the audio feature vector through a quantizer in the encoding module to obtain multiple encoding values in the first encoding sequence, wherein the multiple encoding values correspond to the multiple rows of sub-feature vectors one by one.
[0140] By using the encoder and quantizer in the encoding module, the Mel-spectrogram features of the sample audio can be quantized into a discrete encoding sequence relatively quickly, while ensuring that multiple encoding values in the encoding sequence can reflect the audio features of the sample audio, thereby improving the encoding efficiency and accuracy.
[0141] For example, the electronic device can quantize the 25 rows of sub-feature vectors respectively through a quantizer to obtain 25 code values in the first code sequence.
[0142] In some embodiments, the electronic device can quantize any sub-feature vector into a code value corresponding to the codebook vector most similar to it through a quantizer. The quantization process of the above sub-feature vector is described below through the following steps (a)-(b).
[0143] (a) For any sub-feature vector, the electronic device determines the similarity between the sub-feature vector and multiple codebook vectors through a quantizer. Among them, multiple codebook vectors are usually a group of representative vectors selected or clustered from a large-scale audio feature set. The codebook vector is used to represent the reference audio feature, such as at least one of the reference content feature, frequency feature, pitch feature, timbre feature and other features. Optionally, the electronic device can determine the distance between the sub-feature vector and the codebook vector through a quantizer to determine the similarity between the sub-feature vector and the codebook vector. Among them, the similarity between vectors is negatively correlated with the distance between the vectors. Optionally, the distance between vectors can be any one of cosine distance, Euclidean distance, Manhattan distance, and Chebyshev distance, which is not limited in the embodiments of the present disclosure.
[0144] It should be noted that the above-mentioned multiple codebook vectors correspond to different coding values. For example, the coding values corresponding to the above-mentioned multiple codebook vectors are 0, 1, 2, 3, 4, 5, 6, 7, 8, etc.
[0145] (b) The electronic device quantizes the sub-feature vector into a coding value corresponding to the target codebook vector through a quantizer. The target codebook vector is the codebook vector with the highest similarity to the sub-feature vector among the multiple codebook vectors. Since the target codebook vector has the highest similarity to the sub-feature vector, by quantizing the sub-feature vector into the coding value corresponding to the target codebook vector, the coding value in the first coding sequence can effectively represent the audio characteristics of the sample audio, thereby improving the coding accuracy.
[0146] In some embodiments, the electronic device can also determine the third training loss, that is, the quantization loss generated during the encoding process, based on the similarity between the sub-feature vector and the codebook vector. For any sub-feature vector, the electronic device determines the quantization loss of the sub-feature vector based on the similarity between the sub-feature vector and the target codebook vector corresponding to the sub-feature vector. Among them, the quantization loss of the sub-feature vector is negatively correlated with the above similarity. In other words, the higher the similarity between the sub-feature vector and the corresponding target codebook vector, the lower the quantization loss of the sub-feature vector. Then, the electronic device performs weighted summation of the quantization losses of the multiple rows of sub-feature vectors in the audio feature vector to obtain the third training loss. Among them, the weights of the above multiple rows of sub-feature vectors can be set according to actual needs, such as all set to 1, and the embodiment of the present disclosure does not limit the weight of each sub-feature vector. Since the quantizer can quantize the sub-feature vector into a target codebook vector, by determining the third training loss based on the similarity between the sub-feature vector and the target codebook vector, the third training loss can be more accurately reflected in the error generated in the process of quantizing the sub-feature vector, thereby improving the accuracy of the third training loss.
[0147] In step S302, the sample text is processed by the language model in the first speech synthesis model to obtain a second encoding sequence.
[0148] In an embodiment of the present disclosure, an electronic device obtains a sample text corresponding to a sample audio. The content of the sample text is consistent with the content of the sample audio. Optionally, the sample text can be obtained by performing speech-to-text processing on the sample audio. Then, the electronic device inputs the sample text into a first speech synthesis model to predict a second coding sequence corresponding to the sample text through a language model in the first speech synthesis model. The second coding sequence can reflect the content characteristics of the sample text. Therefore, the second coding sequence can be referred to as a predicted coding sequence. The above-mentioned first coding sequence can be referred to as a true coding sequence.
[0149] In some embodiments, the language model is a neural network model of the Transformer architecture. Since the Transformer architecture has a relatively powerful sequence modeling capability, the second coding sequence can be predicted quickly and accurately by using the language model of the Transformer architecture. In addition, the language model can be an autoregressive model (such as a GPT-generative pre-trained Transformer model) or a non-autoregressive model (such as a diffusion model). By selecting a language model with an autoregressive structure for training, the cumulative error problem in the existing method can be alleviated to a certain extent. By selecting a language model with a non-autoregressive structure for training, the speed and stability of the model in generating coding sequences can be improved. Technicians can select a language model of appropriate structure according to actual needs.
[0150] In some embodiments, the language model can predict the second coding sequence based on the phoneme sequence. Accordingly, the electronic device obtains the phoneme sequence of the sample text, wherein the phoneme sequence includes the phonemes of multiple keywords in the sample text. The phoneme sequence can represent the text content of the sample text. For example, in the case where the sample text contains the keyword "Mandarin", the phoneme sequence includes the 8 phonemes of the keyword "p, u, t, o, ng, h, u, a". Then, the electronic device inputs the phoneme sequence of the sample text into the language model to process the phoneme sequence through the language model to predict the second coding sequence. By inputting the phoneme sequence of the sample into the language model, the language model can be trained to have the ability to predict the coding sequence based on the phoneme sequence, thereby improving the accuracy of the language model in predicting the coding sequence.
[0151] In some embodiments, the electronic device can convert the sample text into a phoneme sequence according to a phoneme dictionary. After the electronic device obtains the sample text, the electronic device preprocesses the sample text. Among them, the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging. Then, the electronic device converts the preprocessed sample text into a phoneme sequence according to the phoneme dictionary. Among them, the phoneme dictionary is used to record the correspondence between keywords and phonemes. For example, the electronic device can determine the phonemes of each keyword in the sample text according to the phoneme dictionary. Among them, each keyword includes at least one phoneme. Then, the electronic device constructs a phoneme sequence containing multiple phonemes according to the phonemes of the keywords and the order in which the keywords appear in the sample text. By preprocessing the sample text, at least one of the text content of the sample text and the correct pronunciation of the polyphone can be standardized, so that the sample text can be converted into a phoneme sequence more accurately, thereby improving the accuracy of the phoneme sequence.
[0152] Among them, text normalization is used to convert English abbreviations, numbers and other contents in the sample text into standard forms. For example, convert "Dr." in the sample text into "Doctor"; convert "123" in the sample text into "one hundred and twenty-three".
[0153] Word segmentation is used to divide the sample text into multiple keywords. The electronic device can divide the sample text into multiple keywords through the word segmentation tool.
[0154] Part-of-speech tagging is used to tag the parts of speech of multiple keywords obtained by word segmentation, such as verbs, nouns, adjectives, etc. For example, the electronic device can perform part-of-speech tagging on multiple keywords in the sample text through Stanford POS Tagger (a part-of-speech tagging tool).
[0155] The polyphone pronunciation annotation is used to annotate the pronunciation of polyphones in the sample text. Optionally, the electronic device can perform polyphone pronunciation annotation according to predefined rules. Among them, the predefined rules can indicate the pronunciation of polyphones in different phrases. For example, in the case where the sample text includes the keyword "Yangtze River", the electronic device can annotate the pronunciation of "long" as "chang-second tone" according to the predefined rules. In the case where the sample text includes the keyword "captain", the electronic device can annotate the pronunciation of "long" as "zhang-third tone" according to the predefined rules. Alternatively, the electronic device can also input the context containing polyphones into the polyphone disambiguation model to annotate the pronunciation of the polyphones according to the semantics of the polyphones through the polyphone disambiguation model.
[0156] The above step S301 mainly introduces the process of encoding the sample audio through the encoding module, and step S302 mainly introduces the process of predicting the encoding sequence corresponding to the sample text through the language model. It should be noted that the order of the above steps cannot limit the execution time of the steps. In some embodiments, the electronic device can also execute step S302 first, and then execute step S301; or, the electronic device can also execute step S301 and step S302 in parallel. The embodiment of the present disclosure does not limit the execution order of step S301 and step S302.
[0157] In step S303, the first coding sequence is processed by a decoding module in the first speech synthesis model to obtain the target audio.
[0158] In the disclosed embodiment, after the electronic device encodes the sample audio through the encoding module to obtain the first encoding sequence, the electronic device can input the first encoding sequence into the decoding module, so as to reconstruct the target audio according to the first encoding sequence through the decoding module. The content of the target audio is the same as that of the sample audio.
[0159] In some embodiments, the decoding module includes a decoder and a vocoder. The decoder is used to decode the coding sequence into a Mel-spectrogram. The vocoder is used to reconstruct audio according to the Mel-spectrogram. After the electronic device inputs the first coding sequence into the decoding module, the electronic device deconvolves the first coding sequence through the decoder in the decoding module to obtain a Mel-spectrogram of the target audio. Among them, the decoder has a deconvolution structure. The decoder is used to restore the low-dimensional discrete coding sequence to a high-dimensional Mel-spectrogram through the deconvolution operation. The Mel-spectrogram is used to reflect the audio characteristics of the target audio. Then, the electronic device reconstructs the audio based on the Mel-spectrogram through the vocoder in the decoding module to obtain the target audio. By reconstructing the audio according to the decoder and the vocoder in the decoding module, the decoder can have the ability to restore the low-dimensional coding sequence to a high-dimensional Mel-spectrogram, which is conducive to improving the accuracy and efficiency of audio reconstruction according to the decoding module.
[0160] It should be noted that the vocoder is a trained vocoder, such as Diffwave (a diffusion model), Hifi-GAN (a generative adversarial network), etc. In the process of training the first speech synthesis model, the electronic device does not need to update the parameters of the vocoder. Accordingly, in some embodiments, after the electronic device generates the Mel spectrum graph of the target audio through the decoder in the decoding module, it is no longer necessary to reconstruct the audio through the vocoder, but can train the first speech synthesis model based on the difference between the Mel spectrum graph of the sample audio and the Mel spectrum graph of the target audio.
[0161] In step S304, a first training loss is determined based on the first encoding sequence and the second encoding sequence.
[0162] In an embodiment of the present disclosure, the electronic device can determine a first training loss of the first speech synthesis model according to the difference between the first coding sequence and the second coding sequence. The first training loss is used to represent the degree of difference between the first coding sequence and the second coding sequence. The first training loss is positively correlated with the above-mentioned degree of difference.
[0163] In some embodiments, the first training loss is a cross entropy loss. The electronic device can process the first coding sequence and the second coding sequence according to the cross entropy loss function to obtain the cross entropy loss between the first coding sequence and the second coding sequence, which is the first training loss. By determining the cross entropy loss between the first coding sequence and the second coding sequence as the first training loss of the speech synthesis model, the first training loss can accurately reflect the difference between the coding sequence predicted by the language model and the actual coding sequence, thereby improving the accuracy and efficiency of training the speech synthesis model through the first training loss.
[0164] In step S305 , a second training loss is determined based on the sample audio and the target audio.
[0165] In an embodiment of the present disclosure, the electronic device can determine a second training loss of the first speech synthesis model according to the difference between the sample audio and the target audio. The second training loss is used to represent the degree of difference between the sample audio and the target audio. The second training loss is positively correlated with the degree of difference.
[0166] In some embodiments, the second training loss is a mean square error loss. Accordingly, the electronic device determines the mean square error between the Mel-spectrogram of the target audio and the Mel-spectrogram of the sample audio as the second training loss based on the mean square error loss function. By determining the mean square error loss between the sample audio and the target audio as the second training loss of the speech synthesis model, the second training loss can accurately reflect the difference between the target audio and the sample audio synthesized by the speech synthesis model, thereby improving the accuracy and efficiency of training the first speech synthesis model through the second training loss.
[0167] In step S306, a weighted sum is performed on the first training loss, the second training loss, and the third training loss to obtain a total training loss.
[0168] In the disclosed embodiment, the electronic device performs weighted summation of the first training loss, the second training loss, and the third training loss according to the weight of the first training loss, the weight of the second training loss, and the weight of the third training loss to obtain a total training loss. The weight of the first training loss, the weight of the second training loss, and the weight of the third training loss can be set according to actual needs, such as being set to 1.
[0169] The following formula (1) is an exemplary function for calculating the total training loss.
[0170] L total =L vq +L ce +L mse (1)
[0171] Among them, L total is the total training loss. vq is the third training loss, i.e., the quantization loss. ce is the first training loss, i.e., the cross entropy loss. L mse is the second training loss, i.e., the mean square error loss. The weights of the first training loss, the second training loss, and the third training loss are all 1.
[0172] In step S307, based on the total training loss, the parameters of the first speech synthesis model are updated by a back propagation algorithm to obtain a second speech synthesis model.
[0173] In the disclosed embodiment, the electronic device updates the parameters of multiple modules in the first speech synthesis model in a multi-round iteration manner according to the total training loss until the obtained second speech synthesis model meets the end training condition, thereby realizing joint training of multiple modules in the first speech synthesis model. The end training condition includes but is not limited to at least one of the following: the total training loss is less than a preset threshold, the number of iterations reaches a preset number, etc.
[0174] In some embodiments, the electronic device uses a back propagation algorithm to update the parameters of the first speech synthesis model in a multi-round iteration manner until the total training loss is less than a preset threshold or the number of iterations reaches a preset number of times. By jointly training multiple modules in the first speech synthesis model according to the total training loss, the training processes of the multiple modules in the first speech synthesis model can be integrated together, thereby simplifying the training steps of the first speech synthesis model, reducing the cumulative error in the training process, and improving the efficiency and accuracy of training the first speech synthesis model.
[0175] In some embodiments, during the training of the first speech synthesis model, the electronic device can adjust the learning rate during the training process through a learning rate scheduler so that the learning rates corresponding to different iteration rounds are not exactly the same. The electronic device can also scale or truncate the back-propagation gradient during the model training using the back-propagation algorithm to keep the gradient within a reasonable range, thereby avoiding the occurrence of gradient explosion or gradient disappearance. Optionally, the electronic device can perform gradient clipping according to the absolute value of the gradient or the norm of the gradient.
[0176] In order to more clearly illustrate the training process of the first speech synthesis model, Figure 4 The above training process is generally described. Figure 4 FIG. 1 is a schematic diagram showing a training process of a speech synthesis model according to an exemplary embodiment. Figure 4 As shown in FIG. 1 , the speech synthesis model includes an encoding module, a decoding module and a language model. The electronic device uses an audio processing tool to extract the Mel spectrum M of the sample audio. i , and the Mel-spectrogram M of the sample audio i The electronic device then uses the encoding module to generate the Mel spectrogram M of the sample audio. i Encode to obtain the first encoding sequence S vq and the third training loss L vq At the same time, the electronic device can convert the sample text into a phoneme sequence in parallel through the text processing module. Then, the electronic device inputs the phoneme sequence into the language model to predict the second encoding sequence S through the language model. p The electronic device determines the first coding sequence S vq and the second coding sequence S p The cross entropy loss between them gives the first training loss L ce Then, the electronic device converts the first coding sequence S vq The first coding sequence S is input to the decoding module, and the decoder in the decoding module converts the first coding sequence S vq Restore the Mel spectrogram M of the target audio p The electronic device determines the Mel-spectrogram M of the sample audio i And the Mel spectrogram M of the target audio p The mean square error loss between them gives the second training loss L mse Then, the electronic device is based on the total training loss L total , train the speech synthesis model.
[0177] The disclosed embodiments provide a method for training a speech synthesis model, which can jointly train the language model, encoding module, and decoding module in the speech synthesis model based on sample audio and sample text with consistent content. Compared with the multi-stage training method, the joint training method can integrate the training processes of multiple modules in the speech synthesis model together, thereby simplifying the training steps, reducing the cumulative error during the training process, and improving the efficiency and accuracy of training the speech synthesis model. Furthermore, the above-mentioned joint training method can better match the sample audio and the predicted coding sequence, thereby improving the sound quality of the target audio reconstructed by the speech synthesis model.
[0178] The above embodiments mainly introduce the training process of the speech synthesis model. In some embodiments, the electronic device can implement the speech synthesis task through the trained second speech synthesis model. Figure 5 is a flowchart of a speech synthesis method according to an exemplary embodiment, the method is executed by an electronic device, see Figure 5 , the method comprising:
[0179] In step S501 , a phoneme sequence of an input text is obtained.
[0180] In the disclosed embodiment, the input text is the text to be speech synthesized. For example, the input text is the answer text generated by the voice assistant to the input question. Or, the input text is the navigation text generated by the navigation application. Before the electronic device performs speech synthesis on the input text through the speech synthesis model, the electronic device obtains the phoneme sequence of the input text. The phoneme sequence includes the phonemes of multiple keywords in the input text. The phoneme sequence can represent the text content of the sample text.
[0181] In some embodiments, the electronic device can convert the input text into a phoneme sequence according to a phoneme dictionary. The electronic device preprocesses the input text. Among them, the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging. The preprocessing process of the input text is the same as the preprocessing process of the sample text introduced in the above step S302, and will not be repeated here. Then, the electronic device converts the preprocessed input text into a phoneme sequence according to the phoneme dictionary. Among them, the phoneme dictionary is used to record the correspondence between keywords and phonemes. For example, the electronic device determines the phoneme of each keyword in the input text according to the phoneme dictionary. Then, the electronic device constructs a phoneme sequence containing multiple phonemes according to the phonemes of the keywords and the order in which the keywords appear in the input text. By preprocessing the input text, not only can the text content of the input text be standardized, but also the correct pronunciation of the polyphones in the input text can be determined, so that the input text can be converted into a phoneme sequence more accurately, thereby improving the accuracy of the phoneme sequence.
[0182] In step S502, the phoneme sequence is processed by the language model in the second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence.
[0183] In an embodiment of the present disclosure, the electronic device inputs the phoneme sequence of the input text into the second speech synthesis model to predict the encoding sequence corresponding to the phoneme sequence through the language model in the second speech synthesis model. The encoding sequence can reflect the content characteristics of the input text. Optionally, the encoding sequence predicted by the language model is a discrete token sequence.
[0184] In step S503, output audio is generated based on the encoding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model.
[0185] In the disclosed embodiment, the electronic device inputs the coding sequence into the decoding module in the second speech synthesis model, so as to reconstruct the output audio according to the coding sequence through the decoding module. The content of the output audio is consistent with the content of the input text, thereby realizing speech synthesis of the input text.
[0186] In some embodiments, the decoding module includes a decoder and a vocoder. The decoder is used to decode the coding sequence into a Mel-spectrogram. The vocoder is used to reconstruct the audio according to the Mel-spectrogram. After the electronic device inputs the coding sequence into the decoding module, the electronic device deconvolves the coding sequence through the decoder in the decoding module to obtain a Mel-spectrogram of the output audio. Among them, the decoder is used to restore the low-dimensional discrete coding sequence to a high-dimensional Mel-spectrogram through the operation of deconvolution. The Mel-spectrogram is used to reflect the audio characteristics of the output audio. Then, the electronic device reconstructs the audio based on the Mel-spectrogram through the vocoder in the decoding module to obtain the output audio. By restoring the low-dimensional coding sequence to a high-dimensional Mel-spectrogram according to the decoder, and then reconstructing the output audio based on the Mel-spectrogram through the vocoder, the accuracy and efficiency of audio reconstruction can be improved.
[0187] In order to more clearly illustrate the process of speech synthesis of input text through the speech synthesis model, the following Figure 6 The above-mentioned speech synthesis process is generally described. Figure 6 FIG. 1 is a schematic diagram showing a speech synthesis process according to an exemplary embodiment. Figure 6As shown, the electronic device preprocesses the input text through the text processing module and converts the preprocessed input text into a phoneme sequence. Then, the electronic device inputs the phoneme sequence into the language model in the speech synthesis model, processes the phoneme sequence through the language model, and obtains a coding sequence. The electronic device restores the coding sequence to a Mel-spectrogram of the output audio through the decoder in the speech synthesis model. The electronic device then reconstructs the output audio according to the Mel-spectrogram output by the decoder through the vocoder in the speech synthesis model.
[0188] The disclosed embodiment provides a speech synthesis method, which can perform speech synthesis on any input text through a speech synthesis model to obtain output audio consistent with the content of the input text. Since the input text is preprocessed and converted into a phoneme sequence during the speech synthesis process, the content of the input text can be standardized, which is conducive to the speech synthesis model to generate a more accurate output audio according to the standardized phoneme sequence, reducing the situation of missing words, missing words and pronunciation errors, and improving the accuracy of speech synthesis.
[0189] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0190] Figure 7 1 is a block diagram of a training device for a speech synthesis model according to an exemplary embodiment. The first speech synthesis model includes a language model, an encoding module and a decoding module. The language model is used to predict the encoding sequence corresponding to the input text, the encoding module is used to encode the input audio into the encoding sequence, and the decoding module is used to reconstruct the audio based on the encoding sequence. Figure 7 As shown, the device includes: a processing unit 701, a determination unit 702 and a training unit 703.
[0191] The processing unit 701 is configured to encode the sample audio through the encoding module to obtain a first encoding sequence, process the sample text through the language model to obtain a second encoding sequence, and process the first encoding sequence through the decoding module to obtain a target audio, wherein the content of the sample text is consistent with the content of the sample audio;
[0192] A determining unit 702 is configured to determine a first training loss based on the first coding sequence and the second coding sequence, where the first training loss is used to represent a degree of difference between the first coding sequence and the second coding sequence;
[0193] The determining unit 702 is further configured to determine a second training loss based on the sample audio and the target audio, where the second training loss is used to represent the degree of difference between the sample audio and the target audio;
[0194] The training unit 703 is configured to train the first speech synthesis model based on the first training loss, the second training loss and the third training loss to obtain the second speech synthesis model, and the third training loss is the quantization loss generated in the encoding process.
[0195] In some embodiments, Figure 8 is a block diagram of another speech synthesis model training device according to an exemplary embodiment. Figure 8 As shown, the processing unit 701 includes:
[0196] The encoding subunit 801 is configured to encode the Mel-spectrogram of the sample audio through an encoder in the encoding module to obtain an audio feature vector;
[0197] The quantization subunit 802 is configured to quantize multiple rows of sub-feature vectors in the audio feature vector through a quantizer in the encoding module to obtain multiple encoding values in the first encoding sequence, and the multiple encoding values correspond to the multiple rows of sub-feature vectors one by one.
[0198] In some embodiments, the quantization subunit 802 is configured to:
[0199] For any sub-feature vector, a similarity between the sub-feature vector and a plurality of codebook vectors is determined by a quantizer, where the codebook vectors are used to represent reference audio features;
[0200] The sub-feature vector is quantized into a coding value corresponding to a target codebook vector through a quantizer, and the target codebook vector is a codebook vector with the highest similarity to the sub-feature vector among multiple codebook vectors.
[0201] In some embodiments, the determination unit 702 is further configured to determine, for any sub-feature vector, a quantization loss of the sub-feature vector based on the similarity between the sub-feature vector and the target codebook vector corresponding to the sub-feature vector, wherein the quantization loss is negatively correlated with the similarity; and determine the weighted sum of the quantization losses of multiple rows of sub-feature vectors as the third training loss.
[0202] In some embodiments, the processing unit 701 includes:
[0203] The prediction subunit 803 is configured to obtain a phoneme sequence of the sample text, where the phoneme sequence includes phonemes of multiple keywords in the sample text; and process the phoneme sequence through a language model to obtain a second encoding sequence.
[0204] In some embodiments, the prediction subunit 803 is configured to preprocess the sample text, and the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on the phoneme dictionary, the preprocessed sample text is converted into a phoneme sequence, and the phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0205] In some embodiments, the first training loss is a cross entropy loss, and the determination unit 702 is configured to process the first encoding sequence and the second encoding sequence based on the cross entropy loss function to obtain the second training loss.
[0206] In some embodiments, the processing unit 701 includes:
[0207] The decoding subunit 804 is configured to deconvolve the first coding sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the target audio; reconstruct the audio based on the Mel-spectrogram through a vocoder in the decoding module to obtain the target audio, and the vocoder is used to reconstruct the audio based on the Mel-spectrogram.
[0208] In some embodiments, the second training loss is a mean square error loss, and the determination unit 702 is configured to determine the mean square error between the Mel spectrogram of the target audio and the Mel spectrogram of the sample audio as the second training loss based on the mean square error loss function.
[0209] In some embodiments, the training unit 703 is configured to determine a total training loss, which is a weighted sum of a first training loss, a second training loss, and a third training loss; based on the total training loss, the parameters of the first speech synthesis model are updated through a back propagation algorithm to obtain a second speech synthesis model.
[0210] The disclosed embodiments provide a training device for a speech synthesis model, which can jointly train the language model, encoding module, and decoding module in the speech synthesis model based on sample audio and sample text with consistent content. Compared with the multi-stage training method, the joint training method can integrate the training processes of multiple modules in the speech synthesis model together, thereby simplifying the training steps, reducing the cumulative error in the training process, and improving the efficiency and accuracy of training the speech synthesis model. Furthermore, the above-mentioned joint training method can better match the sample audio and the predicted coding sequence, thereby improving the sound quality of the target audio reconstructed by the speech synthesis model.
[0211] It should be noted that the training device for the speech synthesis model provided in the above embodiment is only illustrated by the division of the above functional units. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the training device for the speech synthesis model provided in the above embodiment and the training method embodiment of the speech synthesis model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0212] Regarding the training device for the speech synthesis model 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.
[0213] Fig. 9 FIG. 1 is a block diagram of a speech synthesis device according to an exemplary embodiment. Fig. 9 As shown, the device includes: an acquisition unit 901, a prediction unit 902 and a decoding unit 903.
[0214] The acquisition unit 901 is configured to acquire a phoneme sequence of an input text, where the input text is a text to be speech synthesized, and the phoneme sequence includes phonemes of multiple keywords in the input text;
[0215] The prediction unit 902 is configured to process the phoneme sequence through the language model in the second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence, wherein the second speech synthesis model is trained based on the training method of the speech synthesis model shown in the above embodiment;
[0216] The decoding unit 903 is configured to generate output audio based on the encoding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model.
[0217] In some embodiments, the acquisition unit 901 is configured to preprocess the input text, and the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; based on the phoneme dictionary, the preprocessed input text is converted into a phoneme sequence, and the phoneme dictionary is used to record the correspondence between keywords and phonemes.
[0218] In some embodiments, the decoding unit 903 is configured to deconvolve the encoded sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the output audio; and reconstruct the audio based on the Mel-spectrogram through a vocoder in the decoding module to obtain the output audio.
[0219] The disclosed embodiment provides a speech synthesis device, which can perform speech synthesis on any input text through a speech synthesis model to obtain output audio consistent with the content of the input text. Since the input text is preprocessed and converted into a phoneme sequence during the speech synthesis process, the content of the input text can be standardized, which is conducive to the speech synthesis model generating a more accurate output audio according to the standardized phoneme sequence, reducing the situation of missing words, missing words and pronunciation errors, and improving the accuracy of speech synthesis.
[0220] It should be noted that the speech synthesis device provided in the above embodiment is only illustrated by the division of the above functional units. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the speech synthesis device provided in the above embodiment and the speech synthesis method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0221] Regarding the speech synthesis 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.
[0222] Fig.10 It is a block diagram of an electronic device according to an exemplary embodiment. Generally, the electronic device 1000 includes: a processor 1001 and a memory 1002 .
[0223] The processor 1001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1001 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1001 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0224] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1002 is used to store at least one program code, which is used to be executed by the processor 1001 to implement the training method of the speech synthesis model provided in the method embodiment of the present disclosure, or to implement the speech synthesis method provided in the method embodiment of the present disclosure.
[0225] In some embodiments, the electronic device 1000 may further optionally include: a peripheral device interface 1003 and at least one peripheral device. The processor 1001, the memory 1002 and the peripheral device interface 1003 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 1003 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 1004, a display screen 1005, a camera assembly 1006, an audio circuit 1007 and a power supply 1008.
[0226] The peripheral device interface 1003 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1001 and the memory 1002. In some embodiments, the processor 1001, the memory 1002, and the peripheral device interface 1003 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1001, the memory 1002, and the peripheral device interface 1003 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0227] The radio frequency circuit 1004 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1004 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 1004 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 1004 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 1004 can communicate with other electronic devices through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1004 may also include circuits related to NFC (Near Field Communication), which is not limited in the present disclosure.
[0228] The display screen 1005 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1005 is a touch display screen, the display screen 1005 also has the ability to collect touch signals on the surface or above the surface of the display screen 1005. The touch signal can be input to the processor 1001 as a control signal for processing. At this time, the display screen 1005 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1005 can be one, and the front panel of the electronic device 1000 is set; in other embodiments, the display screen 1005 can be at least two, which are respectively set on different surfaces of the electronic device 1000 or are folded; in some other embodiments, the display screen 1005 can be a flexible display screen, which is set on the curved surface or folded surface of the electronic device 1000. Even, the display screen 1005 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 1005 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0229] The camera assembly 1006 is used to capture images or videos. Optionally, the camera assembly 1006 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the electronic device, and the rear camera is arranged on the back of the electronic device. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1006 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0230] The audio circuit 1007 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 1001 for processing, or input them into the radio frequency circuit 1004 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the electronic device 1000. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 1001 or the radio frequency circuit 1004 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 1007 may also include a headphone jack.
[0231] The power supply 1008 is used to power various components in the electronic device 1000. The power supply 1008 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1008 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0232] Those skilled in the art will understand that Fig.10 The structure shown in the figure does not constitute a limitation on the electronic device 1000, and the electronic device 1000 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0233] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1002 including instructions, and the instructions can be executed by the processor 1001 of the electronic device 1000 to complete the training method of the speech synthesis model or to complete the speech synthesis method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0234] A computer program product includes a computer program, which, when executed by a processor, implements the training method of the above-mentioned speech synthesis model, or implements the above-mentioned speech synthesis method.
[0235] 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.
[0236] 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.
Claims
1. A method for training a speech synthesis model, characterized in that: The first speech synthesis model includes a language model, an encoding module, and a decoding module. The language model is used to predict a code sequence corresponding to an input text. The encoding module is used to encode an input audio into a code sequence. The decoding module is used to reconstruct the audio based on the code sequence. The method includes: Encoding the sample audio by the encoding module to obtain a first encoding sequence, processing the sample text by the language model to obtain a second encoding sequence, and processing the first encoding sequence by the decoding module to obtain a target audio, wherein the content of the sample text is consistent with the content of the sample audio; Determining a first training loss based on the first coding sequence and the second coding sequence, where the first training loss is used to represent a degree of difference between the first coding sequence and the second coding sequence; Determining a second training loss based on the sample audio and the target audio, wherein the second training loss is used to represent a degree of difference between the sample audio and the target audio; Based on the first training loss, the second training loss, and the third training loss, the first speech synthesis model is trained to obtain a second speech synthesis model, where the third training loss is a quantization loss generated during the encoding process.
2. The method for training a speech synthesis model according to claim 1, wherein: The encoding module encodes the sample audio to obtain a first encoding sequence, including: Encoding the Mel-spectrogram of the sample audio through an encoder in the encoding module to obtain an audio feature vector; The quantizer in the encoding module quantizes the multiple rows of sub-feature vectors in the audio feature vector to obtain multiple encoding values in the first encoding sequence, where the multiple encoding values correspond one-to-one to the multiple rows of sub-feature vectors.
3. The method for training a speech synthesis model according to claim 2, wherein: The step of quantizing the plurality of rows of sub-feature vectors in the audio feature vector by a quantizer in the encoding module to obtain a plurality of encoding values in the first encoding sequence includes: For any sub-feature vector, determining, by the quantizer, a similarity between the sub-feature vector and a plurality of codebook vectors, wherein the codebook vectors are used to represent reference audio features; The sub-eigenvector is quantized into a coding value corresponding to a target codebook vector by the quantizer, and the target codebook vector is a codebook vector with the highest similarity to the sub-eigenvector among the multiple codebook vectors.
4. The method for training a speech synthesis model according to claim 3, wherein: The process of determining the third training loss includes: For any sub-feature vector, determining a quantization loss of the sub-feature vector based on a similarity between the sub-feature vector and a target codebook vector corresponding to the sub-feature vector, wherein the quantization loss is negatively correlated with the similarity; A weighted sum of the quantization losses of the multiple rows of sub-feature vectors is determined as the third training loss.
5. The method for training a speech synthesis model according to claim 1, wherein: The processing of the sample text by the language model to obtain a second encoding sequence includes: Acquire a phoneme sequence of the sample text, where the phoneme sequence includes phonemes of a plurality of keywords in the sample text; The phoneme sequence is processed using the language model to obtain the second encoding sequence.
6. The method for training a speech synthesis model according to claim 5, wherein: The obtaining of the phoneme sequence of the sample text includes: Preprocessing the sample text, wherein the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; The pre-processed sample text is converted into the phoneme sequence based on a phoneme dictionary, where the phoneme dictionary is used to record the correspondence between keywords and phonemes.
7. The method for training a speech synthesis model according to claim 1, wherein: The processing of the first coding sequence by the decoding module to obtain target audio includes: Deconvolving the first coding sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the target audio; The target audio is obtained by performing audio reconstruction based on the mel-spectrogram through a vocoder in the decoding module, where the vocoder is used to perform audio reconstruction based on the mel-spectrogram.
8. The method for training a speech synthesis model according to claim 1, wherein: The step of training the first speech synthesis model based on the first training loss, the second training loss, and the third training loss to obtain a second speech synthesis model includes: Determine a total training loss, where the total training loss is a weighted sum of the first training loss, the second training loss, and the third training loss; Based on the total training loss, the parameters of the first speech synthesis model are updated through a back propagation algorithm to obtain the second speech synthesis model.
9. A speech synthesis method, characterized in that: The method comprises: Acquire a phoneme sequence of an input text, where the input text is a text to be subjected to speech synthesis, and the phoneme sequence includes phonemes of a plurality of keywords in the input text; Processing the phoneme sequence using a language model in a second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence, wherein the second speech synthesis model is trained based on the speech synthesis model training method according to any one of claims 1 to 8; The output audio is generated based on the encoding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model.
10. The speech synthesis method according to claim 9, characterized in that: The step of obtaining a phoneme sequence of an input text includes: Preprocessing the input text, wherein the preprocessing includes at least one of text normalization, word segmentation, part-of-speech tagging, and polyphonetic pronunciation tagging; The pre-processed input text is converted into the phoneme sequence based on a phoneme dictionary, where the phoneme dictionary is used to record the correspondence between keywords and phonemes.
11. The speech synthesis method according to claim 9, wherein: The step of generating output audio based on the encoding sequence corresponding to the phoneme sequence by a decoding module in the second speech synthesis model includes: Deconvolving the encoded sequence through a decoder in the decoding module to obtain a Mel-spectrogram of the output audio; The output audio is obtained by performing audio reconstruction based on the mel-spectrogram through a vocoder in the decoding module.
12. A training device for a speech synthesis model, characterized in that: The first speech synthesis model includes a language model, an encoding module, and a decoding module. The language model is used to predict a code sequence corresponding to an input text. The encoding module is used to encode an input audio into a code sequence. The decoding module is used to reconstruct the audio based on the code sequence. The apparatus includes: a processing unit configured to encode the sample audio using the encoding module to obtain a first encoding sequence, process the sample text using the language model to obtain a second encoding sequence, and process the first encoding sequence using the decoding module to obtain a target audio, wherein the content of the sample text is consistent with the content of the sample audio; a determining unit configured to determine a first training loss based on the first coding sequence and the second coding sequence, where the first training loss is used to represent a degree of difference between the first coding sequence and the second coding sequence; The determining unit is further configured to determine a second training loss based on the sample audio and the target audio, where the second training loss is used to represent a degree of difference between the sample audio and the target audio; The training unit is configured to train the first speech synthesis model based on the first training loss, the second training loss and the third training loss to obtain a second speech synthesis model, wherein the third training loss is a quantization loss generated during the encoding process.
13. A speech synthesis device, characterized in that: The device comprises: an acquiring unit configured to acquire a phoneme sequence of an input text, wherein the input text is a text to be subjected to speech synthesis, and the phoneme sequence includes phonemes of a plurality of keywords in the input text; a prediction unit configured to process the phoneme sequence using a language model in a second speech synthesis model to obtain a coding sequence corresponding to the phoneme sequence, wherein the second speech synthesis model is trained based on the speech synthesis model training method according to any one of claims 1 to 8; The decoding unit is configured to generate output audio based on the encoding sequence corresponding to the phoneme sequence through the decoding module in the second speech synthesis model.
14. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the training method of the speech synthesis model as described in any one of claims 1 to 8, or to implement the speech synthesis method as described in any one of claims 9 to 11.
15. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the training method of the speech synthesis model as described in any one of claims 1 to 8, or the speech synthesis method as described in any one of claims 9 to 11.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the training method of the speech synthesis model as described in any one of claims 1 to 8, or implements the speech synthesis method as described in any one of claims 9 to 11.
Citation Information
Patent Citations
Speech synthesis model training method, speech synthesis method and device thereof
CN113393828A
Voice data processing method and device, computer equipment and storage medium
CN113823298A
Speech synthesis system and method, computer equipment, storage medium and program product
CN113920976A
Speech synthesis method and system based on expressive force, electronic equipment and storage medium
CN114333762A
Voice synthesis method and device for air traffic control training scene
CN115223537A
Cited By
Audio processing method, device and system and storage medium
CN119252265A
Speech processing model training method, speech processing method, device and equipment
CN119763548A
