Fix pytorch automagic logging torchscript models

This commit is contained in:
allegroai 2022-04-13 14:16:12 +03:00
parent 3996cdbc7e
commit e06d3cbf99

View File

@ -131,7 +131,9 @@ def main():
for epoch in range(1, args.epochs + 1):
train(model, epoch, train_loader, args, optimizer, writer)
torch.save(model, os.path.join(gettempdir(), 'model{}'.format(epoch)))
m = torch.jit.script(model)
m.save(os.path.join(gettempdir(), 'model{}'.format(epoch)))
#torch.save(model, os.path.join(gettempdir(), 'model{}'.format(epoch)))
test(model, test_loader, args, optimizer, writer)