Exemplo n.º 1
0
def main():
    parser = argparse_util.ArgumentParser(description='asyn_ML')
    parser.add_argument('--name', dest='name', default='', help='name of task')
    parser.add_argument(
        '--model_file',
        dest='model_file',
        default='sanity_test.py',
        help=
        'py file that contains model-specific methods, must include init(), train(), get_data(), finish()'
    )
    args = parser.parse_args()
    async_ML(args)
    serial_ML(args)
Exemplo n.º 2
0
            open(filename_prefix+'_'+functor_name+'.txt', 'w+').write('\n'.join(write_filenames))
#get_ground_output()

if __name__ == '__main__':
#if False:
            
    x = tf.placeholder(tf.float32, shape=(None, None, None, 3))
    _out_x = tf.placeholder(tf.float32, shape=(None, None, None, 3))
    x._compiler_name = 'x'
    _output_array = f(x)
    _approxnode = util.get_approxnode(x,_out_x,_output_array)
    #dt1 = train_unet1()
    #dt2 = train_unet2(read_from='saver', is_test=True, ntest=10)
    #train_unet2()
    
    parser = argparse_util.ArgumentParser(description='Test on unet')
    parser.add_argument('saver_name', help='specify the saver directory')
    parser.add_argument('--is-test', dest='is_test', action='store_true', help='indicates testing')
    parser.add_argument('--is-train', dest='is_test', action='store_false', help='indicates training')
    parser.add_argument('--gpu-name', dest='gpu', default='0', help='name of GPU to use')
    parser.add_argument('--get-error', dest='error', action='store_true', help='get quantative error reports')
    
    parser.set_defaults(is_test=True)
    parser.set_defaults(error=False)
    args = parser.parse_args()
    
    saver_name = args.saver_name
    is_test = args.is_test
    os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu
    
    shuffle = True
Exemplo n.º 3
0
def main():
    parser = argparse_util.ArgumentParser(
        description='Toy procedural model problem.')
    parser.add_argument('--random-restarts',
                        dest='random_restarts',
                        type=int,
                        default=1,
                        help='number of random restarts')
    parser.add_argument('--GPU',
                        dest='gpu',
                        default='0',
                        help='name of GPU to use')
    parser.add_argument('--rescale',
                        dest='rescale',
                        action='store_true',
                        help='rescale variables')
    parser.add_argument('--no-rescale',
                        dest='rescale',
                        action='store_false',
                        help='no rescale variables')
    parser.add_argument('--loss-type',
                        dest='loss_type',
                        default='triple',
                        help='loss used to optimize')
    parser.add_argument('--use-float32',
                        dest='use_float32',
                        action='store_true',
                        help='use float32 as dtype')
    parser.add_argument('--use-float64',
                        dest='use_float32',
                        action='store_false',
                        help='use float64 as dtype')
    parser.add_argument('--overlap',
                        dest='test_overlap',
                        action='store_true',
                        help='force the tree have overlap branches')
    parser.add_argument('--no-overlap',
                        dest='test_overlap',
                        action='store_false',
                        help='do not force tree have overlap branches')
    parser.add_argument(
        '--seperate-minimizer',
        dest='seperate_minimizer',
        action='store_true',
        help='use seperate minimizer for different level of loss')
    parser.add_argument('--single-minimizer',
                        dest='seperate_minimizer',
                        action='store_false',
                        help='use single miimizer for different level of loss')
    parser.add_argument('--large-angle',
                        dest='large_angle',
                        action='store_true',
                        help='force the tree having large branch angle')
    parser.add_argument('--no-large-angle',
                        dest='large_angle',
                        action='store_false',
                        help='do not force the tree having large branch angle')
    parser.add_argument('--prefix',
                        dest='prefix',
                        default='',
                        help='unique prefix name to store data')
    parser.add_argument(
        '--ground',
        dest='ground',
        default='',
        help='use a deterministic ground truth image instead of random')
    parser.add_argument(
        '--change-lrate',
        dest='change_lrate',
        type=float,
        default=1.0,
        help='multiplier used to change learning rate for seperate minimizers')
    parser.add_argument(
        '--interpolate-loss',
        dest='interpolate_loss',
        type=float,
        default=0.0,
        help='interpolate between current level and previous level of loss')
    parser.add_argument('--iter',
                        dest='iter',
                        type=int,
                        default=100,
                        help='number of iter per level of loss')
    parser.add_argument('--change-len',
                        dest='change_len',
                        action='store_true',
                        help='branch length also variable')
    parser.add_argument('--fix-len',
                        dest='change_len',
                        action='store_false',
                        help='branch length is fixed')
    parser.add_argument(
        '--single-loss',
        dest='multi_loss',
        action='store_false',
        help='use the sum of all different level of losses as objective')
    parser.add_argument('--multi-loss',
                        dest='multi_loss',
                        action='store_true',
                        help='use multiple objectives')
    parser.add_argument('--optimizer',
                        dest='optimizer',
                        default='adam',
                        help='name of optimizer to use')
    parser.add_argument('--smooth-transition',
                        dest='smooth',
                        action='store_true',
                        help='smoothly transit between losses')
    parser.add_argument('--discrete-transition',
                        dest='smooth',
                        action='store_false',
                        help='discretly transit between losses')
    parser.add_argument('--beta1',
                        dest='beta1',
                        type=float,
                        default=0.9,
                        help='parameter beta1 for adam optimizer')
    parser.add_argument('--beta2',
                        dest='beta2',
                        type=float,
                        default=0.99,
                        help='parameter beta2 for adam optimizer')
    parser.add_argument('--learning-rate',
                        dest='learning_rate',
                        type=float,
                        default=0.1,
                        help='parameter learning rate for optimizer')
    parser.add_argument(
        '--append-random',
        dest='append_random',
        action='store_true',
        help=
        'append more iterations on existing optimization that adds randomsness'
    )
    parser.add_argument('--sigma',
                        dest='sigma',
                        type=float,
                        default=0.1,
                        help='sigma applied to random purturbation')
    parser.add_argument('--random-gradient',
                        dest='random_gradient',
                        action='store_true',
                        help='add randomness to gradient')

    parser.set_defaults(rescale=True)
    parser.set_defaults(use_float32=True)
    parser.set_defaults(test_overlap=False)
    parser.set_defaults(seperate_minimizer=True)
    parser.set_defaults(large_angle=False)
    parser.set_defaults(change_len=False)
    parser.set_defaults(multi_loss=True)
    parser.set_defaults(smooth=False)
    parser.set_defaults(append_random=False)
    parser.set_defaults(random_gradient=False)

    args = parser.parse_args()

    global random_restarts
    random_restarts = args.random_restarts
    global rescale
    rescale = args.rescale
    global loss_type
    global increment_color
    loss_type = args.loss_type
    if loss_type == 'incremental':
        increment_color = True
    else:
        increment_color = False
    global use_float32
    use_float32 = args.use_float32
    global test_overlap
    test_overlap = args.test_overlap
    global seperate_minimizer
    seperate_minimizer = args.seperate_minimizer
    global large_angle
    large_angle = args.large_angle

    os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu

    if args.prefix == '':
        args.prefix = ''.join(random.choice(string.digits) for _ in range(5))
    #test4(args.prefix, args.ground, args.change_lrate, args.interpolate_loss, str(args))
    test4(args)