setup bnb on windows as needed

This commit is contained in:
mrq 2023-03-16 20:48:48 +00:00
parent c4edfb7d5e
commit 0b62ccc112
5 changed files with 36 additions and 8 deletions

@ -1 +1 @@
Subproject commit 0db8ebc543db46c8f533393f39bc1c168f4ee8eb Subproject commit 7b5e0592f875772cfed27f00fe16928a503c582a

View File

@ -6,3 +6,4 @@ gradio
music-tag music-tag
voicefixer voicefixer
psutil psutil
phonemizer

6
setup-cuda-bnb.bat Normal file
View File

@ -0,0 +1,6 @@
git clone https://git.ecker.tech/mrq/bitsandbytes-windows.git .\modules\bitsandbytes-windows\
xcopy .\modules\bitsandbytes-windows\bin\* .\venv\Lib\site-packages\bitsandbytes\. /Y
xcopy .\modules\bitsandbytes-windows\bin\cuda_setup\* .\venv\Lib\site-packages\bitsandbytes\cuda_setup\. /Y
xcopy .\modules\bitsandbytes-windows\bin\nn\* .\venv\Lib\site-packages\bitsandbytes\nn\. /Y

View File

@ -10,9 +10,8 @@ python -m pip install -e .\modules\tortoise-tts\
python -m pip install -r .\modules\dlas\requirements.txt python -m pip install -r .\modules\dlas\requirements.txt
python -m pip install -r .\requirements.txt python -m pip install -r .\requirements.txt
xcopy .\modules\dlas\bitsandbytes_windows\* .\venv\Lib\site-packages\bitsandbytes\. /Y # setup BnB
xcopy .\modules\dlas\bitsandbytes_windows\cuda_setup\* .\venv\Lib\site-packages\bitsandbytes\cuda_setup\. /Y .\setup-cuda-bnb.bat
xcopy .\modules\dlas\bitsandbytes_windows\nn\* .\venv\Lib\site-packages\bitsandbytes\nn\. /Y
del *.sh del *.sh

View File

@ -22,7 +22,7 @@ import yaml
import hashlib import hashlib
import string import string
import tqdm from tqdm import tqdm
import torch import torch
import torchaudio import torchaudio
import music_tag import music_tag
@ -1269,6 +1269,28 @@ def phonemizer( text, language="eng" ):
return ["_" if p in ignored else p for p in phones] return ["_" if p in ignored else p for p in phones]
""" """
def phonemize_txt( path ):
with open(path, 'r', encoding='utf-8') as f:
lines = f.readlines()
reparsed = []
with open(path.replace(".txt", ".phn.txt"), 'a', encoding='utf-8') as f:
for line in enumerate_progress(lines, desc='Phonemizing...'):
split = line.split("|")
audio = split[0]
text = split[2]
phonemes = phonemizer( text, preserve_punctuation=True, strip=True )
reparsed.append(f'{audio}|{phonemes}')
f.write(f'\n{audio}|{phonemes}')
joined = "\n".join(reparsed)
with open(path.replace(".txt", ".phn.txt"), 'w', encoding='utf-8') as f:
f.write(joined)
return joined
def prepare_dataset( voice, use_segments=False, text_length=0, audio_length=0, progress=gr.Progress() ): def prepare_dataset( voice, use_segments=False, text_length=0, audio_length=0, progress=gr.Progress() ):
indir = f'./training/{voice}/' indir = f'./training/{voice}/'
infile = f'{indir}/whisper.json' infile = f'{indir}/whisper.json'
@ -1858,7 +1880,7 @@ def enumerate_progress(iterable, desc=None, progress=None, verbose=None):
print(desc) print(desc)
if progress is None: if progress is None:
return tqdm(iterable, disable=not verbose) return tqdm(iterable, disable=False) #not verbose)
return progress.tqdm(iterable, desc=f'{progress.msg_prefix} {desc}' if hasattr(progress, 'msg_prefix') else desc, track_tqdm=True) return progress.tqdm(iterable, desc=f'{progress.msg_prefix} {desc}' if hasattr(progress, 'msg_prefix') else desc, track_tqdm=True)
def notify_progress(message, progress=None, verbose=True): def notify_progress(message, progress=None, verbose=True):