Module not found error. No module named GTTS.

#97
by BeyondStreamlit - opened

I have downloaded the model file and put into one folder named as "models":
and run this command one by one:

1、pip install --upgrade git+https://github.com/huggingface/transformers.git accelerate datasets[audio]
2、pip install --upgrade setuptools
3、pip install numpy scipy audioread soundfile
then run this code, got error: Module not found error. No module named GTTS.
even though I have install the gtts through: pip install gtts and can see the information through:pip show gtts, but this error is still exists:

Do you know why and how to solve this problem?

My code:
import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32

device = "cuda:0" if torch.cuda.is_available() else "cpu"
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32

model_id = r"E:\whisper-large-v3\models"

model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True
)
model.to(device)

processor = AutoProcessor.from_pretrained(model_id)

pipe = pipeline(
"automatic-speech-recognition",
model=model,
tokenizer=processor.tokenizer,
feature_extractor=processor.feature_extractor,
max_new_tokens=128,
chunk_length_s=30,
batch_size=16,
return_timestamps=True,
torch_dtype=torch_dtype,
device=device,
)

from datasets import load_dataset

dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation")
sample = dataset[0]["audio"]

result = pipe("output.mp3")
print(result["text"])

Sign up or log in to comment