File size: 662 Bytes
b862b3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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}")