Spaces:
Runtime error
Runtime error
Update infer/lib/train/process_ckpt.py
Browse files
infer/lib/train/process_ckpt.py
CHANGED
@@ -9,9 +9,13 @@ from i18n.i18n import I18nAuto
|
|
9 |
|
10 |
i18n = I18nAuto()
|
11 |
|
|
|
|
|
|
|
12 |
|
13 |
def savee(ckpt, sr, if_f0, name, epoch, version, hps):
|
14 |
try:
|
|
|
15 |
opt = OrderedDict()
|
16 |
opt["weight"] = {}
|
17 |
for key in ckpt.keys():
|
@@ -43,6 +47,20 @@ def savee(ckpt, sr, if_f0, name, epoch, version, hps):
|
|
43 |
opt["f0"] = if_f0
|
44 |
opt["version"] = version
|
45 |
torch.save(opt, "assets/weights/%s.pth" % name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
return "Success."
|
47 |
except:
|
48 |
return traceback.format_exc()
|
|
|
9 |
|
10 |
i18n = I18nAuto()
|
11 |
|
12 |
+
import os
|
13 |
+
from pydrive.auth import GoogleAuth
|
14 |
+
from pydrive.drive import GoogleDrive
|
15 |
|
16 |
def savee(ckpt, sr, if_f0, name, epoch, version, hps):
|
17 |
try:
|
18 |
+
print("ckpt, sr, if_f0, name, epoch, version, hps", ckpt, sr, if_f0, name, epoch, version, hps)
|
19 |
opt = OrderedDict()
|
20 |
opt["weight"] = {}
|
21 |
for key in ckpt.keys():
|
|
|
47 |
opt["f0"] = if_f0
|
48 |
opt["version"] = version
|
49 |
torch.save(opt, "assets/weights/%s.pth" % name)
|
50 |
+
|
51 |
+
local_file_path = "assets/weights/%s.pth" % name
|
52 |
+
torch.save(opt, local_file_path)
|
53 |
+
|
54 |
+
# Authenticate with Google Drive
|
55 |
+
gauth = GoogleAuth()
|
56 |
+
gauth.LocalWebserverAuth() # This will open a web page for authentication
|
57 |
+
drive = GoogleDrive(gauth)
|
58 |
+
|
59 |
+
# Create a Google Drive file and upload it
|
60 |
+
file_drive = drive.CreateFile({'title': name})
|
61 |
+
file_drive.Upload()
|
62 |
+
|
63 |
+
return "Success: File uploaded to Google Drive."
|
64 |
return "Success."
|
65 |
except:
|
66 |
return traceback.format_exc()
|