Exemplo n.º 1
0
    print(args.__dict__)

    if not os.path.exists(args.checkpoint_dir) and args.to_log == 1:
        os.makedirs(args.checkpoint_dir)
        os.makedirs(args.log_dir)

    if args.model_type == 'pacman':

        model_kwargs = {'question_vocab': load_vocab(args.vocab_json)}
        shared_model = NavPlannerControllerModel(**model_kwargs)

    else:

        exit()

    shared_model.share_memory()

    if args.checkpoint_path != False:
        print('Loading params from checkpoint: %s' % args.checkpoint_path)
        shared_model.load_state_dict(checkpoint['state'])

    if args.mode == 'eval':

        eval(0, args, shared_model)

    elif args.mode == 'train':

        train(0, args, shared_model)

    else:
Exemplo n.º 2
0
    print(args.__dict__)

    if not os.path.exists(args.checkpoint_dir) and args.to_log == 1:
        os.makedirs(args.checkpoint_dir)
        os.makedirs(args.log_dir)

    if args.model_type == 'pacman':

        model_kwargs = {'question_vocab': load_vocab(args.vocab_json)}
        shared_nav_model = NavPlannerControllerModel(**model_kwargs)

    else:

        exit()

    shared_nav_model.share_memory()

    print('Loading navigation params from checkpoint: %s' %
          args.nav_checkpoint_path)
    shared_nav_model.load_state_dict(checkpoint['state'])

    # Load answering model
    print('Loading answering checkpoint from %s' % args.ans_checkpoint_path)
    ans_checkpoint = torch.load(args.ans_checkpoint_path,
                                map_location={'cuda:0': 'cpu'})

    ans_model_kwargs = {'vocab': load_vocab(args.vocab_json)}
    shared_ans_model = VqaLstmCnnAttentionModel(**ans_model_kwargs)

    shared_ans_model.share_memory()
Exemplo n.º 3
0
    print(args.__dict__)

    if not os.path.exists(args.checkpoint_dir) and args.to_log == 1:
        os.makedirs(args.checkpoint_dir)
        os.makedirs(args.log_dir)

    if args.model_type == 'pacman':

        model_kwargs = {'question_vocab': load_vocab(args.vocab_json)}
        shared_nav_model = NavPlannerControllerModel(**model_kwargs)

    else:

        exit()

    shared_nav_model.share_memory()

    print('Loading navigation params from checkpoint: %s' %
          args.nav_checkpoint_path)
    shared_nav_model.load_state_dict(checkpoint['state'])

    # Load answering model
    print('Loading answering checkpoint from %s' % args.ans_checkpoint_path)
    ans_checkpoint = torch.load(
        args.ans_checkpoint_path, map_location={
            'cuda:0': 'cpu'
        })

    ans_model_kwargs = {'vocab': load_vocab(args.vocab_json)}
    shared_ans_model = VqaLstmCnnAttentionModel(**ans_model_kwargs)