Luis J Camargo commited on
Commit
481d76f
·
1 Parent(s): 9ef9cfe

Refactor: Simplify model loading by directly using `from_pretrained` for `WhisperEncoderOnlyForClassification` and removing explicit config and weight loading.

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -51,13 +51,13 @@ MODEL_REPO = "tachiwin/language_classification_enconly_model_2"
51
 
52
  print("Loading model on CPU...")
53
  processor = WhisperProcessor.from_pretrained(MODEL_REPO)
54
- config = WhisperEncoderOnlyConfig.from_pretrained(MODEL_REPO)
55
- model = WhisperEncoderOnlyForClassification(config)
56
 
57
  # Load weights from safetensors
58
- weights_path = hf_hub_download(repo_id=MODEL_REPO, filename="model.safetensors")
59
- state_dict = load_file(weights_path)
60
- model.load_state_dict(state_dict)
61
  model.eval()
62
 
63
  print("Model loaded successfully!")
 
51
 
52
  print("Loading model on CPU...")
53
  processor = WhisperProcessor.from_pretrained(MODEL_REPO)
54
+ #config = WhisperEncoderOnlyConfig.from_pretrained(MODEL_REPO)
55
+ model = WhisperEncoderOnlyForClassification.from_pretrained(MODEL_REPO)
56
 
57
  # Load weights from safetensors
58
+ #weights_path = hf_hub_download(repo_id=MODEL_REPO, filename="model.safetensors")
59
+ #state_dict = load_file(weights_path)
60
+ #model.load_state_dict(state_dict)
61
  model.eval()
62
 
63
  print("Model loaded successfully!")