mrq commited on
Commit
0b62ccc
·
1 Parent(s): c4edfb7

setup bnb on windows as needed

Browse files
Files changed (5) hide show
  1. modules/dlas +1 -1
  2. requirements.txt +2 -1
  3. setup-cuda-bnb.bat +6 -0
  4. setup-cuda.bat +3 -4
  5. src/utils.py +24 -2
modules/dlas CHANGED
@@ -1 +1 @@
1
- Subproject commit 0db8ebc543db46c8f533393f39bc1c168f4ee8eb
 
1
+ Subproject commit 7b5e0592f875772cfed27f00fe16928a503c582a
requirements.txt CHANGED
@@ -5,4 +5,5 @@ ffmpeg-python
5
  gradio
6
  music-tag
7
  voicefixer
8
- psutil
 
 
5
  gradio
6
  music-tag
7
  voicefixer
8
+ psutil
9
+ phonemizer
setup-cuda-bnb.bat ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+ git clone https://git.ecker.tech/mrq/bitsandbytes-windows.git .\modules\bitsandbytes-windows\
3
+
4
+ xcopy .\modules\bitsandbytes-windows\bin\* .\venv\Lib\site-packages\bitsandbytes\. /Y
5
+ xcopy .\modules\bitsandbytes-windows\bin\cuda_setup\* .\venv\Lib\site-packages\bitsandbytes\cuda_setup\. /Y
6
+ xcopy .\modules\bitsandbytes-windows\bin\nn\* .\venv\Lib\site-packages\bitsandbytes\nn\. /Y
setup-cuda.bat CHANGED
@@ -10,11 +10,10 @@ python -m pip install -e .\modules\tortoise-tts\
10
  python -m pip install -r .\modules\dlas\requirements.txt
11
  python -m pip install -r .\requirements.txt
12
 
13
- xcopy .\modules\dlas\bitsandbytes_windows\* .\venv\Lib\site-packages\bitsandbytes\. /Y
14
- xcopy .\modules\dlas\bitsandbytes_windows\cuda_setup\* .\venv\Lib\site-packages\bitsandbytes\cuda_setup\. /Y
15
- xcopy .\modules\dlas\bitsandbytes_windows\nn\* .\venv\Lib\site-packages\bitsandbytes\nn\. /Y
16
 
17
  del *.sh
18
 
19
  pause
20
- deactivate
 
10
  python -m pip install -r .\modules\dlas\requirements.txt
11
  python -m pip install -r .\requirements.txt
12
 
13
+ # setup BnB
14
+ .\setup-cuda-bnb.bat
 
15
 
16
  del *.sh
17
 
18
  pause
19
+ deactivate
src/utils.py CHANGED
@@ -22,7 +22,7 @@ import yaml
22
  import hashlib
23
  import string
24
 
25
- import tqdm
26
  import torch
27
  import torchaudio
28
  import music_tag
@@ -1269,6 +1269,28 @@ def phonemizer( text, language="eng" ):
1269
  return ["_" if p in ignored else p for p in phones]
1270
  """
1271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1272
  def prepare_dataset( voice, use_segments=False, text_length=0, audio_length=0, progress=gr.Progress() ):
1273
  indir = f'./training/{voice}/'
1274
  infile = f'{indir}/whisper.json'
@@ -1858,7 +1880,7 @@ def enumerate_progress(iterable, desc=None, progress=None, verbose=None):
1858
  print(desc)
1859
 
1860
  if progress is None:
1861
- return tqdm(iterable, disable=not verbose)
1862
  return progress.tqdm(iterable, desc=f'{progress.msg_prefix} {desc}' if hasattr(progress, 'msg_prefix') else desc, track_tqdm=True)
1863
 
1864
  def notify_progress(message, progress=None, verbose=True):
 
22
  import hashlib
23
  import string
24
 
25
+ from tqdm import tqdm
26
  import torch
27
  import torchaudio
28
  import music_tag
 
1269
  return ["_" if p in ignored else p for p in phones]
1270
  """
1271
 
1272
+ def phonemize_txt( path ):
1273
+ with open(path, 'r', encoding='utf-8') as f:
1274
+ lines = f.readlines()
1275
+
1276
+ reparsed = []
1277
+ with open(path.replace(".txt", ".phn.txt"), 'a', encoding='utf-8') as f:
1278
+ for line in enumerate_progress(lines, desc='Phonemizing...'):
1279
+ split = line.split("|")
1280
+ audio = split[0]
1281
+ text = split[2]
1282
+
1283
+ phonemes = phonemizer( text, preserve_punctuation=True, strip=True )
1284
+ reparsed.append(f'{audio}|{phonemes}')
1285
+ f.write(f'\n{audio}|{phonemes}')
1286
+
1287
+
1288
+ joined = "\n".join(reparsed)
1289
+ with open(path.replace(".txt", ".phn.txt"), 'w', encoding='utf-8') as f:
1290
+ f.write(joined)
1291
+
1292
+ return joined
1293
+
1294
  def prepare_dataset( voice, use_segments=False, text_length=0, audio_length=0, progress=gr.Progress() ):
1295
  indir = f'./training/{voice}/'
1296
  infile = f'{indir}/whisper.json'
 
1880
  print(desc)
1881
 
1882
  if progress is None:
1883
+ return tqdm(iterable, disable=False) #not verbose)
1884
  return progress.tqdm(iterable, desc=f'{progress.msg_prefix} {desc}' if hasattr(progress, 'msg_prefix') else desc, track_tqdm=True)
1885
 
1886
  def notify_progress(message, progress=None, verbose=True):