Create Deepseek-V2-Chat.f16.gguf/merge.py
Browse files
Deepseek-V2-Chat.f16.gguf/merge.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import math
|
3 |
+
import json
|
4 |
+
|
5 |
+
OUTPUT_FILE_NAME = "Deepseek-V2-Chat.f16.gguf" # Merge output file name
|
6 |
+
CHUNK_PATHS_FILE = "chunk_paths.json"
|
7 |
+
|
8 |
+
def merge(chunk_paths):
|
9 |
+
output_path = os.path.join(os.path.dirname(chunk_paths[0]), OUTPUT_FILE_NAME)
|
10 |
+
|
11 |
+
with open(output_path, "wb") as f_out:
|
12 |
+
for filepath in chunk_paths:
|
13 |
+
with open(filepath, "rb") as f_in:
|
14 |
+
f_out.write(f_in.read())
|
15 |
+
|
16 |
+
print(f"Merged file saved to {output_path}")
|
17 |
+
|
18 |
+
if __name__ == "__main__":
|
19 |
+
|
20 |
+
if os.path.exists(CHUNK_PATHS_FILE):
|
21 |
+
with open(CHUNK_PATHS_FILE) as f:
|
22 |
+
chunk_paths = json.load(f)
|
23 |
+
else:
|
24 |
+
chunk_paths = split(main_filepath)
|
25 |
+
|
26 |
+
merge(chunk_paths)
|