Exemplo n.º 1
0
def override_params(params, args):
    params.parse(args.parameters.lower())

    src_vocab, src_w2idx, src_idx2w = data.load_vocabulary(args.vocabulary[0])
    tgt_vocab, tgt_w2idx, tgt_idx2w = data.load_vocabulary(args.vocabulary[1])

    params.vocabulary = {"source": src_vocab, "target": tgt_vocab}
    params.lookup = {"source": src_w2idx, "target": tgt_w2idx}
    params.mapping = {"source": src_idx2w, "target": tgt_idx2w}

    return params
Exemplo n.º 2
0
def override_params(params, args):
    params.model = args.model or params.model
    params.input = args.input or params.input
    params.output = args.output or params.output
    params.vocab = args.vocabulary or params.vocab
    params.validation = args.validation or params.validation
    params.references = args.references or params.references
    params.parse(args.parameters.lower())

    src_vocab, src_w2idx, src_idx2w = data.load_vocabulary(params.vocab[0])
    tgt_vocab, tgt_w2idx, tgt_idx2w = data.load_vocabulary(params.vocab[1])

    params.vocabulary = {"source": src_vocab, "target": tgt_vocab}
    params.lookup = {"source": src_w2idx, "target": tgt_w2idx}
    params.mapping = {"source": src_idx2w, "target": tgt_idx2w}

    return params