国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Bert-vits2最終版Bert-vits2-2.3云端訓練和推理(Colab免費GPU算力平臺)

這篇具有很好參考價值的文章主要介紹了Bert-vits2最終版Bert-vits2-2.3云端訓練和推理(Colab免費GPU算力平臺)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Bert-vits2最終版Bert-vits2-2.3云端訓練和推理(Colab免費GPU算力平臺)

對于深度學習初學者來說,JupyterNoteBook的腳本運行形式顯然更加友好,依托Python語言的跨平臺特性,JupyterNoteBook既可以在本地線下環(huán)境運行,也可以在線上服務器上運行。GoogleColab作為免費GPU算力平臺的執(zhí)牛耳者,更是讓JupyterNoteBook的腳本運行形式如虎添翼。

本次我們利用Bert-vits2的最終版Bert-vits2-v2.3和JupyterNoteBook的腳本來復刻生化危機6的人氣角色艾達王(ada wong)。

本地調試JupyterNoteBook

眾所周知,GoogleColab雖然可以免費提供GPU讓用戶用于模型訓練和推理,但是每一個JupyterNoteBook文件腳本最多只能運行12小時,隨后就會被限制,所以為了避免浪費寶貴的GPU使用時間,我們可以在線下調試自己的JupyterNoteBook腳本,調試成功后,就可以把腳本直接上傳到GoogleColab平臺。

首先通過pip命令進行本地安裝:

python3 -m pip install jupyter

隨后運行啟動命令:

jupyter notebook

此時,訪問本地的notebook地址:

隨后選擇文件-》新建-》Notebook 即可。

輸入筆記內容:

#@title 查看顯卡  
!nvidia-smi

點擊運行單元格:

程序返回:

#@title 查看顯卡  
!nvidia-smi  
Wed Dec 27 12:36:10 2023         
+---------------------------------------------------------------------------------------+  
| NVIDIA-SMI 546.17                 Driver Version: 546.17       CUDA Version: 12.3     |  
|-----------------------------------------+----------------------+----------------------+  
| GPU  Name                     TCC/WDDM  | Bus-Id        Disp.A | Volatile Uncorr. ECC |  
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |  
|                                         |                      |               MIG M. |  
|=========================================+======================+======================|  
|   0  NVIDIA GeForce RTX 4060 ...  WDDM  | 00000000:01:00.0 Off |                  N/A |  
| N/A   50C    P0              20W / 115W |      0MiB /  8188MiB |      0%      Default |  
|                                         |                      |                  N/A |  
+-----------------------------------------+----------------------+----------------------+  
                                                                                           
+---------------------------------------------------------------------------------------+  
| Processes:                                                                            |  
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |  
|        ID   ID                                                             Usage      |  
|=======================================================================================|  
|  No running processes found                                                           |  
+---------------------------------------------------------------------------------------+

至此,就可以在本地調試NoteBook了。

安裝ffmpeg

新增單元格:

#@title 安裝ffmpeg  
import os, uuid, re, IPython  
import ipywidgets as widgets  
import time  
  
from glob import glob  
from google.colab import output, drive  
  
from IPython.display import clear_output  
import os, sys, urllib.request  
HOME = os.path.expanduser("~")  
pathDoneCMD = f'{HOME}/doneCMD.sh'  
if not os.path.exists(f"{HOME}/.ipython/ttmg.py"):  
    hCode = "https://raw.githubusercontent.com/yunooooo/gcct/master/res/ttmg.py"  
    urllib.request.urlretrieve(hCode, f"{HOME}/.ipython/ttmg.py")  
  
from ttmg import (  
    loadingAn,  
    textAn,  
)  
  
loadingAn(name="lds")  
textAn("Cloning Repositories...", ty='twg')  
!git clone https://github.com/XniceCraft/ffmpeg-colab.git  
!chmod 755 ./ffmpeg-colab/install  
textAn("Installing FFmpeg...", ty='twg')  
!./ffmpeg-colab/install  
clear_output()  
print('Installation finished!')  
!rm -fr /content/ffmpeg-colab  
!ffmpeg -version

由于語音轉寫需要ffmpeg的參與,所以需要安裝ffmpeg的最新版本。

程序返回:

Installation finished!  
c Copyright (c) 2000-2023 the FFmpeg developers  
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)  
configuration: --prefix=/home/ffmpeg-builder/release --pkg-config-flags=--static --extra-libs=-lm --disable-doc --disable-debug --disable-shared --disable-ffprobe --enable-static --enable-gpl --enable-version3 --enable-runtime-cpudetect --enable-avfilter --enable-filters --enable-nvenc --enable-nvdec --enable-cuvid --toolchain=hardened --disable-stripping --enable-opengl --pkgconfigdir=/home/ffmpeg-builder/release/lib/pkgconfig --extra-cflags='-I/home/ffmpeg-builder/release/include -static-libstdc++ -static-libgcc ' --extra-ldflags='-L/home/ffmpeg-builder/release/lib -fstack-protector -static-libstdc++ -static-libgcc ' --extra-cxxflags=' -static-libstdc++ -static-libgcc ' --extra-libs='-ldl -lrt -lpthread' --enable-ffnvcodec --enable-gmp --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libkvazaar --enable-libmp3lame --enable-libopus --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libshine --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtheora --enable-libvidstab --ld=g++ --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-openssl --enable-zlib --enable-nonfree --extra-libs=-lpthread --enable-pthreads --extra-libs=-lgomp  
libavutil      58.  2.100 / 58.  2.100  
libavcodec     60.  3.100 / 60.  3.100  
libavformat    60.  3.100 / 60.  3.100  
libavdevice    60.  1.100 / 60.  1.100  
libavfilter     9.  3.100 /  9.  3.100  
libswscale      7.  1.100 /  7.  1.100  
libswresample   4. 10.100 /  4. 10.100  
libpostproc    57.  1.100 / 57.  1.100

這里安裝的是最新版ffmpeg version 6.0

克隆代碼庫

接著克隆代碼庫:

#@title 克隆代碼倉庫  
!git clone https://github.com/v3ucn/Bert-vits2-V2.3.git

程序返回:

Cloning into 'Bert-vits2-V2.3'...  
remote: Enumerating objects: 234, done.  
remote: Counting objects: 100% (234/234), done.  
remote: Compressing objects: 100% (142/142), done.  
remote: Total 234 (delta 80), reused 232 (delta 78), pack-reused 0  
Receiving objects: 100% (234/234), 4.16 MiB | 14.14 MiB/s, done.  
Resolving deltas: 100% (80/80), done.

安裝項目依賴

隨后進入項目的目錄,安裝依賴:

#@title 安裝所需要的依賴  
%cd /content/Bert-vits2-V2.3  
!pip install -r requirements.txt

下載必要的模型

新增單元格,下載模型:

#@title 下載必要的模型  
!wget -P slm/wavlm-base-plus/ https://huggingface.co/microsoft/wavlm-base-plus/resolve/main/pytorch_model.bin  
!wget -P emotional/clap-htsat-fused/ https://huggingface.co/laion/clap-htsat-fused/resolve/main/pytorch_model.bin  
!wget -P emotional/wav2vec2-large-robust-12-ft-emotion-msp-dim/ https://huggingface.co/audeering/wav2vec2-large-robust-12-ft-emotion-msp-dim/resolve/main/pytorch_model.bin  
!wget -P bert/chinese-roberta-wwm-ext-large/ https://huggingface.co/hfl/chinese-roberta-wwm-ext-large/resolve/main/pytorch_model.bin  
!wget -P bert/bert-base-japanese-v3/ https://huggingface.co/cl-tohoku/bert-base-japanese-v3/resolve/main/pytorch_model.bin  
!wget -P bert/deberta-v3-large/ https://huggingface.co/microsoft/deberta-v3-large/resolve/main/pytorch_model.bin  
!wget -P bert/deberta-v3-large/ https://huggingface.co/microsoft/deberta-v3-large/resolve/main/pytorch_model.generator.bin  
!wget -P bert/deberta-v2-large-japanese/ https://huggingface.co/ku-nlp/deberta-v2-large-japanese/resolve/main/pytorch_model.bin

下載底模文件

接著下載預訓練模型的底模:

#@title 下載底模文件  
  
!wget -P Data/ada/models/ https://huggingface.co/OedoSoldier/Bert-VITS2-2.3/resolve/main/DUR_0.pth  
!wget -P Data/ada/models/ https://huggingface.co/OedoSoldier/Bert-VITS2-2.3/resolve/main/D_0.pth  
!wget -P Data/ada/models/ https://huggingface.co/OedoSoldier/Bert-VITS2-2.3/resolve/main/G_0.pth  
!wget -P Data/ada/models/ https://huggingface.co/OedoSoldier/Bert-VITS2-2.3/resolve/main/WD_0.pth

注意2.3版本的底模是4個。

切分數(shù)據(jù)集

接著把艾達王的音頻素材上傳到Data/ada/raw/ada.wav

隨后新建單元格:

#@title 切分數(shù)據(jù)集  
  
!python3 audio_slicer.py

素材就會被切分。

轉寫和標注

此時我們需要把切片素材轉寫:

#@title 轉寫和標注  
!pip install git+https://github.com/openai/whisper.git  
!python3 short_audio_transcribe.py

注意這里單獨安裝whisper,很多人直接用 pip install whisper,其實這不是正確的安裝方式,需要單獨指定安裝源:pip install git+https://github.com/openai/whisper.git,切記,否則會報錯。

執(zhí)行完畢后會在角色目錄生成轉寫文件esd.list:

./Data\ada\wavs\ada_0.wav|ada|EN|I do. The kind you like.  
./Data\ada\wavs\ada_1.wav|ada|EN|Now where's the amber?  
./Data\ada\wavs\ada_10.wav|ada|EN|Leave the girl. She's lost no matter what.  
./Data\ada\wavs\ada_11.wav|ada|EN|You walk away now, and who knows?  
./Data\ada\wavs\ada_12.wav|ada|EN|Maybe you'll live to meet me again.  
./Data\ada\wavs\ada_13.wav|ada|EN|And I might get you that greeting you were looking for.  
./Data\ada\wavs\ada_14.wav|ada|EN|How about we continue this discussion another time?  
./Data\ada\wavs\ada_15.wav|ada|EN|Sorry, nothing yet.  
./Data\ada\wavs\ada_16.wav|ada|EN|But my little helper is creating  
./Data\ada\wavs\ada_17.wav|ada|EN|Quite the commotion.  
./Data\ada\wavs\ada_18.wav|ada|EN|Everything will work out just fine.  
./Data\ada\wavs\ada_19.wav|ada|EN|He's a good boy. Predictable.  
./Data\ada\wavs\ada_2.wav|ada|EN|The deal was, we get you out of here when you deliver the amber. No amber, no protection, Louise.  
./Data\ada\wavs\ada_20.wav|ada|EN|Nothing personal, Leon.  
./Data\ada\wavs\ada_21.wav|ada|EN|Louise and I had an arrangement.  
./Data\ada\wavs\ada_22.wav|ada|EN|Don't worry, I'll take good care of it.  
./Data\ada\wavs\ada_23.wav|ada|EN|Just one question.  
./Data\ada\wavs\ada_24.wav|ada|EN|What are you planning to do with this?  
./Data\ada\wavs\ada_25.wav|ada|EN|So, we're talking millions of casualties?  
./Data\ada\wavs\ada_26.wav|ada|EN|We're changing course. Now.  
./Data\ada\wavs\ada_3.wav|ada|EN|You can stop right there, Leon.  
./Data\ada\wavs\ada_4.wav|ada|EN|wouldn't make me use this.  
./Data\ada\wavs\ada_5.wav|ada|EN|Would you? You don't seem surprised.  
./Data\ada\wavs\ada_6.wav|ada|EN|Interesting.  
./Data\ada\wavs\ada_7.wav|ada|EN|Not a bad move  
./Data\ada\wavs\ada_8.wav|ada|EN|Very smooth. Ah, Leon.  
./Data\ada\wavs\ada_9.wav|ada|EN|You know I don't work and tell.

這里一共27條切片語音,對應27個轉寫文本,注意語言是英語。

音頻重新采樣

對素材音頻進行重新采樣的操作:

#@title 重新采樣  
!python3 resample.py --sr 44100 --in_dir ./Data/ada/raw/ --out_dir ./Data/ada/wavs/

預處理標簽文件

接著處理轉寫文件,生成訓練集和驗證集:

#@title 預處理標簽文件  
!python3 preprocess_text.py --transcription-path ./Data/ada/esd.list --t

程序返回:

pytorch_model.bin: 100% 1.32G/1.32G [00:10<00:00, 122MB/s]   
spm.model: 100% 2.46M/2.46M [00:00<00:00, 115MB/s]  
The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a one-time only operation. You can interrupt this and resume the migration later on by calling `transformers.utils.move_cache()`.  
0it [00:00, ?it/s]  
[nltk_data] Downloading package averaged_perceptron_tagger to  
[nltk_data]     /root/nltk_data...  
[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.  
[nltk_data] Downloading package cmudict to /root/nltk_data...  
[nltk_data]   Unzipping corpora/cmudict.zip.  
100% 27/27 [00:00<00:00, 4457.63it/s]  
總重復音頻數(shù):0,總未找到的音頻數(shù):0  
訓練集和驗證集生成完成!

生成 BERT 特征文件

最后生成bert特征文件:

#@title 生成 BERT 特征文件  
!python3 bert_gen.py --config-path ./Data/ada/configs/config.json

對應27個素材:

100% 27/27 [00:33<00:00,  1.25s/it]  
bert生成完畢!, 共有27個bert.pt生成!

模型訓練

萬事俱備,開始訓練:

#@title 開始訓練  
!python3 train_ms.py

模型會在models目錄生成,項目默認設置了訓練間隔是50步,可以根據(jù)自己的需求修改config.json配置文件。

模型推理

一般情況下,訓練了50步或者100步左右,可以推理一下查看效果,然后繼續(xù)訓練:

#@title 開始推理  
!python3 webui.py

返回:

| numexpr.utils | INFO | NumExpr defaulting to 2 threads.  
/usr/local/lib/python3.10/dist-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.  
  warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")  
| utils | INFO | Loaded checkpoint 'Data/ada/models/G_150.pth' (iteration 25)  
推理頁面已開啟!  
Running on local URL:  http://127.0.0.1:7860  
Running on public URL: https://814833a6f477ba151c.gradio.live

點擊第二個公網(wǎng)地址進行推理即可。

結語

至此,我們已經完成了基于JupyterNoteBook的數(shù)據(jù)切分、轉寫、預處理、訓練以及推理流程。最后奉上線上GoogleColab,以饗眾鄉(xiāng)親:文章來源地址http://www.zghlxwxcb.cn/news/detail-760791.html

https://colab.research.google.com/drive/1-H1DGG5dTy8u_8vFbq1HACXPX9AAM76s?usp=sharing

到了這里,關于Bert-vits2最終版Bert-vits2-2.3云端訓練和推理(Colab免費GPU算力平臺)的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • Python - Bert-VITS2 自定義訓練語音

    Python - Bert-VITS2 自定義訓練語音

    目錄 一.引言 二.前期準備 1.Conda 環(huán)境搭建 2.Bert 模型下載 3.預訓練模型下載? 三.數(shù)據(jù)準備 1.音頻文件批量處理 2.訓練文件地址生成 3.模型訓練配置生成 4.訓練文件重采樣 5.Tensor pt 文件生成 四.模型訓練 1.預訓練模型 2.模型訓練 3.模型收菜 五.總結 前面我們通過視頻 OCR 技術識

    2024年01月20日
    瀏覽(25)
  • 又欲又撩人,基于新版Bert-vits2V2.0.2音色模型雷電將軍八重神子一鍵推理整合包分享

    Bert-vits2項目近期炸裂更新,放出了v2.0.2版本的代碼,修正了存在于2.0先前版本的重大bug,并且重煉了底模,本次更新是即1.1.1版本后最重大的更新,支持了三語言訓練及混合合成,并且做到向下兼容,可以推理老版本的模型,本次我們基于新版V2.0.2來本地推理原神小姐姐們的

    2024年02月05日
    瀏覽(27)
  • 如何快速部署本地訓練的 Bert-VITS2 語音模型到 Hugging Face

    如何快速部署本地訓練的 Bert-VITS2 語音模型到 Hugging Face

    Hugging Face是一個機器學習(ML)和數(shù)據(jù)科學平臺和社區(qū),幫助用戶構建、部署和訓練機器學習模型。它提供基礎設施,用于在實時應用中演示、運行和部署人工智能(AI)。用戶還可以瀏覽其他用戶上傳的模型和數(shù)據(jù)集。Hugging Face通常被稱為機器學習界的GitHub,因為它讓開發(fā)人

    2024年02月01日
    瀏覽(27)
  • 本地訓練,開箱可用,Bert-VITS2 V2.0.2版本本地基于現(xiàn)有數(shù)據(jù)集訓練(原神刻晴)

    本地訓練,開箱可用,Bert-VITS2 V2.0.2版本本地基于現(xiàn)有數(shù)據(jù)集訓練(原神刻晴)

    按照固有思維方式,深度學習的訓練環(huán)節(jié)應該在云端,畢竟本地硬件條件有限。但事實上,在語音識別和自然語言處理層面,即使相對較少的數(shù)據(jù)量也可以訓練出高性能的模型,對于預算有限的同學們來說,也沒必要花冤枉錢上“云端”了,本次我們來演示如何在本地訓練

    2024年02月05日
    瀏覽(20)
  • 本地訓練,立等可取,30秒音頻素材復刻霉霉講中文音色基于Bert-VITS2V2.0.2

    本地訓練,立等可取,30秒音頻素材復刻霉霉講中文音色基于Bert-VITS2V2.0.2

    之前我們使用Bert-VITS2V2.0.2版本對現(xiàn)有的原神數(shù)據(jù)集進行了本地訓練,但如果克隆對象脫離了原神角色,我們就需要自己構建數(shù)據(jù)集了,事實上,深度學習模型的性能和泛化能力都依托于所使用的數(shù)據(jù)集的質量和多樣性,本次我們在本地利用Bert-VITS2V2.0.2對霉霉講中文的音色進

    2024年02月05日
    瀏覽(19)
  • bert-vits2本地部署報錯疑難問題匯總

    bert-vits2本地部署報錯疑難問題匯總

    bert-vits2.3 win 和wsl bert-vits2本地部署報錯疑難問題匯總 問題1: Conda安裝requirements里面依賴出現(xiàn)ERROR: No matching distribution found for opencc==1.1.6 解決方法 問題2: error: Microsoft Visual C++ 14.0 or greater is required. Get it with \\\"Microsoft C++ Build Tool 解決方法 安裝VS2019 單獨安裝2個組件 問題3: 訓練報錯

    2024年02月19日
    瀏覽(28)
  • Bert-VITS-2 效果挺好的聲音克隆工具

    持中日英三語訓練和推理。內置干聲分離,切割和標注工具,開箱即用。請點下載量右邊的符號查看鏡像所對應的具體版本號。 教程地址: sjj???????CodeWithGPU | 能復現(xiàn)才是好算法 CodeWithGPU | GitHub AI算法復現(xiàn)社區(qū),能復現(xiàn)才是好算法 https://www.codewithgpu.com/i/fishaudio/Ber

    2024年02月21日
    瀏覽(18)
  • 義無反顧馬督工,Bert-vits2V210復刻馬督工實踐(Python3.10)

    義無反顧馬督工,Bert-vits2V210復刻馬督工實踐(Python3.10)

    Bert-vits2更新了版本V210,修正了日/英的bert對齊問題,效果進一步優(yōu)化;對底模使用的數(shù)據(jù)進行優(yōu)化和加量,減少finetune失敗以及電音的可能性;日語bert更換了模型,完善了多語言推理。 更多情報請參考Bert-vits2官網(wǎng): 最近的事情大家也都曉得了,馬督工義無反顧帶頭沖鋒,身

    2024年02月05日
    瀏覽(21)
  • 栩栩如生,音色克隆,Bert-vits2文字轉語音打造鬼畜視頻實踐(Python3.10)

    諸公可知目前最牛逼的TTS免費開源項目是哪一個?沒錯,是Bert-vits2,沒有之一。它是在本來已經極其強大的Vits項目中融入了Bert大模型,基本上解決了VITS的語氣韻律問題,在效果非常出色的情況下訓練的成本開銷普通人也完全可以接受。 BERT的核心思想是通過在大規(guī)模文本語

    2024年02月08日
    瀏覽(18)
  • 首次引入大模型!Bert-vits2-Extra中文特化版40秒素材復刻巫師3葉奈法

    首次引入大模型!Bert-vits2-Extra中文特化版40秒素材復刻巫師3葉奈法

    Bert-vits2項目又更新了,更新了一個新的分支:中文特化,所謂中文特化,即針對中文音色的特殊優(yōu)化版本,純中文底模效果百尺竿頭更進一步,同時首次引入了大模型,使用國產IDEA-CCNL/Erlangshen-MegatronBert-1.3B大模型作為Bert特征提取,基本上完全解決了發(fā)音的bad case,同時在情

    2024年02月03日
    瀏覽(34)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包