jbetker commited on
Commit
b1fc2b1
1 Parent(s): 0ffc191

add support for specifying the model_dir

Browse files
Files changed (2) hide show
  1. tortoise/do_tts.py +3 -1
  2. tortoise/read.py +4 -1
tortoise/do_tts.py CHANGED
@@ -16,10 +16,12 @@ if __name__ == '__main__':
16
  help='How to balance vocal diversity with the quality/intelligibility of the spoken text. 0 means highly diverse voice (not recommended), 1 means maximize intellibility',
17
  default=.5)
18
  parser.add_argument('--output_path', type=str, help='Where to store outputs.', default='results/')
 
 
19
  args = parser.parse_args()
20
  os.makedirs(args.output_path, exist_ok=True)
21
 
22
- tts = TextToSpeech()
23
 
24
  selected_voices = args.voice.split(',')
25
  for voice in selected_voices:
 
16
  help='How to balance vocal diversity with the quality/intelligibility of the spoken text. 0 means highly diverse voice (not recommended), 1 means maximize intellibility',
17
  default=.5)
18
  parser.add_argument('--output_path', type=str, help='Where to store outputs.', default='results/')
19
+ parser.add_argument('--model_dir', type=str, help='Where to find pretrained model checkpoints. Tortoise automatically downloads these to .models, so this'
20
+ 'should only be specified if you have custom checkpoints.', default='.models')
21
  args = parser.parse_args()
22
  os.makedirs(args.output_path, exist_ok=True)
23
 
24
+ tts = TextToSpeech(models_dir=args.model_dir)
25
 
26
  selected_voices = args.voice.split(',')
27
  for voice in selected_voices:
tortoise/read.py CHANGED
@@ -37,13 +37,17 @@ if __name__ == '__main__':
37
  parser.add_argument('--voice_diversity_intelligibility_slider', type=float,
38
  help='How to balance vocal diversity with the quality/intelligibility of the spoken text. 0 means highly diverse voice (not recommended), 1 means maximize intellibility',
39
  default=.5)
 
 
40
  args = parser.parse_args()
 
41
 
42
  outpath = args.output_path
43
  selected_voices = args.voice.split(',')
44
  regenerate = args.regenerate
45
  if regenerate is not None:
46
  regenerate = [int(e) for e in regenerate.split(',')]
 
47
  for selected_voice in selected_voices:
48
  voice_outpath = os.path.join(outpath, selected_voice)
49
  os.makedirs(voice_outpath, exist_ok=True)
@@ -51,7 +55,6 @@ if __name__ == '__main__':
51
  with open(args.textfile, 'r', encoding='utf-8') as f:
52
  text = ''.join([l for l in f.readlines()])
53
  texts = split_and_recombine_text(text)
54
- tts = TextToSpeech()
55
 
56
  if '&' in selected_voice:
57
  voice_sel = selected_voice.split('&')
 
37
  parser.add_argument('--voice_diversity_intelligibility_slider', type=float,
38
  help='How to balance vocal diversity with the quality/intelligibility of the spoken text. 0 means highly diverse voice (not recommended), 1 means maximize intellibility',
39
  default=.5)
40
+ parser.add_argument('--model_dir', type=str, help='Where to find pretrained model checkpoints. Tortoise automatically downloads these to .models, so this'
41
+ 'should only be specified if you have custom checkpoints.', default='.models')
42
  args = parser.parse_args()
43
+ tts = TextToSpeech(models_dir=args.model_dir)
44
 
45
  outpath = args.output_path
46
  selected_voices = args.voice.split(',')
47
  regenerate = args.regenerate
48
  if regenerate is not None:
49
  regenerate = [int(e) for e in regenerate.split(',')]
50
+
51
  for selected_voice in selected_voices:
52
  voice_outpath = os.path.join(outpath, selected_voice)
53
  os.makedirs(voice_outpath, exist_ok=True)
 
55
  with open(args.textfile, 'r', encoding='utf-8') as f:
56
  text = ''.join([l for l in f.readlines()])
57
  texts = split_and_recombine_text(text)
 
58
 
59
  if '&' in selected_voice:
60
  voice_sel = selected_voice.split('&')