Extracting and Quantizing PyTorch Model Parameters and Activations
Extracting Model Parameters
import os
import torch
os.makedirs('weights', exist_ok=True)
model.load_state_dict(torch.load('model_weights.pth'))
item_counter = 0
for param_name, param_tensor in model.state_dict().items():
print(f"{param_name}: {param_tensor.shape}")
with open(f'weights/{item_counter}-{param_name}.txt', 'w') a ...
Posted on Thu, 14 May 2026 22:53:31 +0000 by Stu