Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -42,9 +42,9 @@ def redistribute_codes(row):
|
|
42 |
snac_model = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").to("cuda")
|
43 |
|
44 |
# Load the single-speaker language model
|
45 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
46 |
model = AutoModelForCausalLM.from_pretrained(
|
47 |
-
'
|
48 |
).cuda()
|
49 |
|
50 |
@spaces.GPU
|
@@ -52,7 +52,7 @@ def generate_audio(text, temperature, top_p, max_new_tokens):
|
|
52 |
"""
|
53 |
Given input text, generate speech audio.
|
54 |
"""
|
55 |
-
speaker = "
|
56 |
prompt = f'<custom_token_3><|begin_of_text|>{speaker}: {text}<|eot_id|><custom_token_4><custom_token_5><custom_token_1>'
|
57 |
input_ids = tokenizer(prompt, add_special_tokens=False, return_tensors='pt').to('cuda')
|
58 |
|
@@ -75,8 +75,8 @@ def generate_audio(text, temperature, top_p, max_new_tokens):
|
|
75 |
|
76 |
# Gradio Interface
|
77 |
with gr.Blocks() as demo:
|
78 |
-
gr.Markdown("# Llama-3B-Mono-
|
79 |
-
gr.Markdown("Generate speech audio using the `
|
80 |
|
81 |
with gr.Row():
|
82 |
text_input = gr.Textbox(lines=4, label="Input Text")
|
@@ -96,4 +96,4 @@ with gr.Blocks() as demo:
|
|
96 |
)
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
-
demo.launch()
|
|
|
42 |
snac_model = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").to("cuda")
|
43 |
|
44 |
# Load the single-speaker language model
|
45 |
+
tokenizer = AutoTokenizer.from_pretrained('Llama-3B-Mono-Jim')
|
46 |
model = AutoModelForCausalLM.from_pretrained(
|
47 |
+
'Llama-3B-Mono-Jim', torch_dtype=torch.bfloat16
|
48 |
).cuda()
|
49 |
|
50 |
@spaces.GPU
|
|
|
52 |
"""
|
53 |
Given input text, generate speech audio.
|
54 |
"""
|
55 |
+
speaker = "Jim"
|
56 |
prompt = f'<custom_token_3><|begin_of_text|>{speaker}: {text}<|eot_id|><custom_token_4><custom_token_5><custom_token_1>'
|
57 |
input_ids = tokenizer(prompt, add_special_tokens=False, return_tensors='pt').to('cuda')
|
58 |
|
|
|
75 |
|
76 |
# Gradio Interface
|
77 |
with gr.Blocks() as demo:
|
78 |
+
gr.Markdown("# Llama-3B-Mono-Jim - Single Speaker Audio Generation")
|
79 |
+
gr.Markdown("Generate speech audio using the `Llama-3B-Mono-Jim` model.")
|
80 |
|
81 |
with gr.Row():
|
82 |
text_input = gr.Textbox(lines=4, label="Input Text")
|
|
|
96 |
)
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
+
demo.launch()
|