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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -15,9 +15,9 @@ whisper_quant_config = BitsAndBytesConfig(
15
 
16
  whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained(
17
  WHISPER_MODEL,
18
- device_map="auto",
19
- quantization_config=whisper_quant_config
20
- )
21
 
22
  whisper_tokenizer = AutoTokenizer.from_pretrained(WHISPER_MODEL)
23
  transcriber = pipeline(
@@ -39,7 +39,11 @@ llama_quant_config = BitsAndBytesConfig(
39
 
40
  tokenizer = AutoTokenizer.from_pretrained(LLAMA)
41
  tokenizer.pad_token = tokenizer.eos_token
42
- model = AutoModelForCausalLM.from_pretrained(LLAMA, device_map="auto", quantization_config=llama_quant_config)
 
 
 
 
43
 
44
  # Function to Transcribe & Generate Minutes
45
  def process_audio(audio_file):
 
15
 
16
  whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained(
17
  WHISPER_MODEL,
18
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, # Use fp16 if GPU available
19
+ device_map="auto"
20
+ )
21
 
22
  whisper_tokenizer = AutoTokenizer.from_pretrained(WHISPER_MODEL)
23
  transcriber = pipeline(
 
39
 
40
  tokenizer = AutoTokenizer.from_pretrained(LLAMA)
41
  tokenizer.pad_token = tokenizer.eos_token
42
+ model = AutoModelForCausalLM.from_pretrained(
43
+ LLAMA,
44
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
45
+ device_map="auto"
46
+ )
47
 
48
  # Function to Transcribe & Generate Minutes
49
  def process_audio(audio_file):