Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,6 +60,7 @@ def process_prompt(prompt, voice, tokenizer, device):
|
|
| 60 |
return modified_input_ids.to(device), attention_mask.to(device)
|
| 61 |
|
| 62 |
# Generate speech tokens
|
|
|
|
| 63 |
def generate_speech_tokens(input_ids, attention_mask, model, params):
|
| 64 |
with torch.no_grad():
|
| 65 |
generated_ids = model.generate(
|
|
@@ -130,7 +131,6 @@ def redistribute_codes(code_list, snac_model):
|
|
| 130 |
return audio_hat.detach().squeeze().cpu().numpy() # Always return CPU numpy array
|
| 131 |
|
| 132 |
# Main generation function
|
| 133 |
-
spaces.GPU()
|
| 134 |
def generate_speech(text, voice, temperature, top_p, repetition_penalty, max_new_tokens, progress=gr.Progress()):
|
| 135 |
if not text.strip():
|
| 136 |
return None
|
|
|
|
| 60 |
return modified_input_ids.to(device), attention_mask.to(device)
|
| 61 |
|
| 62 |
# Generate speech tokens
|
| 63 |
+
@spaces.GPU()
|
| 64 |
def generate_speech_tokens(input_ids, attention_mask, model, params):
|
| 65 |
with torch.no_grad():
|
| 66 |
generated_ids = model.generate(
|
|
|
|
| 131 |
return audio_hat.detach().squeeze().cpu().numpy() # Always return CPU numpy array
|
| 132 |
|
| 133 |
# Main generation function
|
|
|
|
| 134 |
def generate_speech(text, voice, temperature, top_p, repetition_penalty, max_new_tokens, progress=gr.Progress()):
|
| 135 |
if not text.strip():
|
| 136 |
return None
|