sagawa commited on
Commit
e503ba5
1 Parent(s): f614b6a

Update README.md

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