Spaces:
Runtime error
Runtime error
AkhilTolani
commited on
Commit
•
09acd34
1
Parent(s):
7e3c100
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ custom_repo_id = "AkhilTolani/vocals-english"
|
|
19 |
|
20 |
custom_model = ParlerTTSForConditionalGeneration.from_pretrained(custom_repo_id).to(device)
|
21 |
|
22 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
23 |
|
24 |
SEED = 456
|
25 |
|
@@ -168,12 +168,6 @@ class ParlerTTSStreamer(BaseStreamer):
|
|
168 |
sampling_rate = custom_model.audio_encoder.config.sampling_rate
|
169 |
frame_rate = custom_model.audio_encoder.config.frame_rate
|
170 |
|
171 |
-
def calculate_min_length(text, words_per_beat=2.0, beats_per_second=3.16):
|
172 |
-
words = len(text.split())
|
173 |
-
total_beats = words / words_per_beat
|
174 |
-
min_length_seconds = total_beats / beats_per_second
|
175 |
-
return int(min_length_seconds)
|
176 |
-
|
177 |
@spaces.GPU
|
178 |
def generate_base(text, description, play_steps_in_s=2.0):
|
179 |
play_steps = int(frame_rate * play_steps_in_s)
|
@@ -182,13 +176,11 @@ def generate_base(text, description, play_steps_in_s=2.0):
|
|
182 |
inputs = tokenizer(description, return_tensors="pt").to(device)
|
183 |
prompt = tokenizer(text, return_tensors="pt").to(device)
|
184 |
|
185 |
-
min_length_seconds = calculate_min_length(text)
|
186 |
-
|
187 |
generation_kwargs = dict(
|
188 |
input_ids=inputs.input_ids,
|
189 |
prompt_input_ids=prompt.input_ids,
|
190 |
streamer=streamer,
|
191 |
-
min_length=
|
192 |
)
|
193 |
|
194 |
set_seed(SEED)
|
|
|
19 |
|
20 |
custom_model = ParlerTTSForConditionalGeneration.from_pretrained(custom_repo_id).to(device)
|
21 |
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained("parler-tts/parler_tts_mini_v0.1")
|
23 |
|
24 |
SEED = 456
|
25 |
|
|
|
168 |
sampling_rate = custom_model.audio_encoder.config.sampling_rate
|
169 |
frame_rate = custom_model.audio_encoder.config.frame_rate
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
@spaces.GPU
|
172 |
def generate_base(text, description, play_steps_in_s=2.0):
|
173 |
play_steps = int(frame_rate * play_steps_in_s)
|
|
|
176 |
inputs = tokenizer(description, return_tensors="pt").to(device)
|
177 |
prompt = tokenizer(text, return_tensors="pt").to(device)
|
178 |
|
|
|
|
|
179 |
generation_kwargs = dict(
|
180 |
input_ids=inputs.input_ids,
|
181 |
prompt_input_ids=prompt.input_ids,
|
182 |
streamer=streamer,
|
183 |
+
min_length=20,
|
184 |
)
|
185 |
|
186 |
set_seed(SEED)
|