Downloads · 30 days
0
babapro313131/DS_KLL
DS_KLL is a machine learning model from babapro313131. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
from transformers import AutoModelForCausalLM, AutoTokenizer import torch import soundfile as sf
Downloads · 30 days
0
Access
Public
Updated Dec 12, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 67%
From the Hugging Face model README
from transformers import AutoModelForCausalLM, AutoTokenizer import torch import soundfile as sf
model_name = "tts_models/en/ljspeech/tacotron2" # Burada uygun bir model ismi kullanmalısın tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name)
def text_to_speech(text): inputs = tokenizer(text, return_tensors="pt") with torch.no_grad(): audio = model.generate(**inputs) return audio
text = "Hello KLL" audio_output = text_to_speech(text)
sf.write("output.wav", audio_output.numpy(), 22050) # 22050 Hz örnekleme hızı