Upload folder using huggingface_hub
Browse files- README.md +2 -0
- checkpoints/checkpoint-100.pt +2 -2
- checkpoints/checkpoint-25.pt +2 -2
- checkpoints/checkpoint-50.pt +2 -2
- checkpoints/checkpoint-75.pt +2 -2
- convert_checkpoints.py +37 -0
README.md
CHANGED
|
@@ -5,3 +5,5 @@ This repository contains the final trained model and intermediate checkpoints.
|
|
| 5 |
- The main directory contains the fully trained model (checkpoint 0).
|
| 6 |
- The `checkpoints` directory contains all intermediate checkpoints.
|
| 7 |
|
|
|
|
|
|
|
|
|
| 5 |
- The main directory contains the fully trained model (checkpoint 0).
|
| 6 |
- The `checkpoints` directory contains all intermediate checkpoints.
|
| 7 |
|
| 8 |
+
Now updated to match tetrahedron format
|
| 9 |
+
|
checkpoints/checkpoint-100.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bdddf11f6c354f0fe93e9e0304366e3c753926157bc0ef8d6b726d850adcd139
|
| 3 |
+
size 2480362
|
checkpoints/checkpoint-25.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b47a7288186dd7e81fc0b4dff55ea628b4305471cf642159bb5fbefdfdc6c927
|
| 3 |
+
size 2480328
|
checkpoints/checkpoint-50.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:404c5ce1e19ed45746ed0d35635e4f1081dd1917fb12cae1b1a63ca7208bd0c7
|
| 3 |
+
size 2480328
|
checkpoints/checkpoint-75.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3beb8688ec66697e58f601b78412a8d38a05ff7f8fbf8cb0f9e91a2e2a51989e
|
| 3 |
+
size 2480328
|
convert_checkpoints.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# convert_and_replace.py
|
| 2 |
+
import os
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
import torch
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def convert_checkpoint_format(checkpoint_path):
|
| 9 |
+
"""Convert nested format to direct format in place."""
|
| 10 |
+
# Load the checkpoint
|
| 11 |
+
checkpoint = torch.load(checkpoint_path, map_location='cpu')
|
| 12 |
+
|
| 13 |
+
# Extract just the model state dict
|
| 14 |
+
if 'model' in checkpoint:
|
| 15 |
+
model_state_dict = checkpoint['model']
|
| 16 |
+
print(f"Converting {checkpoint_path}: nested -> direct format")
|
| 17 |
+
|
| 18 |
+
# Save back in direct format
|
| 19 |
+
torch.save(model_state_dict, checkpoint_path)
|
| 20 |
+
print(f"Updated: {checkpoint_path}")
|
| 21 |
+
else:
|
| 22 |
+
print(f"Already in direct format: {checkpoint_path}")
|
| 23 |
+
|
| 24 |
+
def convert_all_checkpoints():
|
| 25 |
+
"""Convert all checkpoint files in the current directory."""
|
| 26 |
+
checkpoints_dir = Path("checkpoints")
|
| 27 |
+
|
| 28 |
+
if not checkpoints_dir.exists():
|
| 29 |
+
print("No checkpoints directory found")
|
| 30 |
+
return
|
| 31 |
+
|
| 32 |
+
# Convert all .pt files
|
| 33 |
+
for checkpoint_file in checkpoints_dir.glob("*.pt"):
|
| 34 |
+
convert_checkpoint_format(checkpoint_file)
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
convert_all_checkpoints()
|