-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig.py
162 lines (150 loc) · 4.64 KB
/
config.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
TASKS = (
'forward_synthesis',
'retrosynthesis',
'molecule_captioning',
'molecule_generation',
'name_conversion-i2f',
'name_conversion-i2s',
'name_conversion-s2f',
'name_conversion-s2i',
'property_prediction-esol',
'property_prediction-lipo',
'property_prediction-bbbp',
'property_prediction-clintox',
'property_prediction-hiv',
'property_prediction-sider',
)
DEFAULT_MAX_INPUT_TOKENS = 512
DEFAULT_MAX_NEW_TOKENS = 1024
TASKS_GENERATION_SETTINGS = {
'forward_synthesis': {
'generation_kargs': {
'num_return_sequences': 5,
'num_beams': 8
},
},
'retrosynthesis': {
'max_new_tokens': 960,
'generation_kargs': {
'num_return_sequences': 10,
'num_beams': 13
},
},
'molecule_captioning': {
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4
},
},
'molecule_generation': {
'generation_kargs': {
'num_return_sequences': 5,
'num_beams': 8
},
},
'name_conversion-i2f': {
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 3,
'num_beams': 6
},
},
'name_conversion-i2s': {
'generation_kargs': {
'num_return_sequences': 5,
'num_beams': 8
},
},
'name_conversion-s2f': {
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 3,
'num_beams': 6
},
},
'name_conversion-s2i': {
'generation_kargs': {
'num_return_sequences': 5,
'num_beams': 8
},
},
'property_prediction-esol': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
'property_prediction-lipo': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
'property_prediction-bbbp': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
'property_prediction-clintox': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
'property_prediction-hiv': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
'property_prediction-sider': {
'batch_size': 16,
'max_new_tokens': 20,
'generation_kargs': {
'num_return_sequences': 1,
'num_beams': 4,
},
},
}
TASK_TAGS = {
'forward_synthesis': ('<SMILES>', '</SMILES>'),
'retrosynthesis': ('<SMILES>', '</SMILES>'),
'molecule_generation': ('<SMILES>', '</SMILES>'),
'molecule_captioning': (None, None),
'name_conversion-i2f': ('<MOLFORMULA>', '</MOLFORMULA>'),
'name_conversion-i2s': ('<SMILES>', '</SMILES>'),
'name_conversion-s2f': ('<MOLFORMULA>', '</MOLFORMULA>'),
'name_conversion-s2i': ('<IUPAC>', '</IUPAC>'),
'property_prediction-esol': ('<NUMBER>', '</NUMBER>'),
'property_prediction-lipo': ('<NUMBER>', '</NUMBER>'),
'property_prediction-bbbp': ('<BOOLEAN>', '</BOOLEAN>'),
'property_prediction-clintox': ('<BOOLEAN>', '</BOOLEAN>'),
'property_prediction-hiv': ('<BOOLEAN>', '</BOOLEAN>'),
'property_prediction-sider': ('<BOOLEAN>', '</BOOLEAN>'),
}
# These tasks output SMILES, where there may be semicolons that separate different parts. To facilitate evaluation, each semicolon is replaced by a dot.
TASKS_WITH_SEMICOLON_REPLACE = ('forward_synthesis', 'retrosynthesis', 'molecule_generation', 'name_conversion-i2s',)
# For these tasks, one input might have multiple gold answers, so the gold answer should be directly obtained from the dataset instead of directly using the gold domain of each sample.
TASKS_WITH_READING_GOLD_FROM_DATASET = (
'forward_synthesis', 'retrosynthesis',
'molecule_generation', 'molecule_captioning',
'name_conversion-i2f', 'name_conversion-i2s',
'name_conversion-s2f', 'name_conversion-s2i'
)
BASE_MODELS = {
'osunlp/LlaSMol-Mistral-7B': 'mistralai/Mistral-7B-v0.1',
'osunlp/LlaSMol-Galactica-6.7B': 'facebook/galactica-6.7b',
'osunlp/LlaSMol-Llama2-7B': 'meta-llama/Llama-2-7b-hf',
'osunlp/LlaSMol-CodeLlama-7B': 'codellama/CodeLlama-7b-hf',
}