Doven
update code.
f7009b3
raw
history blame contribute delete
263 Bytes
import numpy as np
import torch
import sys
file = sys.argv[1]
try:
model = torch.load(file, map_location='cpu')['state_dict']
torch.save(model, file)
print('this file has been reversed.')
except KeyError:
print('this file need not to reverse.')