QizhiPei commited on
Commit
3ff40d0
1 Parent(s): 569e0b9

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -0
README.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ datasets:
4
+ - QizhiPei/BioT5_finetune_dataset
5
+ language:
6
+ - en
7
+ ---
8
+ ## Example Usage
9
+ ```python
10
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
11
+
12
+ tokenizer = T5Tokenizer.from_pretrained("QizhiPei/biot5-base-text2mol", model_max_length=512)
13
+ model = T5ForConditionalGeneration.from_pretrained('QizhiPei/biot5-base-text2mol')
14
+
15
+ task_definition = 'Definition: You are given a molecule description in English. Your job is to generate the molecule SELFIES that fits the description.\n\n'
16
+ text_input = 'The molecule is a monocarboxylic acid anion obtained by deprotonation of the carboxy and sulfino groups of 3-sulfinopropionic acid. Major microspecies at pH 7.3 It is an organosulfinate oxoanion and a monocarboxylic acid anion. It is a conjugate base of a 3-sulfinopropionic acid.'
17
+ task_input = f'Now complete the following example -\nInput: {text_input}\nOutput: '
18
+
19
+ model_input = task_definition + task_input
20
+ input_ids = tokenizer(model_input, return_tensors="pt").input_ids
21
+
22
+ generation_config = model.generation_config
23
+ generation_config.max_length = 512
24
+ generation_config.num_beams = 1
25
+
26
+ outputs = model.generate(input_ids, generation_config=generation_config)
27
+ output_selfies = tokenizer.decode(outputs[0], skip_special_tokens=True).replace(' ', '')
28
+ print(output_selfies)
29
+
30
+ import selfies as sf
31
+ output_smiles = sf.decoder(output_selfies)
32
+ print(output_smiles)
33
+ ```
34
+
35
+ ## References
36
+ For more information, please refer to our paper and GitHub repository.
37
+
38
+ Paper: [BioT5: Enriching Cross-modal Integration in Biology with Chemical Knowledge and Natural Language Associations](https://arxiv.org/abs/2310.07276)
39
+
40
+ GitHub: [BioT5](https://github.com/QizhiPei/BioT5)
41
+
42
+ Authors: *Qizhi Pei, Wei Zhang, Jinhua Zhu, Kehan Wu, Kaiyuan Gao, Lijun Wu, Yingce Xia, and Rui Yan*