kingabzpro commited on
Commit
4098191
·
verified ·
1 Parent(s): a313388

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -24,11 +24,16 @@ logging.set_verbosity_error()
24
  device = "cpu"
25
  model_id = "kingabzpro/whisper-base-urdu-full"
26
 
 
27
  model = AutoModelForSpeechSeq2Seq.from_pretrained(
28
  model_id,
29
- torch_dtype=torch.float16,
30
  use_safetensors=True,
31
  )
 
 
 
 
32
 
33
  processor = AutoProcessor.from_pretrained(model_id)
34
 
 
24
  device = "cpu"
25
  model_id = "kingabzpro/whisper-base-urdu-full"
26
 
27
+ # Load in fp32 and quantize to int8
28
  model = AutoModelForSpeechSeq2Seq.from_pretrained(
29
  model_id,
30
+ torch_dtype=torch.float32,
31
  use_safetensors=True,
32
  )
33
+ model.eval()
34
+ model = torch.quantization.quantize_dynamic(model, {torch.nn.Linear}, dtype=torch.qint8)
35
+
36
+ processor = AutoProcessor.from_pretrained(model_id)
37
 
38
  processor = AutoProcessor.from_pretrained(model_id)
39