Tortoise は、次の優先順位で構築されたテキスト読み上げプログラムです。
このリポジトリには、Tortoise TTS を推論モードで実行するために必要なすべてのコードが含まれています。
亀の論文の(非常に)ラフドラフトがドキュメント形式で利用可能になりました。私は間違いなくコメント、提案やレビューをいただければ幸いです:https://docs.google.com/document/d/13O_eyY65i6AkNrN_LdPhpUjGhyTNKYHvDrIvHnHe1GA
私はスピーチ関連のリポジトリにモハーベ砂漠の動植物にちなんで名前を付けています。亀は頬に少し舌です:このモデル めちゃくちゃ遅いです。自己回帰デコーダーと拡散デコーダーの両方を利用します。どちらもその低さで知られています サンプリングレート。K80では、2分ごとに中サイズの文を生成することを期待してください。
出力例の大規模なリストについては、このページを参照してください。
亀+ GPT-3のクールなアプリケーション(私ではない):https://twitter.com/lexman_ai
Colabはこれを試す最も簡単な方法です。ここで使用できるノートブックをまとめました:https://colab.research.google.com/drive/1wVVqUPqwiDBUVeWWOUNglpGhU3hg_cbR?usp=sharing
これを自分のコンピューターで使用する場合は、NVIDIAGPUが必要です。
まず、次の手順を使用してpytorchをインストールします。 https://pytorch.org/get-started/locally/. Windowsでは、Condaインストールパスを使用することを強くお勧めします。あなたがこれをしなければ、あなたは 依存関係の問題を追跡するのに多くの時間を費やします。
次に、TorToiSeとその依存関係をインストールします。
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python setup.py install
Windowsを使用している場合は、pysoundfileもインストールする必要があります。
conda install -c conda-forge pysoundfile
このスクリプトを使用すると、1 つ以上の音声で 1 つのフレーズを話すことができます。
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast
このスクリプトは、大量のテキストを読み取るためのツールを提供します。
python tortoise/read.py --textfile <your text to be read> --voice random
これにより、テキストファイルが文に分割され、一度に1つずつ音声に変換されます。シリーズを出力します 生成された音声クリップの数。すべてのクリップが生成されると、それらを1つのファイルに結合し、 それも出力します。
時々亀は出力を台無しにします。--regenerateを使用して再実行することにより、不良クリップを再生成できます 引数。
read.py
亀は次のようにプログラムで使用できます。
reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths]
tts = api.TextToSpeech()
pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast')
Tortoiseは、マルチスピーカーモデルになるように特別に訓練されました。これは、参照クリップを参照することで実現されます。
これらのリファレンス クリップは、音声生成をガイドするために提供するスピーカーの録音です。これらのクリップは、声の高さやトーン、話す速度、さらにはLispや吃音などの話す欠陥など、出力の多くのプロパティを決定するために使用されます。リファレンスクリップは、音量、バックグラウンドノイズ、録音品質、リバーブなど、オーディオ出力の音声に関連しない側面を決定するためにも使用されます。
ランダムに音声を生成する機能を含めました。これらの声は実際には存在せず、実行するたびにランダムになります それ。結果は非常に魅力的であり、私はそれで遊ぶことをお勧めします!
音声名として「random」を渡すことで、ランダムな音声を使用できます。亀が残りの面倒を見ます。
ML空間にいる人の場合:これは、音声調整潜伏空間にランダムなベクトルを投影することによって作成されます。
このリポジトリには、事前にパッケージ化された音声がいくつか付属しています。「train_」で始まる声はトレーニングセットから来て、実行します 他よりもはるかに優れています。あなたの目標が高品質のスピーチであるならば、私はあなたがそれらのうちの1つを選ぶことを勧めます。見たいなら Tortoiseがゼロショットの模倣のためにできることは、他のものを見てください。
Tortoiseに新しいボイスを追加するには、次の手順を実行する必要があります。
上記のように、参照クリップはTortoiseの出力に大きな影響を与えます。以下は、ピッキングのヒントです 良いクリップ:
Tortoiseは、主に拡散モデルと組み合わせた自己回帰デコーダーモデルです。これらは両方ともたくさんのノブを持っています それは私が使いやすさのために抽象化したものを回すことができます。私は使用して何千ものクリップを生成することによってこれを行いました 設定のさまざまな順列と、音声のリアリズムと明瞭度のメトリックを使用してそれらの効果を測定します。私は持っています デフォルトを私が見つけた最高の全体的な設定に設定します。特定のユースケースでは、 これらの設定(そして私が何かを逃した可能性が非常に高いです!
これらの設定は、Tortoise に同梱されている通常のスクリプトでは使用できません。ただし、API で使用できます。完全なリストについては、「」を参照してください。
api.tts
一部の人々は、Tortoiseで迅速なエンジニアリングを行うことが可能であることを発見しました!たとえば、感情を呼び起こすことができます あなたのテキストの前に「私は本当に悲しいです」のようなものを含めることによって。私はあなたが使うことができる自動編集システムを構築しました これを利用してください。これは、角かっこで囲まれたプロンプト内のテキストを編集しようとすることによって機能します。たとえば、 プロンプト「[私は本当に悲しいです]私を養ってください。」は「私を養ってください」という言葉だけを話します(悲しい調性で)。
Tortoiseは、潜在的な点を生成する小さなサブモデルを介して個別に参照クリップをフィードすることにより、参照クリップを取り込みます。 次に、生成されたすべての潜在性の平均を取ります。私が行った実験は、これらの点の潜在性が 非常に表現力豊かで、トーンから発話速度、発話異常まですべてに影響を与えます。
これは、いくつかの巧妙なトリックに役立ちます。たとえば、2つの異なる声をカメに結合して出力することができます これら2つの声の「平均」はどのように聞こえますか。
スクリプトを使用して、インストールした音声の条件付け潜伏を抽出します。このスクリプト 潜在性を.pthピクルスファイルにダンプします。ファイルには、1 つのタプル (autoregressive_latent, diffusion_latent) が含まれます。
get_conditioning_latents.py
または、API を使用します。潜在性をフェッチするためのTextToSpeech.get_conditioning_latents()。
それらで遊んだ後、それらを使用して、voices/にサブディレクトリを1つ作成することで音声を生成できます。 ピクルスされたコンディショニング潜在をタプルとして含む ".pth" ファイル (autoregressive_latent, diffusion_latent).
Tortoiseのような確率モデルは、「拡張検索」と考えるのが最適です-この場合、可能な空間を通して 特定のテキスト文字列の発話。これらのスペースの閲覧におけるコミュニティの関与の影響( GPT-3またはCLIP)は本当に私を驚かせました。ここに記載されていないTortoiseでできることを見つけたら、 私に報告してください!このページに公開できてうれしいです。
このモデルが誤用される可能性があるという懸念から、オーディオクリップの可能性を示す分類子を作成しました 亀から来ました。
この分類子はどのコンピューターでも実行でき、使用法は次のとおりです。
python tortoise/is_this_from_tortoise.py --clip=<path_to_suspicious_audio_file>
This model has 100% accuracy on the contents of the results/ and voices/ folders in this repo. Still, treat this classifier
as a "strong signal". Classifiers can be fooled and it is likewise not impossible for this classifier to exhibit false
positives.
Model architectureTortoise TTS is inspired by OpenAI's DALLE, applied to speech data and using a better decoder. It is made up of 5 separate
models that work together. I've assembled a write-up of the system architecture here:
https://nonint.com/2022/04/25/tortoise-architectural-design-doc/
TrainingThese models were trained on my "homelab" server with 8 RTX 3090s over the course of several months. They were trained on a dataset consisting of
~50k hours of speech data, most of which was transcribed by ocotillo. Training was done on my own
DLAS trainer.
I currently do not have plans to release the training configurations or methodology. See the next section..
Ethical ConsiderationsTortoise v2 works considerably better than I had planned. When I began hearing some of the outputs of the last few versions, I began
wondering whether or not I had an ethically unsound project on my hands. The ways in which a voice-cloning text-to-speech system
could be misused are many. It doesn't take much creativity to think up how.
After some thought, I have decided to go forward with releasing this. Following are the reasons for this choice:
- It is primarily good at reading books and speaking poetry. Other forms of speech do not work well.
- It was trained on a dataset which does not have the voices of public figures. While it will attempt to mimic these voices if they are provided as references, it does not do so in such a way that most humans would be fooled.
- The above points could likely be resolved by scaling up the model and the dataset. For this reason, I am currently withholding details on how I trained the model, pending community feedback.
- I am releasing a separate classifier model which will tell you whether a given audio clip was generated by Tortoise or not. See
tortoise-detect
above.
- If I, a tinkerer with a BS in computer science with a ~$15k computer can build this, then any motivated corporation or state can as well. I would prefer that it be in the open and everyone know the kinds of things ML can do.
DiversityThe diversity expressed by ML models is strongly tied to the datasets they were trained on.
Tortoise was trained primarily on a dataset consisting of audiobooks. I made no effort to
balance diversity in this dataset. For this reason, Tortoise will be particularly poor at generating the voices of minorities
or of people who speak with strong accents.
Looking forwardTortoise v2 is about as good as I think I can do in the TTS world with the resources I have access to. A phenomenon that happens when
training very large models is that as parameter count increases, the communication bandwidth needed to support distributed training
of the model increases multiplicatively. On enterprise-grade hardware, this is not an issue: GPUs are attached together with
exceptionally wide buses that can accommodate this bandwidth. I cannot afford enterprise hardware, though, so I am stuck.
I want to mention here
that I think Tortoise could do be a lot better. The three major components of Tortoise are either vanilla Transformer Encoder stacks
or Decoder stacks. Both of these types of models have a rich experimental history with scaling in the NLP realm. I see no reason
to believe that the same is not true of TTS.
The largest model in Tortoise v2 is considerably smaller than GPT-2 large. It is 20x smaller that the original DALLE transformer.
Imagine what a TTS model trained at or near GPT-3 or DALLE scale could achieve.
If you are an ethical organization with computational resources to spare interested in seeing what this model could do
if properly scaled out, please reach out to me! I would love to collaborate on this.
AcknowledgementsThis project has garnered more praise than I expected. I am standing on the shoulders of giants, though, and I want to
credit a few of the amazing folks in the community that have helped make this happen:
Tortoise was built entirely by me using my own hardware. My employer was not involved in any facet of Tortoise's development.
If you use this repo or the ideas therein for your research, please cite it! A bibtex entree can be found in the right pane on GitHub.