Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,7 @@ from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM, BitsAndB
|
|
6 |
WHISPER_MODEL = "openai/whisper-large-v3"
|
7 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
|
9 |
-
|
10 |
-
load_in_4bit=True,
|
11 |
-
bnb_4bit_use_double_quant=True,
|
12 |
-
bnb_4bit_compute_dtype=torch.bfloat16,
|
13 |
-
bnb_4bit_quant_type="nf4"
|
14 |
-
)
|
15 |
|
16 |
whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
17 |
WHISPER_MODEL,
|
@@ -21,11 +16,11 @@ whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
|
21 |
|
22 |
whisper_tokenizer = AutoTokenizer.from_pretrained(WHISPER_MODEL)
|
23 |
transcriber = pipeline(
|
24 |
-
|
25 |
-
model=
|
26 |
-
tokenizer=
|
27 |
-
|
28 |
-
device=
|
29 |
)
|
30 |
|
31 |
# LLaMA Model Optimization
|
|
|
6 |
WHISPER_MODEL = "openai/whisper-large-v3"
|
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,
|
|
|
16 |
|
17 |
whisper_tokenizer = AutoTokenizer.from_pretrained(WHISPER_MODEL)
|
18 |
transcriber = pipeline(
|
19 |
+
"automatic-speech-recognition",
|
20 |
+
model=model,
|
21 |
+
tokenizer=processor.tokenizer,
|
22 |
+
feature_extractor=processor.feature_extractor,
|
23 |
+
device=0 if torch.cuda.is_available() else "cpu",
|
24 |
)
|
25 |
|
26 |
# LLaMA Model Optimization
|