Spaces:
Sleeping
Sleeping
import gradio as gr | |
import torch | |
# Load the state dictionary from the .pth file | |
model_path = './checkpoints/artgan_pix2pix/latest_net_G.pth' | |
state_dict = torch.load(model_path, map_location=torch.device('cpu')) | |
# Print statistics about the weights | |
for name, param in state_dict.items(): | |
if param.dtype == torch.float32: # Check if the parameter is of type float | |
print(f"Layer: {name}") | |
print(f"\tShape: {param.shape}") | |
print(f"\tMean: {param.mean().item()}") | |
print(f"\tStandard Deviation: {param.std().item()}") | |
print(f"\tMin: {param.min().item()}") | |
print(f"\tMax: {param.max().item()}") | |
else: | |
print(f"Layer: {name}") | |
print(f"\tShape: {param.shape}") | |
print(f"\tType: {param.dtype}") | |