CLVP
Overview
Section titled “Overview”CLVP (Contrastive Language-Voice Pretrained Transformer) モデルは、James Betker によって Better speech synthesis through scaling で提案されました。
論文の要約は次のとおりです。
*近年、画像生成の分野は自己回帰変換器と DDPM の応用によって革命を起こしています。これらのアプローチは、画像生成のプロセスを段階的な確率的プロセスとしてモデル化し、大量のコンピューティングとデータを活用して画像の分布を学習します。パフォーマンスを向上させるこの方法論は、画像に限定される必要はありません。この論文では、画像生成ドメインの進歩を音声合成に適用する方法について説明します。その結果、表現力豊かなマルチ音声テキスト読み上げシステムである TorToise が誕生しました。
このモデルは Susnato Dhar によって提供されました。 元のコードは ここ にあります。
Usage tips
Section titled “Usage tips”- CLVP は Tortoise TTS モデルの不可欠な部分です。
- CLVP を使用して、生成されたさまざまな音声候補を提供されたテキストと比較することができ、最良の音声トークンが拡散モデルに転送されます。
- Tortoise の使用には、[
ClvpModelForConditionalGeneration.generate()] メソッドの使用を強くお勧めします。 - 16 kHz を期待する他のオーディオ モデルとは対照的に、CLVP モデルはオーディオが 22.05 kHz でサンプリングされることを期待していることに注意してください。
Brief Explanation:
Section titled “Brief Explanation:”ClvpTokenizerはテキスト入力をトークン化し、ClvpFeatureExtractorは目的のオーディオからログ メル スペクトログラムを抽出します。ClvpConditioningEncoderは、これらのテキスト トークンとオーディオ表現を取得し、テキストとオーディオに基づいて条件付けされた埋め込みに変換します。ClvpForCausalLMは、これらの埋め込みを使用して複数の音声候補を生成します。- 各音声候補は音声エンコーダ (
ClvpEncoder) を通過してベクトル表現に変換され、テキスト エンコーダ (ClvpEncoder) はテキスト トークンを同じ潜在空間に変換します。 - 最後に、各音声ベクトルをテキスト ベクトルと比較して、どの音声ベクトルがテキスト ベクトルに最も類似しているかを確認します。
- [
ClvpModelForConditionalGeneration.generate()] は、上記のすべてのロジックを 1 つのメソッドに圧縮します。
例 :
>>> import datasets>>> from transformers import ClvpProcessor, ClvpModelForConditionalGeneration
>>> # Define the Text and Load the Audio (We are taking an audio example from HuggingFace Hub using `datasets` library).>>> text = "This is an example text."
>>> ds = datasets.load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")>>> ds = ds.cast_column("audio", datasets.Audio(sampling_rate=22050))>>> sample = ds[0]["audio"]
>>> # Define processor and model.>>> processor = ClvpProcessor.from_pretrained("susnato/clvp_dev")>>> model = ClvpModelForConditionalGeneration.from_pretrained("susnato/clvp_dev")
>>> # Generate processor output and model output.>>> processor_output = processor(raw_speech=sample["array"], sampling_rate=sample["sampling_rate"], text=text, return_tensors="pt")>>> generated_output = model.generate(**processor_output)ClvpConfig
Section titled “ClvpConfig”[[autodoc]] ClvpConfig
ClvpEncoderConfig
Section titled “ClvpEncoderConfig”[[autodoc]] ClvpEncoderConfig
ClvpDecoderConfig
Section titled “ClvpDecoderConfig”[[autodoc]] ClvpDecoderConfig
ClvpTokenizer
Section titled “ClvpTokenizer”[[autodoc]] ClvpTokenizer - save_vocabulary
ClvpFeatureExtractor
Section titled “ClvpFeatureExtractor”[[autodoc]] ClvpFeatureExtractor - call
ClvpProcessor
Section titled “ClvpProcessor”[[autodoc]] ClvpProcessor - call - decode - batch_decode
ClvpModelForConditionalGeneration
Section titled “ClvpModelForConditionalGeneration”[[autodoc]] ClvpModelForConditionalGeneration - forward - generate - get_text_features - get_speech_features
ClvpForCausalLM
Section titled “ClvpForCausalLM”[[autodoc]] ClvpForCausalLM
ClvpModel
Section titled “ClvpModel”[[autodoc]] ClvpModel
ClvpEncoder
Section titled “ClvpEncoder”[[autodoc]] ClvpEncoder
ClvpDecoder
Section titled “ClvpDecoder”[[autodoc]] ClvpDecoder