-
Notifications
You must be signed in to change notification settings - Fork 0
/
finetune_pretrained_hybrid.sh
executable file
·60 lines (49 loc) · 1.92 KB
/
finetune_pretrained_hybrid.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
#!/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 Greek tweets
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
# Preprocess English tweets
python3 src/preprocess_olid.py \
--file data/olid-training-v1.0.tsv \
--train_ids data/eng_train_ids.txt \
--val_ids data/eng_val_ids.txt \
--split_punctuation \
--remove_apostraphes \
--remove_hashtags
# Finetune pretrained model on training data
python3 src/finetune_pretrained.py \
--train_data data/clean_train_greek.tsv data/clean_train_english.tsv \
--val_data data/clean_val_greek.tsv data/clean_val_english.tsv \
--config configs/${1}.json \
--train_mode hybrid
# 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}_hybrid \
--val_output_csv outputs/D4/D4_greek_preds_hybrid.csv
# Evaluation script (Greek)
python3 src/eval.py \
--val_output_csv outputs/D4/D4_greek_preds_hybrid.csv \
--output_path results/D4_greek_scores_hybrid.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}_hybrid \
--val_output_csv outputs/D4/D4_english_preds_hybrid.csv
# Evaluation script (English)
python3 src/eval.py \
--val_output_csv outputs/D4/D4_english_preds_hybrid.csv \
--output_path results/D4_english_scores_hybrid.out