Update README.md
Browse files
README.md
CHANGED
|
@@ -27,14 +27,18 @@ import torch
|
|
| 27 |
from parler_tts import ParlerTTSForConditionalGeneration
|
| 28 |
from transformers import AutoTokenizer
|
| 29 |
import soundfile as sf
|
|
|
|
| 30 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 31 |
model = ParlerTTSForConditionalGeneration.from_pretrained("atlithor/RepeaTTS-level-3").to(device)
|
| 32 |
tokenizer = AutoTokenizer.from_pretrained("atlithor/EmotiveIcelandic")
|
| 33 |
description_tokenizer = AutoTokenizer.from_pretrained(model.config.text_encoder._name_or_path)
|
|
|
|
| 34 |
prompt = "Þetta er frábær hugmynd!" # E: this is a great idea!
|
| 35 |
description = "The recording is of very high quality, with Ingrid's voice sounding clear and very close up. Ingrid speaks at very high intensity."
|
|
|
|
| 36 |
input_ids = description_tokenizer(description, return_tensors="pt").input_ids.to(device)
|
| 37 |
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
|
|
|
|
| 38 |
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
|
| 39 |
audio_arr = generation.cpu().numpy().squeeze()
|
| 40 |
sf.write("ingrid_intense.wav", audio_arr, model.config.sampling_rate)
|
|
|
|
| 27 |
from parler_tts import ParlerTTSForConditionalGeneration
|
| 28 |
from transformers import AutoTokenizer
|
| 29 |
import soundfile as sf
|
| 30 |
+
|
| 31 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 32 |
model = ParlerTTSForConditionalGeneration.from_pretrained("atlithor/RepeaTTS-level-3").to(device)
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained("atlithor/EmotiveIcelandic")
|
| 34 |
description_tokenizer = AutoTokenizer.from_pretrained(model.config.text_encoder._name_or_path)
|
| 35 |
+
|
| 36 |
prompt = "Þetta er frábær hugmynd!" # E: this is a great idea!
|
| 37 |
description = "The recording is of very high quality, with Ingrid's voice sounding clear and very close up. Ingrid speaks at very high intensity."
|
| 38 |
+
|
| 39 |
input_ids = description_tokenizer(description, return_tensors="pt").input_ids.to(device)
|
| 40 |
prompt_input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
|
| 41 |
+
|
| 42 |
generation = model.generate(input_ids=input_ids, prompt_input_ids=prompt_input_ids)
|
| 43 |
audio_arr = generation.cpu().numpy().squeeze()
|
| 44 |
sf.write("ingrid_intense.wav", audio_arr, model.config.sampling_rate)
|