Esempio n. 1
0
            input_embeddings,
            update_embeddings = update_embeddings,
            hidden_dim = hidden_dim,
            order = 3,
        )
    elif args["lstm"]:
        net = networks.LSTM(
            model,
            input_embeddings,
            update_embeddings = update_embeddings,
            hidden_dim = hidden_dim,
        )
    elif args["bow"]:
        net = networks.BOW(
            model,
            input_embeddings,
            update_embeddings = update_embeddings,
            hidden_dim = hidden_dim,
        )
    elif args["tree-lstm"]:
        input_embeddings = np.load("data/dicteval/input_embeddings_parsed.reduced.npy")
        net = networks.CYK(
            model,
            input_embeddings,
            update_embeddings = update_embeddings,
            hidden_dim = hidden_dim,
        )
        parsed = True

    if args["--restart"]:
        restart = int(args["--restart"])
    else:
Esempio n. 2
0
            input_embeddings,
            update_embeddings=False,
            hidden_dim=100,
            order=3,
        )
    elif args["lstm"]:
        net = networks.LSTM(
            model,
            input_embeddings,
            update_embeddings=False,
            hidden_dim=100,
        )
    elif args["bow"]:
        net = networks.BOW(
            model,
            input_embeddings,
            update_embeddings=False,
            hidden_dim=100,
        )
    elif args["tree-lstm"]:
        net = networks.CYK(
            model,
            input_embeddings,
            update_embeddings=False,
            hidden_dim=100,
        )
        parsed = True

    classifier = networks.SNLIClassifier(model, input_embeddings.shape[1])
    model.load(args["<model-file>"])
    print(eval_nli_dataset(net, classifier, test, parsed))