Kartikeyssj2 commited on
Commit
be76330
·
verified ·
1 Parent(s): cbfce82

Update fast_api.py

Browse files
Files changed (1) hide show
  1. fast_api.py +8 -8
fast_api.py CHANGED
@@ -14,23 +14,23 @@ def load_whisper_model(model_path, device='cpu'):
14
  whisper.model.ModelDimensions(
15
  n_mels=80,
16
  n_audio_ctx=1500,
17
- n_audio_state=192, # Adjusted for Tiny
18
- n_audio_head=3, # Adjusted for Tiny
19
- n_audio_layer=2, # Adjusted for Tiny
20
  n_vocab=51865,
21
  n_text_ctx=448,
22
- n_text_state=192, # Adjusted for Tiny
23
- n_text_head=3, # Adjusted for Tiny
24
- n_text_layer=2 # Adjusted for Tiny
25
  )
26
  )
27
-
28
  # Load state dict
29
  state_dict = torch.load(model_path, map_location=device, weights_only=True)
30
  model.load_state_dict(state_dict)
31
  model.eval()
32
  return model
33
-
34
  # Load the saved Word2Vec model
35
  word2vec_model = KeyedVectors.load("word2vec-google-news-300.model")
36
  model = load_whisper_model("whisper_tiny_model.pt")
 
14
  whisper.model.ModelDimensions(
15
  n_mels=80,
16
  n_audio_ctx=1500,
17
+ n_audio_state=384, # Adjusted to match checkpoint
18
+ n_audio_head=3,
19
+ n_audio_layer=2,
20
  n_vocab=51865,
21
  n_text_ctx=448,
22
+ n_text_state=384, # Adjusted to match checkpoint
23
+ n_text_head=3,
24
+ n_text_layer=2
25
  )
26
  )
27
+
28
  # Load state dict
29
  state_dict = torch.load(model_path, map_location=device, weights_only=True)
30
  model.load_state_dict(state_dict)
31
  model.eval()
32
  return model
33
+
34
  # Load the saved Word2Vec model
35
  word2vec_model = KeyedVectors.load("word2vec-google-news-300.model")
36
  model = load_whisper_model("whisper_tiny_model.pt")