HanaeRateau commited on
Commit
915cfa4
1 Parent(s): f5385cd

Adds ollama to requirements and removes parlerTTS from models.

Browse files
Files changed (2) hide show
  1. TTS_models.py +17 -17
  2. requirements.txt +2 -1
TTS_models.py CHANGED
@@ -63,25 +63,25 @@ class Bark(TTSModel):
63
  ####################################################
64
  # pip install git+https://github.com/huggingface/parler-tts.git
65
 
66
- from parler_tts import ParlerTTSForConditionalGeneration
67
- from transformers import AutoTokenizer
68
-
69
- class ParlerTTS(TTSModel):
70
- def __init__(self, name="parler-tts/parler-tts-large-v1"):
71
- super(ParlerTTS, self).__init__(name)
72
- self.description = "A female speaker delivers a slightly expressive and animated speech with a moderate speed and pitch. The recording is of very high quality, with the speaker's voice sounding clear and very close up."
73
- self.model = ParlerTTSForConditionalGeneration.from_pretrained(self.hf_name).to(self.device)
74
- self.tokenizer = AutoTokenizer.from_pretrained(self.hf_name)
75
- # self.synthesiser = pipeline("text-to-speech", model=self.model, tokenizer=self.tokenizer, device=self.device)
76
 
77
- def synthesize(self, text):
78
- input_ids = self.tokenizer(self.description, return_tensors="pt").input_ids.to(self.device)
79
- prompt_input_ids = self.tokenizer(text, return_tensors="pt").input_ids.to(self.device)
 
 
 
 
80
 
81
- generation = self.model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
82
- speech = generation.cpu().numpy().squeeze()
83
- print("[ParlerTTS - synthesize]", speech)
84
- return speech
 
 
 
 
85
 
86
  ####################################################
87
  # PENDING: NOT WORKING FROM HF
 
63
  ####################################################
64
  # pip install git+https://github.com/huggingface/parler-tts.git
65
 
66
+ # from parler_tts import ParlerTTSForConditionalGeneration
67
+ # from transformers import AutoTokenizer
 
 
 
 
 
 
 
 
68
 
69
+ # class ParlerTTS(TTSModel):
70
+ # def __init__(self, name="parler-tts/parler-tts-large-v1"):
71
+ # super(ParlerTTS, self).__init__(name)
72
+ # self.description = "A female speaker delivers a slightly expressive and animated speech with a moderate speed and pitch. The recording is of very high quality, with the speaker's voice sounding clear and very close up."
73
+ # self.model = ParlerTTSForConditionalGeneration.from_pretrained(self.hf_name).to(self.device)
74
+ # self.tokenizer = AutoTokenizer.from_pretrained(self.hf_name)
75
+ # # self.synthesiser = pipeline("text-to-speech", model=self.model, tokenizer=self.tokenizer, device=self.device)
76
 
77
+ # def synthesize(self, text):
78
+ # input_ids = self.tokenizer(self.description, return_tensors="pt").input_ids.to(self.device)
79
+ # prompt_input_ids = self.tokenizer(text, return_tensors="pt").input_ids.to(self.device)
80
+
81
+ # generation = self.model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
82
+ # speech = generation.cpu().numpy().squeeze()
83
+ # print("[ParlerTTS - synthesize]", speech)
84
+ # return speech
85
 
86
  ####################################################
87
  # PENDING: NOT WORKING FROM HF
requirements.txt CHANGED
@@ -5,4 +5,5 @@ transformers
5
  gradio
6
  pypdf
7
  emoji
8
- coqui-tts
 
 
5
  gradio
6
  pypdf
7
  emoji
8
+ coqui-tts
9
+ ollama