Update app.py
Browse files
app.py
CHANGED
@@ -3,18 +3,12 @@ import torch
|
|
3 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, TextStreamer, AutoModelForSpeechSeq2Seq
|
4 |
|
5 |
# Whisper Model Optimization
|
6 |
-
|
7 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
9 |
processor = AutoProcessor.from_pretrained(MODEL_NAME)
|
10 |
|
11 |
-
whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
12 |
-
WHISPER_MODEL,
|
13 |
-
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, # Use fp16 if GPU available
|
14 |
-
device_map="auto"
|
15 |
-
)
|
16 |
|
17 |
-
whisper_tokenizer = AutoTokenizer.from_pretrained(WHISPER_MODEL)
|
18 |
transcriber = pipeline(
|
19 |
"automatic-speech-recognition",
|
20 |
model=model,
|
|
|
3 |
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig, TextStreamer, AutoModelForSpeechSeq2Seq
|
4 |
|
5 |
# Whisper Model Optimization
|
6 |
+
model = "openai/whisper-small"
|
7 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
9 |
processor = AutoProcessor.from_pretrained(MODEL_NAME)
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
12 |
transcriber = pipeline(
|
13 |
"automatic-speech-recognition",
|
14 |
model=model,
|