Shilpaj commited on
Commit
ea06c18
·
verified ·
1 Parent(s): a1fcadc

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -55,10 +55,16 @@ def load_model():
55
  """
56
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
57
 
58
- # Combine model parts and get the checkpoint path
59
- checkpoint_path = combine_model_parts()
60
 
61
- # Load the model from combined checkpoint using Lightning module
 
 
 
 
 
 
62
  model = LitSmollmv2.load_from_checkpoint(
63
  checkpoint_path,
64
  model_config=SmollmConfig,
 
55
  """
56
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
57
 
58
+ # Load model directly from checkpoint
59
+ checkpoint_path = "last.ckpt" # Assuming the checkpoint is in the root directory
60
 
61
+ if not os.path.exists(checkpoint_path):
62
+ raise FileNotFoundError(
63
+ f"Model checkpoint {checkpoint_path} not found. "
64
+ "Please ensure the model checkpoint file 'last.ckpt' is present in the root directory."
65
+ )
66
+
67
+ # Load the model from checkpoint using Lightning module
68
  model = LitSmollmv2.load_from_checkpoint(
69
  checkpoint_path,
70
  model_config=SmollmConfig,