lym00 commited on
Commit
6f59bc1
·
verified ·
1 Parent(s): 9330fab

Upload combine.py

Browse files
Files changed (1) hide show
  1. quantized/combine.py +11 -0
quantized/combine.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import safetensors.torch
2
+
3
+ # Load both files
4
+ quantized_blocks = safetensors.torch.load_file("transformer_blocks.safetensors")
5
+ unquantized_layers = safetensors.torch.load_file("unquantized_layers.safetensors")
6
+
7
+ # Combine the state dicts
8
+ combined_state_dict = {**quantized_blocks, **unquantized_layers}
9
+
10
+ # Save the combined model
11
+ safetensors.torch.save_file(combined_state_dict, "combined.safetensors")