Go to the documentation of this file.00001 from load_model import load_checkpoint
00002 from save_model import save_checkpoint
00003
00004
00005 def combine_model(prefix1, epoch1, prefix2, epoch2, prefix_out, epoch_out):
00006 args1, auxs1 = load_checkpoint(prefix1, epoch1)
00007 args2, auxs2 = load_checkpoint(prefix2, epoch2)
00008 arg_names = args1.keys() + args2.keys()
00009 aux_names = auxs1.keys() + auxs2.keys()
00010 args = dict()
00011 for arg in arg_names:
00012 if arg in args1:
00013 args[arg] = args1[arg]
00014 if arg in args2:
00015 args[arg] = args2[arg]
00016 auxs = dict()
00017 for aux in aux_names:
00018 if aux in auxs1:
00019 auxs[aux] = auxs1[aux]
00020 if aux in auxs2:
00021 auxs[aux] = auxs2[aux]
00022 save_checkpoint(prefix_out, epoch_out, args, auxs)