update convert so non-tensor files are copied over to output
Browse files- convert_v2.py +10 -1
convert_v2.py
CHANGED
|
@@ -87,4 +87,13 @@ sorted_map = sorted(weight_map['weight_map'].items())
|
|
| 87 |
weight_map['weight_map'] = dict(sorted_map)
|
| 88 |
|
| 89 |
with open(output_dir / 'model.safetensors.index.json', 'w') as f:
|
| 90 |
-
json.dump(weight_map, f, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
weight_map['weight_map'] = dict(sorted_map)
|
| 88 |
|
| 89 |
with open(output_dir / 'model.safetensors.index.json', 'w') as f:
|
| 90 |
+
json.dump(weight_map, f, indent=4)
|
| 91 |
+
|
| 92 |
+
# copy rest of model non-tensor files
|
| 93 |
+
for filename in os.listdir(model_dir):
|
| 94 |
+
if filename.endswith(".safetensors") or filename == "model.safetensors.index.json":
|
| 95 |
+
continue
|
| 96 |
+
src = os.path.join(model_dir, filename)
|
| 97 |
+
dst = os.path.join(output_dir, filename)
|
| 98 |
+
if os.path.isfile(src):
|
| 99 |
+
shutil.copy2(src, dst)
|