forked from martin-wey/ast-probe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_experiments_rq4.py
60 lines (53 loc) · 1.95 KB
/
run_experiments_rq4.py
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
import os
def main():
models = ['microsoft/codebert-base', 'microsoft/graphcodebert-base',
'Salesforce/codet5-base', 'huggingface/CodeBERTa-small-v1',
'roberta-base']
folders = ['codebert', 'graphcodebert', 'codet5', 'codeberta', 'roberta']
model_types = ['roberta', 'roberta', 't5', 'roberta', 'roberta']
for lang in ['python', 'javascript', 'go']:
for model, folder, model_type in zip(models, folders, model_types):
layers = [get_layer_model(lang, folder)]
for layer in layers:
for rank in [8, 16, 32, 64, 128, 256, 512]:
run_name = '_'.join([folder, lang, str(layer), str(rank), 'rq4'])
os.system(f"CUDA_VISIBLE_DEVICES=3 python src/main.py --do_train --run_name {run_name} "
f"--pretrained_model_name_or_path {model} "
f"--model_type {model_type} --lang {lang} "
f"--layer {layer} --rank {rank}")
def get_layer_model(lang, folder):
if lang == 'python':
if folder == 'codebert':
return 5
if folder == 'graphcodebert':
return 4
if folder == 'codet5':
return 7
if folder == 'codeberta':
return 4
if folder == 'roberta':
return 5
if lang == 'go':
if folder == 'codebert':
return 5
if folder == 'graphcodebert':
return 5
if folder == 'codet5':
return 8
if folder == 'codeberta':
return 4
if folder == 'roberta':
return 5
if lang == 'javascript':
if folder == 'codebert':
return 5
if folder == 'graphcodebert':
return 4
if folder == 'codet5':
return 6
if folder == 'codeberta':
return 5
if folder == 'roberta':
return 8
if __name__ == '__main__':
main()