Пример #1
0
from Io.data_loader import create_batch_iter
from preprocessing.data_processor import read_squad_data, convert_examples_to_features, read_qa_examples
from pytorch_pretrained_bert.tokenization import BertTokenizer
from predict.predict import main

if __name__ == "__main__":
    read_squad_data(
        "/home/LAB/liqian/test/game/Fin/CCKS-Mrc/data/squad_like_test.json",
        "/home/LAB/liqian/test/game/Fin/CCKS-Mrc/data/",
        is_training=False)
    # examples = read_qa_examples("/home/LAB/liqian/test/game/ccks-2020-finance-transfer-ee-baseline-master/CCKS-Mrc/data/", "test")
    examples = read_qa_examples(
        "/home/LAB/liqian/test/game/Fin/CCKS-Mrc/data/", "test")
    main('/home/LAB/liqian/test/game/Fin/CCKS-Mrc/data/')
Пример #2
0
import json
from predict.predict import main
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "2,3"

if __name__ == '__main__':
    test_data_path = "../data/data.json"
    data_dir = "../result/"
    main(test_data_path, data_dir)
    result = []
    with open("../result/nbest_predictions.json", "r", encoding="utf-8") as fr:
        data = json.load(fr)
    for key, value in data.items():
        res = {"answer": value[0]["text"], "id": key}
        result.append(res)
    with open("../result/result.json", 'w') as fr:
        json.dump(result, fr)
from Io.data_loader import create_batch_iter
from preprocessing.data_processor import read_squad_data, convert_examples_to_features, read_qa_examples
from pytorch_pretrained_bert.tokenization import BertTokenizer
from predict.predict import main

if __name__ == "__main__":
    read_squad_data("data/squad_like_test.json", "data/", is_training=False)
    examples = read_qa_examples("data/", "test")
    main('data/')