Exemplo n.º 1
0
 def save_model(model, model_path, model_name):
     torch.save(ModelSerializer.convert_param_to_cpu(model.state_dict()),
                os.path.join(model_path, '{}.mdl'.format(model_name)))
     ModelSerializer.save_config(
         os.path.join(model_path, '{}.cfg'.format(model_name)),
         model.get_config())
     json.dump(opts,
               open(os.path.join(opts['result'], 'script.opts'), 'w'),
               indent=2)
 def save_model(model, name, epoch) :
     torch.save(ModelSerializer.convert_param_to_cpu(model.state_dict()), os.path.join(opts['result'], 'model_{}_e{}.mdl'.format(name, epoch)))
     ModelSerializer.save_config(os.path.join(opts['result'], 'model_{}_e{}.cfg'.format(name, epoch)), model.get_config())
     pass