sagawa commited on
Commit
3c77cc4
1 Parent(s): 5c85832

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +104 -3
README.md CHANGED
@@ -1,3 +1,104 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ tags:
6
+ - chemistry
7
+ - SMILES
8
+ - retrosynthesis
9
+ datasets:
10
+ - ORD
11
+ metrics:
12
+ - accuracy
13
+ ---
14
+
15
+ # Model Card for ReactionT5v2-retrosynthesis
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_retrosynthesis).
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/ReactionT5_task_retrosynthesis
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 retrosynthesis 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/ReactionT5v2-retrosynthesis", return_tensors="pt")
42
+ model = AutoModelForSeq2SeqLM.from_pretrained("sagawa/ReactionT5v2-retrosynthesis")
43
+
44
+ inp = tokenizer('CCN(CC)CCNC(=S)NC1CCCc2cc(C)cnc21', 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 # 'CCN(CC)CCN=C=S.Cc1cnc2c(c1)CCCC2N'
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=80 \
62
+ --lr=2e-4 \
63
+ --batch_size=32 \
64
+ --input_max_len=100 \
65
+ --target_max_len=150 \
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_50k/test.csv' \
74
+ --pretrained_model_name_or_path='sagawa/CompoundT5'
75
+ ```
76
+
77
+ ### Results
78
+
79
+ | Model | Training set | Test set | Top-1 [% acc.] | Top-2 [% acc.] | Top-3 [% acc.] | Top-5 [% acc.] |
80
+ |----------------------|---------------------------|----------|----------------|----------------|----------------|----------------|
81
+ | Sequence-to-sequence | USPTO_50k | USPTO_50k | 37.4 | - | 52.4 | 57.0 |
82
+ | Molecular Transformer| USPTO_50k | USPTO_50k | 43.5 | - | 60.5 | - |
83
+ | SCROP | USPTO_50k | USPTO_50k | 43.7 | - | 60.0 | 65.2 |
84
+ | T5Chem | USPTO_50k | USPTO_50k | 46.5 | - | 64.4 | 70.5 |
85
+ | CompoundT5 | USPTO_50k | USPTO_50k | 44,2 | 55.2 | 61.4 | 67.3 |
86
+ | ReactionT5 (This model) | - | USPTO_50k | 13.8 | 18.6 | 21.4 | 26.2 |
87
+ | ReactionT5 | USPTO_50k | USPTO_50k | 71.2 | 81.4 | 84.9 | 88.2 |
88
+
89
+ Performance comparison of Compound T5, ReactionT5, and other models in product prediction.
90
+
91
+ ## Citation
92
+
93
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
94
+ arxiv link: https://arxiv.org/abs/2311.06708
95
+ ```
96
+ @misc{sagawa2023reactiont5,
97
+ title={ReactionT5: a large-scale pre-trained model towards application of limited reaction data},
98
+ author={Tatsuya Sagawa and Ryosuke Kojima},
99
+ year={2023},
100
+ eprint={2311.06708},
101
+ archivePrefix={arXiv},
102
+ primaryClass={physics.chem-ph}
103
+ }
104
+ ```