Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,107 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license: mit
|
5 |
+
tags:
|
6 |
+
- chemistry
|
7 |
+
- SMILES
|
8 |
+
- product
|
9 |
+
datasets:
|
10 |
+
- ORD
|
11 |
+
metrics:
|
12 |
+
- accuracy
|
13 |
+
---
|
14 |
+
|
15 |
+
# Model Card for ReactionT5v2-forward
|
16 |
+
|
17 |
+
This is a ReactionT5 pre-trained to predict the products of reactions. You can use the demo [here](https://huggingface.co/spaces/sagawa/ReactionT5_task_forward).
|
18 |
+
This is a ReactionT5 pre-trained to predict the products of reactions and fine-tuned on USPOT_50k's train split. Base model before fine-tuning is [here](https://huggingface.co/sagawa/ReactionT5v2-forward).
|
19 |
+
|
20 |
+
|
21 |
+
### Model Sources
|
22 |
+
|
23 |
+
<!-- Provide the basic links for the model. -->
|
24 |
+
|
25 |
+
- **Repository:** https://github.com/sagawatatsuya/ReactionT5v2
|
26 |
+
- **Paper:** https://arxiv.org/abs/2311.06708
|
27 |
+
- **Demo:** https://huggingface.co/spaces/sagawa/ReactionT5_task_forward
|
28 |
+
|
29 |
+
## Uses
|
30 |
+
|
31 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
32 |
+
You can use this model for forward reaction prediction or fine-tune this model with your dataset.
|
33 |
+
|
34 |
+
|
35 |
+
## How to Get Started with the Model
|
36 |
+
|
37 |
+
Use the code below to get started with the model.
|
38 |
+
|
39 |
+
```python
|
40 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
41 |
+
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained("sagawa/ReactionT5v2-forward", return_tensors="pt")
|
43 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("sagawa/ReactionT5v2-forward")
|
44 |
+
|
45 |
+
inp = tokenizer('REACTANT:COC(=O)C1=CCCN(C)C1.O.[Al+3].[H-].[Li+].[Na+].[OH-]REAGENT:C1CCOC1', return_tensors='pt')
|
46 |
+
output = model.generate(**inp, num_beams=1, num_return_sequences=1, return_dict_in_generate=True, output_scores=True)
|
47 |
+
output = tokenizer.decode(output['sequences'][0], skip_special_tokens=True).replace(' ', '').rstrip('.')
|
48 |
+
output # 'CN1CCC=C(CO)C1'
|
49 |
+
```
|
50 |
+
|
51 |
+
## Training Details
|
52 |
+
|
53 |
+
### Training Procedure
|
54 |
+
|
55 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
56 |
+
We used the Open Reaction Database (ORD) dataset for model training.
|
57 |
+
The command used for training is the following. For more information, please refer to the paper and GitHub repository.
|
58 |
+
|
59 |
+
```python
|
60 |
+
python train_without_duplicates.py \
|
61 |
+
--model='t5' \
|
62 |
+
--epochs=100 \
|
63 |
+
--lr=1e-3 \
|
64 |
+
--batch_size=32 \
|
65 |
+
--input_max_len=150 \
|
66 |
+
--target_max_len=100 \
|
67 |
+
--weight_decay=0.01 \
|
68 |
+
--evaluation_strategy='epoch' \
|
69 |
+
--save_strategy='epoch' \
|
70 |
+
--logging_strategy='epoch' \
|
71 |
+
--train_data_path='/home/acf15718oa/ReactionT5_neword/data/all_ord_reaction_uniq_with_attr20240506_v3_train.csv' \
|
72 |
+
--valid_data_path='/home/acf15718oa/ReactionT5_neword/data/all_ord_reaction_uniq_with_attr20240506_v3_valid.csv' \
|
73 |
+
--test_data_path='/home/acf15718oa/ReactionT5_neword/data/all_ord_reaction_uniq_with_attr20240506_v3_test.csv' \
|
74 |
+
--USPTO_test_data_path='/home/acf15718oa/ReactionT5_neword/data/USPTO_MIT/MIT_separated/test.csv' \
|
75 |
+
--disable_tqdm \
|
76 |
+
--pretrained_model_name_or_path='sagawa/ZINC-t5'
|
77 |
+
```
|
78 |
+
|
79 |
+
### Results
|
80 |
+
|
81 |
+
|
82 |
+
| Model | Training set | Test set | Top-1 [% acc.] | Top-2 [% acc.] | Top-3 [% acc.] | Top-5 [% acc.] |
|
83 |
+
|----------------------|---------------------------|----------|----------------|----------------|----------------|----------------|
|
84 |
+
| Sequence-to-sequence | USPTO_MIT | USPTO_MIT | 80.3 | 84.7 | 86.2 | 87.5 |
|
85 |
+
| WLDN | USPTO_MIT | USPTO_MIT | 80.6 (85.6) | 90.5 | 92.8 | 93.4 |
|
86 |
+
| Molecular Transformer| USPTO_MIT | USPTO_MIT | 88.8 | 92.6 | – | 94.4 |
|
87 |
+
| T5Chem | USPTO_MIT | USPTO_MIT | 90.4 | 94.2 | – | 96.4 |
|
88 |
+
| CompoundT5 | USPTO_MIT | USPTO_MIT | 86.6 | 89.5 | 90.4 | 91.2 |
|
89 |
+
| [ReactionT5 (This model)](https://huggingface.co/sagawa/ReactionT5v2-forward) | - | USPTO_MIT | 92.8 | 95.6 | 96.4 | 97.1 |
|
90 |
+
| [ReactionT5](https://huggingface.co/sagawa/ReactionT5v2-forward-USPTO_MIT) | USPTO_MIT | USPTO_MIT | 97.5 | 98.6 | 98.8 | 99.0 |
|
91 |
+
|
92 |
+
Performance comparison of Compound T5, ReactionT5, and other models in product prediction.
|
93 |
+
|
94 |
+
## Citation
|
95 |
+
|
96 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
97 |
+
arxiv link: https://arxiv.org/abs/2311.06708
|
98 |
+
```
|
99 |
+
@misc{sagawa2023reactiont5,
|
100 |
+
title={ReactionT5: a large-scale pre-trained model towards application of limited reaction data},
|
101 |
+
author={Tatsuya Sagawa and Ryosuke Kojima},
|
102 |
+
year={2023},
|
103 |
+
eprint={2311.06708},
|
104 |
+
archivePrefix={arXiv},
|
105 |
+
primaryClass={physics.chem-ph}
|
106 |
+
}
|
107 |
+
```
|