File size: 614 Bytes
223aff6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# from tabnanny import check
import torch
import pathlib

path = r"/workspaces/vits_web_demo/export/model/D_second.pth"
model_path = pathlib.Path(path)

assert model_path.exists(), "model path does not exist"

checkpoint = torch.load(str(model_path), map_location='cpu')

state_file = checkpoint['model']
iteration = checkpoint['iteration']

out_path = model_path.parent / pathlib.Path("19_"+str(iteration)+'_demo'+'.pth')
out_path = str(out_path)
torch.save({'model': state_file,
            'iteration': iteration,
            'optimizer': None,
            'learning_rate': None}, out_path)