palbha commited on
Commit
fd2fb33
·
verified ·
1 Parent(s): 2c77d1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
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
- whisper_quant_config = BitsAndBytesConfig(
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
- task="automatic-speech-recognition",
25
- model=whisper_model,
26
- tokenizer=whisper_tokenizer,
27
- chunk_length_s=30,
28
- device=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