GithubHelp home page GithubHelp logo

mmvc_trainer's Introduction

MMVC_Trainer

AIを使ったリアルタイムボイスチェンジャーのモデル学習用ツール

Description

AIを使ったリアルタイムボイスチェンジャー「MMVC(RealTime-Many to Many Voice Conversion)」 で使用するモデルを学習するためのリポジトリです。
Google Colaboratory (Google Colab) を用いることで、個人の環境に依存せず、かつ簡単に機械学習の学習フェーズを実行可能です。

Concept

「簡単」「だれでも」「好きな声に」「リアルタイムで」

Demo

制作中 (v1.3.0.0)
https://www.nicovideo.jp/watch/sm40386035 (v1.2.0.0)

MMVCの利用規約 及び MMVC用音源の配布先(2022/08/10)

MMVCの利用規約

MMVC(以下本ソフトウェア)の利用規約は、基本的にMITライセンスに準拠します。

  1. 本ソフトウェアは、コピー利用、配布、変更の追加、変更を加えたものの再配布、商用利用、有料販売など、どなたでも自由にお使いいただくことができます。
  2. ライセンスの記載が可能なプラットフォームで使用される場合、下記に示すライセンスパターンのどちらかの記載をお願いいたします。
    VRChatでの使用など、ライセンス記載が困難な場合、記載は不要です。
  3. 本ソフトウェアについて、開発者はいかなる保証もいたしません。
    また、本ソフトウェアを利用したことによって生じる問題について、開発者は一切の責任を負いかねます。
  4. 学習元として用いる音声データについては、必ず使用前にデータの権利者より許諾を得てください。
    また、音声データの配布元の利用規約内で利用してください。

MMVC公式配布の音声データの利用規約とダウンロード先について

本ソフトウェアの利用規約とは別に、下記音声データを利用する場合、それぞれの音声ライブラリ提供者様の利用規約に同意する必要があります。
※本ソフトウェアでは下記企業様・団体様に特別に許可を頂き、音声データを本ソフトウェア用に改変、再配布を行っております。

SSS LLC.

[利用規約][ずんだもん 音声データ] ※本ソフトウェアに同梱しているものと同様の音声データになります
[利用規約][九州そら 音声データ]
[利用規約][四国めたん 音声データ]
[利用規約][東北きりたん 音声データ]

春日部つむぎプロジェクト様

[利用規約][春日部つむぎ 音声データ]

ライセンス表記について

ずんだもん/四国めたん/九州そら/春日部つむぎ/東北きりたん のキャラクターを利用する場合に限り、下記ライセンスパターンに加えて、どのツールで作られた音声かわかるように

MMVC:ずんだもん
MMVC:ずんだもん/四国めたん

等の記載を下記ライセンスパターンと一緒にご記載ください。
こちらにつきましても、VRChatでの使用など、ライセンス記載が困難な場合、記載は不要です。

ライセンスパターン 1

Copyright (c) 2022 Isle.Tennos 
Released under the MIT license 
https://opensource.org/licenses/mit-license.php

ライセンスパターン 2 (開発者推奨)

MMVCv1.x.x.x(使用バージョン) 
Copyright (c) 2022 Isle.Tennos 
Released under the MIT license 
https://opensource.org/licenses/mit-license.php
git:https://github.com/isletennos/MMVC_Trainer
community(discord):https://discord.gg/2MGysH3QpD

Requirement

・Google アカウント

Install

下記ボタンからColab上で自分のGoogle Drive上にインストールしてください。

Open In Colab

その後、Google Driveを開いて「マイドライブ > MMVC_Trainer > notebook」の中の各ノートを開いて実行してください。

Usage

チュートリアル : ずんだもんになる

本チュートリアルではずんだもん(SSS LLC.)の音声データを利用します。
そのため、MMVCの利用規約とは別に[ずんだもん 利用規約]を遵守する必要があります。

Ph1. 自分の音声の録音と音声データの配置

  1. 自分の声の音声データを録音します。

    • notebookディレクトリにある「00_Rec_Voice.ipynb」から自分の音声を録音してください。
    • もしくは、自分のPCで録音してGoogle Drive上に配置してください。
      JVSコーパスやITAコーパス等を台本にし、100文程度読み上げます。
      また、録音した音声は24000Hz 16bit 1chである必要があります。
      ※MMVC用にテキストを分割したITAコーパスです。ご利用ください。
      https://drive.google.com/file/d/14oXoQqLxRkP8NJK8qMYGee1_q2uEED1z/view?usp=sharing
  2. dataset/textful/00_myvoice に音声データとテキストデータを配置します。

    • 00_Rec_Voice.ipynbを利用して録音した場合はこのように配置されていますのでそのままで大丈夫です。
    • 最終的に下記のようなディレクトリ構成になるようにファイルを配置してください。
dataset
├── textful
│   ├── 00_myvoice
│   │   ├── text
│   │   │   ├── emoNormal_001.txt
│   │   │   ├── emoNormal_002.txt
│   │   │   ├── ...
│   │   └── wav
│   │        ├── emoNormal_001.wav
│   │        ├── emoNormal_002.wav
│   │        ├── ...
│   │── 01_target
│   │   ├── text
│   │   └── wav
│   │
│   └── 1205_zundamon
│       ├── text
│       │   ├── emoNormal_001.txt
│       │   ├── emoNormal_002.txt
│       │   ├── ...
│       └── wav
│            ├── emoNormal_001.wav
│            ├── emoNormal_002.wav
│            ├── ... 
│        
└── textless

Ph2. モデルの学習方法

  1. 事前学習済みデータを配置します。

    • 00_Clone_Repo.ipynbを使ってインストールした場合は既に事前学習済みデータも配置済みなのでそのままで大丈夫です。
    • 00_Clone_Repo.ipynbを利用しなかった場合や「fine_model」ディレクトリに下記ファイルが存在しなかった場合、以下の手順でファイルを配置してください。
      1. 下記リンクより、「G_v13_20231020.pth」「D_v13_20231020.pth」をダウンロード。
        https://huggingface.co/MMVC/prelearned-model/tree/main
      2. 「G_v13_20231020.pth」「D_v13_20231020.pth」を「fine_model」ディレクトリに配置します。(良く忘れるポイントなので要注意!)
  2. notebookディレクトリにある「01_Create_Configfile.ipynb」をGoogle Colab 上で実行、学習に必要なconfigファイルを作成します

  3. configsに作成されたtrain_config.jsonの

    • "eval_interval"
      modelを保存する間隔です。
    • "batch_size"
      colabで割り当てたGPUに合わせて調整してください。

    上記2項目を環境に応じて最適化してください。わからない方はそのままで大丈夫です。

  4. notebookディレクトリにある「02_Train_MMVC.ipynb」をgoogle colab 上で実行してください。
    logs/にモデルが生成されます。

Ph3. 学習したモデルの性能検証

  1. notebookディレクトリにある「03_MMVC_Interface.ipynb」をgoogle colab 上で実行してください。

好きなキャラクターの声になる

Ph1. 自分の音声の録音と音声データの配置 及びターゲット音声データの配置

  1. 自分の声の音声データとその音声データに対応するテキスト、変換したい声の音声データとその音声データに対応するテキストを用意します。
    この時、用意する音声(自分の声の音声データ/変換したい声の音声データ共に)は24000Hz 16bit 1chを強く推奨しております。
  2. 下記のようなディレクトリ構成になるように音声データとテキストデータを配置します。
    textfulの直下には2ディレクトリになります。
    (1205_zundamonディレクトリは無くても問題ありません)
dataset
├── textful
│   ├── 00_myvoice
│   │   ├── text
│   │   │   ├── emoNormal_001.txt
│   │   │   ├── emoNormal_002.txt
│   │   │   ├── ...
│   │   └── wav
│   │        ├── emoNormal_001.wav
│   │        ├── emoNormal_002.wav
│   │        ├── ...
│   │── 01_target
│   │   ├── text
│   │   │   ├── emoNormal_001.txt
│   │   │   ├── emoNormal_002.txt
│   │   │   ├── ...
│   │   └── wav
│   │        ├── emoNormal_001.wav
│   │        ├── emoNormal_002.wav
│   │        ├── ... 
│   └── 1205_zundamon
│       ├── ... 
│        
└── textless

Ph2. モデルの学習方法

以降、「チュートリアル : ずんだもんになる Ph2.」と同様のため割愛

Ph3. 学習したモデルの性能検証

以降、「チュートリアル : ずんだもんになる Ph3.」と同様のため割愛

MMVC_Client

プロジェクトによるMMVC Client

MMVCを実際に動かすClient software
https://github.com/isletennos/MMVC_Client

有志によるMMVC Client

(1) Voice Changer Trainer and Player

様々な環境でMMVCを動かすように作成されたClient software。

  • 動作確認状況
# os middle トレーニングアプリ ボイスチェンジャー
1 Windows Anaconda
2 Windows(WSL2) Docker wsl2+ubuntuで確認 wsl2+ubuntuで確認
3 Windows(WSL2) Anaconda ubuntuで確認
4 Mac(Intel) Anaconda 動作するが激重。(2019, corei5)
5 Mac(M1) Anaconda M1 MBA, M1 MBPで確認
6 Linux Docker debianで確認 debianで確認
7 Linux Anaconda
8 Colab Notebook 確認済み 確認済み

ある程度最近のものであればCPUでの稼働も可能です(i7-9700Kで実績あり。下記デモ参照)。

有志によるチュートリアル動画

v1.2.1.x

前準備編 ニコニコ動画 YouTube
要修正音声 ニコニコ動画 YouTube
前準備編2 ニコニコ動画 YouTube
学習編_前1 ニコニコ動画 YouTube
学習編_前2 ニコニコ動画 YouTube
学習編_後 ニコニコ動画 YouTube
リアルタイム編 ニコニコ動画 YouTube
質問編 ニコニコ動画 YouTube
応用編_九州そら ニコニコ動画 YouTube
応用編_音街ウナ ニコニコ動画 YouTube

Q&A

下記サイトをご参考ください。
不明な点がございましたら、以下のdiscordまでお問い合わせください。
https://github.com/isletennos/MMVC_Trainer/wiki/FAQ

MMVCコミュニティサーバ(discord)

開発の最新情報や、不明点のお問合せ、MMVCの活用法などMMVCに関するコミュニティサーバです。
https://discord.gg/2MGysH3QpD

MMVC開発者問い合わせ(PIXIV FANBOX)

MMVCに関する疑問・質問等の 開発者への問い合わせは下記PIXIV FANBOXで受け付けています。 https://mmvc.fanbox.cc/posts/6858033

Special thanks

Reference

https://arxiv.org/abs/2106.06103
https://github.com/jaywalnut310/vits

Author

Isle Tennos
Twitter : https://twitter.com/IsleTennos

mmvc_trainer's People

Contributors

amazongodman avatar isletennos avatar orikage avatar pipolll avatar sakuragozaru avatar srgr0 avatar stealthinu avatar tsut-ps avatar w-okada avatar y-chan avatar yrinda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mmvc_trainer's Issues

ONNX standalone

Hi! Thanks for the amazing open source work!

I was looking through onnx_export.py and onnx_bench.py and I was wondering how to run it end to end in a standalone Colab notebook.

Specifically, how do we replace dummy_specs = torch.rand(1, 257, 60) with a mp3/wav audio (of variable time length) converted to a torch Tensor (by rmvpe model? I'm really new to speech model architectures so not sure) with the ONNX converted checkpoint.

Thanks

Characters to be studied

In this repository, Which of the following options is the character to be studied?
(1) source character
(2) target character
(3) both source character and target character

Train_MMVC.ipynb の train_ms.py を実行するとエラーが出ました

Google Colabにて Train_MMVC.ipynb の 以下のセルを実行した際に、

!python train_ms.py -c configs/jsontest.json -m 20220311_24000 -fg fine_model/G_232000.pth -fd fine_model/D_232000.pth

以下のようなエラーが出てました。

[INFO] {'train': {'log_interval': 1000, 'eval_interval': 4000, 'seed': 1234, 'epochs': 10000, 'learning_rate': 0.0002, 'betas': [0.8, 0.99], 'eps': 1e-09, 'batch_size': 16, 'fp16_run': True, 'lr_decay': 0.999875, 'segment_size': 4096, 'init_lr_ratio': 1, 'warmup_epochs': 0, 'c_mel': 45, 'c_kl': 1.0}, 'data': {'training_files': 'filelists/jsontest_textful.txt', 'validation_files': 'filelists/jsontest_textful_val.txt', 'training_files_notext': 'filelists/jsontest_textless.txt', 'validation_files_notext': 'filelists/jsontest_val_textless.txt', 'text_cleaners': ['japanese_cleaners'], 'max_wav_value': 32768.0, 'sampling_rate': 24000, 'filter_length': 1024, 'hop_length': 256, 'win_length': 1024, 'n_mel_channels': 80, 'mel_fmin': 0.0, 'mel_fmax': None, 'add_blank': True, 'n_speakers': 104, 'cleaned_text': False}, 'model': {'inter_channels': 192, 'hidden_channels': 192, 'filter_channels': 768, 'n_heads': 2, 'n_layers': 6, 'kernel_size': 3, 'p_dropout': 0.1, 'resblock': '1', 'resblock_kernel_sizes': [3, 7, 11], 'resblock_dilation_sizes': [[1, 3, 5], [1, 3, 5], [1, 3, 5]], 'upsample_rates': [8, 8, 2, 2], 'upsample_initial_channel': 512, 'upsample_kernel_sizes': [16, 8, 4, 4], 'n_layers_q': 3, 'use_spectral_norm': False, 'gin_channels': 256}, 'fine_flag': True, 'fine_model_g': 'fine_model/G_232000.pth', 'fine_model_d': 'fine_model/D_232000.pth', 'model_dir': './logs/20220311_24000'}
0it [00:00, ?it/s]
0it [00:00, ?it/s]
[INFO] FineTuning : True
[INFO] Load model : fine_model/G_232000.pth
[INFO] Load model : fine_model/D_232000.pth
Traceback (most recent call last):
  File "train_ms.py", line 303, in <module>
    main()
  File "train_ms.py", line 53, in main
    mp.spawn(run, nprocs=n_gpus, args=(n_gpus, hps,))
  File "/usr/local/lib/python3.7/dist-packages/torch/multiprocessing/spawn.py", line 200, in spawn
    return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
  File "/usr/local/lib/python3.7/dist-packages/torch/multiprocessing/spawn.py", line 158, in start_processes
    while not context.join():
  File "/usr/local/lib/python3.7/dist-packages/torch/multiprocessing/spawn.py", line 119, in join
    raise Exception(msg)
Exception: 

-- Process 0 terminated with the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/torch/multiprocessing/spawn.py", line 20, in _wrap
    fn(i, *args)
  File "/content/drive/MyDrive/MMVC_Trainer/train_ms.py", line 108, in run
    _, _, _, epoch_str = utils.load_checkpoint(hps.fine_model_g, net_g, optim_g)
  File "/content/drive/MyDrive/MMVC_Trainer/utils.py", line 38, in load_checkpoint
    model.module.load_state_dict(new_state_dict)
  File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1045, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SynthesizerTrn:
	size mismatch for emb_g.weight: copying a param with shape torch.Size([106, 256]) from checkpoint, the shape in current model is torch.Size([104, 256]).

実行したノートブックのURLは以下にあります。なにかの参考になれば幸いです🙇
https://colab.research.google.com/drive/1VWYkTNjftG3MeCSdgesiPgw5NIE9E0WN?authuser=1

Questions about MMVC_Trainer

I have some questions about MMVC_Trainer.

(1) G_180000.pth and D_180000.pth
In the fine_model, there are G_180000.pth and D_180000.pth model files.
What is G_180000.pth for?
What is D_180000.pth for?

(2) G_latest_99999999.pth and D_latest_99999999.pth
In the logs/20220306_24000, there are G_latest_99999999.pth and D_latest_99999999.pth model files.
What kind of training is done for G_latest_99999999.pth?
What kind of training is done for D_latest_99999999.pth?

Dockerfileがあったらいただけるとありがたいです

すばらしいプロジェクトを公開してくださりありがとうございます!

WSL2+Dockerで学習してみたいので、もし既に作成済みのDockerfileをお持ちでしたら、共有していただくことは可能でしょうか?

よろしくお願いいたします!

MMVC_Trainerの設定ファイルの作成失敗

MMVC_Trainerの設定ファイルの作成のipynbをgoogle colabで実行した際、4番のconfig系Fileを作成するセルの出力末尾に以下のエラーが出てbaseconfigではないファイルが生成されません

...(略)
['らーてゃん。']
WARNING: JPCommonLabel_insert_pause() in jpcommon_label.c: First mora should not be short pause.
sil-r-a-a-ty-a-N-sil
dataset/textful/00_myvoice/wav/emotion099.wav|0|sil-r-a-a-ty-a-N-sil
Errordataset/textful/01_target/wav に音声データがありません

5番の確認セル出力

Directory: filelists


Directory: configs
baseconfig.json

wslで実行

torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGSEGV
というエラーが出て実行できませんでした。
まだcolab上でしか動作しませんか?

Questions about "03_MMVC_Interface.ipynb"

I run 03_MMVC_Interface.ipynb and I have questions about it.

(1) SOURCE_SPEAKER_ID
SOURCE_SPEAKER_ID is preset as 107.
Then, I'd like to use many source speaker trained model.
How do I set the ID number for them?

(2) TARGET_ID
TARGET_ID is preset as 100.
Then, I'd like to use many target speaker trained model.
How do I set the ID number for them?

(3) TARGET_ID trained model
source speaker's trained model is saved in log folder.
Where should I put the target speakder trained model?

00_Rec_Voice.ipynbで録音終了時にエラー

READMEの「Open in Colab」を押下して00_Clone_Repo.ipynbを実行後、00_Rec_Voice.ipynbを実行して録音作業を行ったところ、録音終了時に下記のエラーが発生しました。
librosa.displayのwaveplotはlibrosa 0.9で削除されたメソッドのようですが、意図せず想定よりも新しすぎるバージョンがインストールされてしまっているということでしょうか?

※ waveplotをwaveshowに書き換えれば一応動くようです。これが意図した表示かはわからないですが…

えっ嘘でしょ。
えっうそでしょ。
---終了---
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-65ce3032714f> in <cell line: 1>()
----> 1 rec(3, "emotion001", "えっ嘘でしょ。", "えっうそでしょ。")

<ipython-input-10-0d9a847134a7> in rec(sec, filename, text, hira)
     72   with open(mytext_dir + filename + ".txt", 'w') as mytext:
     73     mytext.write(hira)
---> 74   librosa.display.waveplot(speecht, sr=rate)
     75   plt.show()
     76   display(Audio(speecht, rate=rate))

AttributeError: module 'librosa.display' has no attribute 'waveplot'

No way to train voice for use in Colab notebook

I've seen the tutorials to set up MMVC and everything installed but the tutorial videos never explain how to generate the .json files needed to then train with Colab again. I've looked in forums with no luck. Is there something I'm missing or is that information region-locked to Japan? I really want to get this software working, I don't want to have to get a new computer and GPU to use the original w-okada version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.