-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinetune_pretrained_gr.sh
executable file
·51 lines (42 loc) · 1.69 KB
/
finetune_pretrained_gr.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
#!/bin/sh
# A script to finetune a pretrained huggingface model and eval on OffensEval 2020 Greek data
# Note: Set Config parameter in D4.cmd
source ~/anaconda3/etc/profile.d/conda.sh
conda activate ./573_gpu
# Test whether condor is using GPU
python3 src/test_gpu.py
# Preprocess tweets
# note: when available, update with greek-specific preprocessing script
python3 src/preprocess_olid.py \
--file data/offenseval-gr-training-v1.tsv \
--train_ids data/gr_train_ids.txt \
--val_ids data/gr_val_ids.txt \
--split_punctuation \
--remove_hashtags \
--language greek
# Finetune pretrained model on training data
python3 src/finetune_pretrained.py \
--train_data data/clean_train_greek.tsv \
--val_data data/clean_val_greek.tsv \
--config configs/${1}.json \
--train_mode greek
# Run finetuned model predictions on Greek data and generate output
python3 src/finetune_predict.py \
--val_data data/clean_val_greek.tsv \
--config configs/${1}.json \
--model_path models/${1}_greek \
--val_output_csv outputs/D4/D4_greek_preds_greek-only.csv
# Evaluation script (Greek)
python3 src/eval.py \
--val_output_csv outputs/D4/D4_greek_preds_greek-only.csv \
--output_path results/D4_greek_scores_greek-only.out
# Run finetuned model predictions on English data and generate output
python3 src/finetune_predict.py \
--val_data data/clean_val_english.tsv \
--config configs/${1}.json \
--model_path models/${1}_greek \
--val_output_csv outputs/D4/D4_english_preds_greek-only.csv
# Evaluation script (English)
python3 src/eval.py \
--val_output_csv outputs/D4/D4_english_preds_greek-only.csv \
--output_path results/D4_english_scores_greek-only.out