line = line.decode('utf-8') line = line.rstrip(os.linesep) if line.startswith(result_line_prefix): rate = float(line[len(result_line_prefix):]) os.waitpid(subprocess.pid, 0) #end processing return rate if __name__ == '__main__': parser = ArgumentParser(description='Evaluate correction rate.') parser.add_argument('--finaldir', action='store', \ help='final directory', \ default=config.getFinalModelDir()) parser.add_argument('tryname', action='store', \ help='the storage directory') args = parser.parse_args() print(args) tryname = 'try' + args.tryname trydir = os.path.join(args.finaldir, tryname) if not os.access(trydir, os.F_OK): sys.exit(tryname + "doesn't exist.") cwdstatuspath = os.path.join(trydir, config.getFinalStatusFileName()) cwdstatus = utils.load_status(cwdstatuspath) if not utils.check_epoch(cwdstatus, 'Prune'): raise utils.EpochError('Please tryprune first.')
help='CDF parameter of k mixture model prune', \ default=0.99, type=float) parser.add_argument('--fast', action='store_const', \ help='Use in-memory filesystem to speed up prune',\ const=True, default=False) parser.add_argument('tryname', action='store', \ help='the storage directory') args = parser.parse_args() print(args) tryname = 'try' + args.tryname trydir = os.path.join(config.getFinalModelDir(), tryname) #check try<name> directory if os.access(trydir, os.F_OK): sys.exit(tryname + ' exists.') os.makedirs(trydir) cwdstatuspath = os.path.join(trydir, config.getFinalStatusFileName()) cwdstatus = {} cwdstatus['PruneMergeNumber'] = args.merge cwdstatus['PruneK'] = args.k cwdstatus['PruneCDF'] = args.CDF utils.store_status(cwdstatuspath, cwdstatus) #merge model candidates print('merging')
#remove training '\n' line = line.decode('utf-8') line = line.rstrip(os.linesep) if line.startswith(result_line_prefix): rate = float(line[len(result_line_prefix):]) os.waitpid(subprocess.pid, 0) #end processing return rate if __name__ == '__main__': parser = ArgumentParser(description='Evaluate correction rate.') parser.add_argument('--finaldir', action='store', \ help='final directory', \ default=config.getFinalModelDir()) parser.add_argument('tryname', action='store', \ help='the storage directory') args = parser.parse_args() print(args) tryname = 'try' + args.tryname trydir = os.path.join(args.finaldir, tryname) if not os.access(trydir, os.F_OK): sys.exit(tryname + "doesn't exist.") cwdstatuspath = os.path.join(trydir, config.getFinalStatusFileName()) cwdstatus = utils.load_status(cwdstatuspath) if not utils.check_epoch(cwdstatus, 'Prune'): raise utils.EpochError('Please tryprune first.')
help='CDF parameter of k mixture model prune', \ default=0.99, type=float) parser.add_argument('--fast', action='store_const', \ help='Use in-memory filesystem to speed up prune',\ const=True, default=False) parser.add_argument('tryname', action='store', \ help='the storage directory') args = parser.parse_args() print(args) tryname = 'try' + args.tryname trydir = os.path.join(config.getFinalModelDir(), tryname) #check try<name> directory if os.access(trydir, os.F_OK): sys.exit(tryname + ' exists.') os.makedirs(trydir) cwdstatuspath = os.path.join(trydir, config.getFinalStatusFileName()) cwdstatus = {} cwdstatus['PruneMergeNumber'] = args.merge cwdstatus['PruneK'] = args.k cwdstatus['PruneCDF'] = args.CDF utils.store_status(cwdstatuspath, cwdstatus) #merge model candidates print('merging')