-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathquick_start_xorqa.sh
63 lines (58 loc) · 2.13 KB
/
quick_start_xorqa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# download models
mkdir models
wget https://nlp.cs.washington.edu/xorqa/cora/models/all_w100.tsv
wget https://nlp.cs.washington.edu/xorqa/cora/models/mGEN_model.zip
wget https://nlp.cs.washington.edu/xorqa/cora/models/mDPR_biencoder_best.cpt
unzip mGEN_model.zip
mkdir embeddings
cd embeddings
for i in 0 1 2 3 4 5 6 7;
do
wget https://nlp.cs.washington.edu/xorqa/cora/models/wikipedia_split/wiki_emb_en_$i
done
for i in 0 1 2 3 4 5 6 7;
do
wget https://nlp.cs.washington.edu/xorqa/cora/models/wikipedia_split/wiki_emb_others_$i
done
cd ../..
# download eval data
mkdir data
cd data
wget https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_dev_full_v1_1.jsonl
wget https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_retrieve_eng_span.jsonl
wget https://nlp.cs.washington.edu/xorqa/XORQA_site/data/xor_train_full.jsonl
cd ..
# Run mDPR
cd mDPR
python dense_retriever.py \
--model_file ../models/mDPR_biencoder_best.cpt \
--ctx_file ../models/all_w100.tsv \
--qa_file ../data/xor_dev_full_v1_1.jsonl \
--encoded_ctx_file "../models/embeddings/wikipedia_split/wiki_emb_*" \
--out_file xor_dev_dpr_retrieval_results.json \
--n-docs 20 --validation_workers 1 --batch_size 256 --add_lang
cd ..
# Convert data
cd mGEN
python3 convert_dpr_retrieval_results_to_seq2seq.py \
--dev_fp ../mDPR/xor_dev_dpr_retrieval_results.json \
--output_dir xorqa_dev_final_retriever_results \
--top_n 15 \
--add_lang \
--xor_engspan_train ../data/xor_train_retrieve_eng_span.jsonl \
--xor_full_train ../data/xor_train_full.jsonl \
--xor_full_dev ../data/xor_dev_full_v1_1.jsonl
# Run mGEN
CUDA_VISIBLE_DEVICES=0 python eval_mgen.py \
--model_name_or_path \
--evaluation_set xorqa_dev_final_retriever_results/val.source \
--gold_data_path xorqa_dev_final_retriever_results/gold_para_qa_data_dev.tsv \
--predictions_path xor_dev_final_results.txt \
--gold_data_mode qa \
--model_type mt5 \
--max_length 20 \
--eval_batch_size 4
cd ..
# Run evaluation
cd eval_scripts
python eval_xor_full.py --data_file ../data/xor_dev_full_v1_1.jsonl --pred_file ../mGEN/xor_dev_final_results.txt --txt_file