img-classifier / test_model.py
ksj47's picture
Upload 7 files
b862b3f verified
raw
history blame contribute delete
662 Bytes
import torch
import os
# Check if model file exists
model_path = "model.pth"
if os.path.exists(model_path):
print(f"Model file exists at {model_path}")
print(f"File size: {os.path.getsize(model_path)} bytes")
try:
# Try to load the model
model_data = torch.load(model_path, map_location=torch.device('cpu'))
print("Model loaded successfully!")
print(f"Model type: {type(model_data)}")
if isinstance(model_data, dict):
print(f"Model keys: {list(model_data.keys())}")
except Exception as e:
print(f"Error loading model: {e}")
else:
print(f"Model file not found at {model_path}")