unknownBrain's picture
Complete medical imaging workspace dump (weights, deliverables, papers, notebooks, code, figures)
eded815 verified
Raw History Blame Contribute Delete
869 Bytes
import torch
import os
path = r"C:\Users\Acer\Documents\myproject\medical imaging\medical imaging\best_student_cv.pt"
print(f"File size: {os.path.getsize(path) / (1024*1024):.2f} MB")
try:
ckpt = torch.load(path, map_location='cpu')
if isinstance(ckpt, dict):
print("Checkpoint is dict with keys:", list(ckpt.keys())[:10])
if 'model_state_dict' in ckpt:
print("Found model_state_dict with layers:", len(ckpt['model_state_dict']))
elif 'state_dict' in ckpt:
print("Found state_dict with layers:", len(ckpt['state_dict']))
else:
print("Direct state_dict keys count:", len(ckpt))
first_keys = list(ckpt.keys())[:5]
print("Sample keys:", first_keys)
else:
print("Checkpoint type:", type(ckpt))
except Exception as e:
print("Error loading checkpoint:", e)