Spaces:
Sleeping
Sleeping
| """ | |
| Script to inspect the saved model structure | |
| """ | |
| import torch | |
| import os | |
| def inspect_model(): | |
| """Inspect the structure of the saved model""" | |
| model_path = 'siamese_model.t7' | |
| if not os.path.exists(model_path): | |
| print(f"Model file {model_path} not found!") | |
| return | |
| try: | |
| # Load the model | |
| model_data = torch.load(model_path, map_location='cpu') | |
| print("Model file loaded successfully!") | |
| print(f"Type: {type(model_data)}") | |
| if isinstance(model_data, dict): | |
| print("\nDictionary keys:") | |
| for key in model_data.keys(): | |
| print(f" - {key}") | |
| if 'net_dict' in model_data: | |
| print(f"\n'net_dict' contains {len(model_data['net_dict'])} items:") | |
| for key in list(model_data['net_dict'].keys())[:10]: # Show first 10 keys | |
| print(f" - {key}") | |
| if len(model_data['net_dict']) > 10: | |
| print(f" ... and {len(model_data['net_dict']) - 10} more keys") | |
| else: | |
| print("Model data is not a dictionary") | |
| except Exception as e: | |
| print(f"Error loading model: {e}") | |
| if __name__ == "__main__": | |
| inspect_model() | |