dittops commited on
Commit
082bd3e
·
verified ·
1 Parent(s): 33ff81e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +154 -0
README.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-4.0
5
+ tags:
6
+ - chemistry
7
+ - molecule
8
+ - small molecule
9
+ - instructions
10
+ ---
11
+
12
+ > **Bud Ecosystem mirror** of [`osunlp/SMolInstruct`](https://huggingface.co/datasets/osunlp/SMolInstruct) — a verbatim copy for offline, reproducible model evaluation. License **unchanged (CC-BY-4.0)**; all rights remain with the original authors.
13
+
14
+ <h1 align="center"> ⚛️ SMolInstruct </h1>
15
+
16
+ SMolInstruct is a **large-scale**, **comprehensive**, and **high-quality instruction tuning dataset** crafted for **chemistry**. It centers around small molecules, and contains 14 meticulously selected tasks and over 3M samples.
17
+ This dataset has both **SMILES** and **SELFIES** versions, and you could switch to SELFIES by using `use_selfies=True` when loading.
18
+
19
+ **Version History**
20
+
21
+ - v1.3.0 (2024.09.17): Added unique `sample_id` in each sample. Also added doc for `insert_core_tags` which you can control if core information is wraped with core tags (e.g., \<SMILES\> ... \</SMILES\>).
22
+ - v1.2.0 (2024.04.21): Added a small test subset with at most 200 samples for each task. You could use it by assigning `use_test_subset=True`. Also added `use_first` to load the first specific number of samples for each task. See below for details.
23
+ - v1.1.1 (2024.04.18): Fixed double tag problem (`<SMILES> <SMILES> ... </SMILES> </SMILES>`) for retrosynthesis. We recommend all to use this or newer version.
24
+ - v1.1.0 (2024.03.05): Deleted a small amount of samples with invalid molecules, and add SELFIES.
25
+ - v1.0.0 (2024.02.13): Uploaded the first version.
26
+
27
+ **Paper**: [LlaSMol: Advancing Large Language Models for Chemistry with a Large-Scale, Comprehensive, High-Quality Instruction Tuning Dataset](https://arxiv.org/abs/2402.09391)
28
+
29
+ **Page**: [https://osu-nlp-group.github.io/LlaSMol](https://osu-nlp-group.github.io/LlaSMol)
30
+
31
+ **Code**: [https://github.com/OSU-NLP-Group/LlaSMol](https://github.com/OSU-NLP-Group/LlaSMol)
32
+
33
+ **Models**: [https://huggingface.co/osunlp/LlaSMol](https://huggingface.co/osunlp/LlaSMol)
34
+
35
+
36
+ ## 🔭 Overview
37
+
38
+ The following figure illustrates the tasks and corresponding examples.
39
+
40
+ ![Overview of the tasks.](./fig/tasks.png)
41
+
42
+ The following table shows the tasks and statistics over the SMolInstruct dataset, where “Qry.” and “Resp.” are average lengths of queries and responses, respectively.
43
+
44
+ ![Statistics of the SMolInstruct dataset.](./fig/statistics.png)
45
+
46
+ An example is shown below:
47
+
48
+ ```python
49
+ {
50
+ 'sample_id': 'forward_synthesis.train.1'
51
+ 'input': 'Based on the given reactants and reagents: <SMILES> CCCCCCCC/C=C\\CCCCCCCC(=O)OCCNCCOC(=O)CCCCCCC/C=C\\CCCCCCCC.CCN=C=NCCCN(C)C.CN(C)C1=CC=NC=C1.CN(C)CCSCC(=O)O.CO.Cl.ClCCl.O.O=C(O)C(F)(F)F.O=C([O-])[O-].[K+] </SMILES>, what product could potentially be produced?',
52
+ 'output': 'The product can be <SMILES> CCCCCCCC/C=C\\CCCCCCCC(=O)OCCN(CCOC(=O)CCCCCCC/C=C\\CCCCCCCC)C(=O)CSCCN(C)C </SMILES> .',
53
+ 'raw_input': 'CCCCCCCC/C=C\\CCCCCCCC(=O)OCCNCCOC(=O)CCCCCCC/C=C\\CCCCCCCC.CCN=C=NCCCN(C)C.CN(C)C1=CC=NC=C1.CN(C)CCSCC(=O)O.CO.Cl.ClCCl.O.O=C(O)C(F)(F)F.O=C([O-])[O-].[K+]',
54
+ 'raw_output': 'CCCCCCCC/C=C\\CCCCCCCC(=O)OCCN(CCOC(=O)CCCCCCC/C=C\\CCCCCCCC)C(=O)CSCCN(C)C',
55
+ 'split': 'train',
56
+ 'task': 'forward_synthesis',
57
+ 'input_core_tag_left': '<SMILES>',
58
+ 'input_core_tag_right': '</SMILES>',
59
+ 'output_core_tag_left': '<SMILES>',
60
+ 'output_core_tag_right': '</SMILES>',
61
+ 'target': None
62
+ }
63
+ ```
64
+
65
+ ## ⚔️ Usage
66
+ You can use the following lines to load the dataset:
67
+ ```python
68
+ from datasets import load_dataset
69
+
70
+ dataset = load_dataset('osunlp/SMolInstruct')
71
+
72
+ train_set = dataset['train']
73
+ validation_set = dataset['validation']
74
+ test_set = dataset['test']
75
+ ```
76
+
77
+ A SELFIES version could also be used, by simplying adding an argument:
78
+ ```python
79
+ dataset = load_dataset('osunlp/SMolInstruct', use_selfies=True)
80
+ ```
81
+
82
+ You can also specify what tasks to load:
83
+ ```python
84
+ ALL_TASKS = (
85
+ 'forward_synthesis',
86
+ 'retrosynthesis',
87
+ 'molecule_captioning',
88
+ 'molecule_generation',
89
+ 'name_conversion-i2f',
90
+ 'name_conversion-i2s',
91
+ 'name_conversion-s2f',
92
+ 'name_conversion-s2i',
93
+ 'property_prediction-esol',
94
+ 'property_prediction-lipo',
95
+ 'property_prediction-bbbp',
96
+ 'property_prediction-clintox',
97
+ 'property_prediction-hiv',
98
+ 'property_prediction-sider',
99
+ )
100
+
101
+ train_set = load_dataset('osunlp/SMolInstruct', tasks=ALL_TASKS)
102
+ ```
103
+
104
+ You could use `use_test_subset=True` to use a subset of the test set, to quickly evaluate your models. In this subset, each task has at most 200 samples.
105
+ ```python
106
+ test_set = load_dataset('osunlp/SMolInstruct', split='test', use_test_subset=True)
107
+ ```
108
+ You could also `use_first=INTEGER` to load only first at most `INTEGER` samples for each task.
109
+ ```python
110
+ # load first 500 samples for each task
111
+ test_set = load_dataset('osunlp/SMolInstruct', split='test', use_first=500)
112
+ ```
113
+
114
+ The argument `insert_core_tags` can control whether the core tags should be added. By default, it's `True`.
115
+
116
+ ```python
117
+ test_set = load_dataset('osunlp/SMolInstruct', split='test', insert_core_tags=False)
118
+ ```
119
+
120
+ ## 🛠️ Evaluation
121
+
122
+ The evaluation code will be at [https://github.com/OSU-NLP-Group/LlaSMol](https://github.com/OSU-NLP-Group/LlaSMol).
123
+
124
+ ## 🛠️ Data Construction
125
+
126
+ The construction of SMolInstruct goes through a four-step pipeline:
127
+
128
+ - **data collection**: Collect data from various sources and organize it for the tasks.
129
+ - **quality control**: Rigorous scrutiny is applied to remove samples with chemically invalid SMILES and wrong or inaccurate information, as well as duplicated samples.
130
+ - **data splitting**: Samples are carefully splitted into train/validation/test set to avoid data leakage across tasks. Also, the splitting is compatible with previous work to faciliate fair comparison.
131
+ - **instruction construction**: We create natural and diverse templates for creating instructions. Molecular SMILES representations are canonicalized to provide a standardized data format. In addition, we use special tags to encapsulate corresponding segments (e.g., <SMILES>...</SMILES>} for SMILES, etc.) to promote model learning during training and faciliate answer extraction during inference.
132
+
133
+
134
+ ## 🚨 License
135
+
136
+ The **SMolInstruct** dataset is licensed under CC BY 4.0.
137
+
138
+ We emphatically urge all users to adhere to the highest ethical standards when using our dataset, including maintaining fairness, transparency, and responsibility in their research. Any usage of the dataset that may lead to harm or pose a detriment to society is strictly **forbidden**.
139
+
140
+ ## 🔍 Citation
141
+ If our paper or related resources prove valuable to your research, we kindly ask for citation. Please feel free to contact us with any inquiries.
142
+
143
+ ```
144
+ @inproceedings{
145
+ yu2024llasmol,
146
+ title={Lla{SM}ol: Advancing Large Language Models for Chemistry with a Large-Scale, Comprehensive, High-Quality Instruction Tuning Dataset},
147
+ author={Botao Yu and Frazier N. Baker and Ziqi Chen and Xia Ning and Huan Sun},
148
+ booktitle={First Conference on Language Modeling},
149
+ year={2024},
150
+ url={https://openreview.net/forum?id=lY6XTF9tPv}
151
+ }
152
+ ```
153
+
154
+ Thank you for your interest in our work.