Commit
·
896a149
1
Parent(s):
29ed177
fix: change checkpoint from dp to deep_phonemizer
Browse files- fix.py +26 -0
- model_step_420k.pt +2 -2
fix.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Script to rename checkpoint from dp to deep_phonemizer
|
| 2 |
+
|
| 3 |
+
import io, zipfile, torch
|
| 4 |
+
|
| 5 |
+
old = "model_step_420k.pt"
|
| 6 |
+
new = "model_step_420k_fixed.pt"
|
| 7 |
+
|
| 8 |
+
# Step 1. Read zip members
|
| 9 |
+
with open(old, "rb") as f:
|
| 10 |
+
data = f.read()
|
| 11 |
+
|
| 12 |
+
with zipfile.ZipFile(io.BytesIO(data)) as zin:
|
| 13 |
+
buf = io.BytesIO()
|
| 14 |
+
with zipfile.ZipFile(buf, "w", compression=zipfile.ZIP_DEFLATED) as zout:
|
| 15 |
+
for item in zin.infolist():
|
| 16 |
+
file_bytes = zin.read(item.filename)
|
| 17 |
+
file_bytes = file_bytes.replace(b"dp.", b"deep_phonemizer.")
|
| 18 |
+
zout.writestr(item, file_bytes)
|
| 19 |
+
|
| 20 |
+
# Step 2. Save the modified zip
|
| 21 |
+
with open(new, "wb") as f:
|
| 22 |
+
f.write(buf.getvalue())
|
| 23 |
+
|
| 24 |
+
# Step 3. Verify
|
| 25 |
+
checkpoint = torch.load(new, map_location="cpu", weights_only=False)
|
| 26 |
+
print("✅ Loaded successfully")
|
model_step_420k.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:e6765dada0efb376f778d4977c6d2c4d31e925bac7918a3ccc6f6f990166f014
|
| 3 |
+
size 164775901
|