Upload app.py
Browse files
app.py
CHANGED
|
@@ -55,10 +55,16 @@ def load_model():
|
|
| 55 |
"""
|
| 56 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 57 |
|
| 58 |
-
#
|
| 59 |
-
checkpoint_path =
|
| 60 |
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|