dougiefresh commited on
Commit
6858205
·
verified ·
1 Parent(s): c11d271

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. convert_safetensors_to_npz.py +28 -0
  2. identity.npz +3 -0
  3. knowledge.npz +3 -0
convert_safetensors_to_npz.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import numpy as np
3
+ from safetensors.numpy import load_file
4
+ from pathlib import Path
5
+
6
+ def convert_safetensors_to_npz(safetensors_path: str, npz_path: str):
7
+ # Load safetensors file
8
+ tensors = load_file(safetensors_path)
9
+ tensors = {k.replace("lora_A", "loraA").replace("lora_B", "loraB"): v for k, v in tensors.items()}
10
+
11
+ # Print keys for debugging
12
+ print(f"Loaded {len(tensors)} tensors:")
13
+ for key in tensors:
14
+ print(f" - {key}: shape={tensors[key].shape}, dtype={tensors[key].dtype}")
15
+
16
+ # Save all tensors into a single .npz file
17
+ np.savez(npz_path, **tensors)
18
+ print(f"Saved .npz file to: {npz_path}")
19
+
20
+ if __name__ == "__main__":
21
+ if len(sys.argv) != 3:
22
+ print("Usage: python convert_safetensors_to_npz.py <input.safetensors> <output.npz>")
23
+ sys.exit(1)
24
+
25
+ safetensors_file = sys.argv[1]
26
+ npz_file = sys.argv[2]
27
+
28
+ convert_safetensors_to_npz(safetensors_file, npz_file)
identity.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d84d166353493145008171aa0af42e353673364cb34d41a3a38cebb426823195
3
+ size 528659886
knowledge.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c2a7f1f26deffc2603fc2e68797017e7ccf151ceca3b7f69c0b641fea5336be
3
+ size 528659886