chembfn-webui 2.2.1__tar.gz → 2.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/PKG-INFO +183 -181
  2. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/bin/app.py +5 -5
  3. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/version.py +1 -1
  4. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/PKG-INFO +183 -181
  5. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/requires.txt +3 -0
  6. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/setup.cfg +4 -4
  7. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/setup.py +2 -0
  8. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/LICENSE +0 -0
  9. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/README.md +0 -0
  10. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/__init__.py +0 -0
  11. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/bin/favicon.png +0 -0
  12. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/cache/cache_file_here.txt +0 -0
  13. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/cache/results.csv +0 -0
  14. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/structs.py +0 -0
  15. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/utilities.py +0 -0
  16. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/base_model/place_base_model_here.txt +0 -0
  17. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/lora/place_lora_folder_here.txt +0 -0
  18. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/standalone_model/place_standalone_model_folder_here.txt +0 -0
  19. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/vocab/place_vocabulary_file_here.txt +0 -0
  20. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/SOURCES.txt +0 -0
  21. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/dependency_links.txt +0 -0
  22. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/entry_points.txt +0 -0
  23. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/top_level.txt +0 -0
  24. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/test/test_mk_model_dir.py +0 -0
  25. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/test/test_prompt_parsing.py +0 -0
  26. {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/test/test_user_expression_validator.py +0 -0
@@ -1,181 +1,183 @@
1
- Metadata-Version: 2.4
2
- Name: chembfn_webui
3
- Version: 2.2.1
4
- Summary: WebUI for ChemBFN
5
- Home-page: https://github.com/Augus1999/ChemBFN-WebUI
6
- Author: Nianze A. Tao
7
- Author-email: tao-nianze@hiroshima-u.ac.jp
8
- License: AGPL-3.0-or-later
9
- Project-URL: Source, https://github.com/Augus1999/ChemBFN-WebUI
10
- Keywords: Chemistry,CLM,ChemBFN,WebUI
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Programming Language :: Python :: 3.14
19
- Classifier: Topic :: Scientific/Engineering :: Chemistry
20
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
- Requires-Python: >=3.11
22
- Description-Content-Type: text/markdown
23
- License-File: LICENSE
24
- Requires-Dist: bayesianflow_for_chem>=2.4.0
25
- Requires-Dist: mol2chemfigPy3>=1.5.12
26
- Requires-Dist: gradio<7.0.0,>=6.0.0
27
- Requires-Dist: torch>=2.9.0
28
- Requires-Dist: rdkit>=2025.3.5
29
- Requires-Dist: selfies>=2.2.0
30
- Dynamic: author
31
- Dynamic: author-email
32
- Dynamic: classifier
33
- Dynamic: description
34
- Dynamic: description-content-type
35
- Dynamic: home-page
36
- Dynamic: keywords
37
- Dynamic: license
38
- Dynamic: license-file
39
- Dynamic: project-url
40
- Dynamic: requires-dist
41
- Dynamic: requires-python
42
- Dynamic: summary
43
-
44
- ## Web-based UI visualisation tool for ChemBFN method
45
-
46
- [![PyPI](https://img.shields.io/pypi/v/chembfn-webui?color=white)](https://pypi.org/project/chembfn-webui/)
47
- ![black](https://img.shields.io/badge/code%20style-black-black)
48
- [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
49
- ![CI](https://github.com/Augus1999/ChemBFN-WebUI/actions/workflows/pytest.yml/badge.svg)
50
-
51
-
52
-
53
- > Important:
54
- >
55
- > For the security concerning, it is not recommended to use this application as a public service.
56
- > When deploying on a local host as a shared application, it is better to install this application in a container or VM, to prevent this application from accessing the Internet, and to limit the premissions of read, create, and delete loacal files and directories.
57
-
58
- ### 1. Install
59
-
60
- ```bash
61
- $ pip install -U chembfn_webui
62
- ```
63
-
64
- ### 2. Place model files
65
-
66
- * Place customised vocabulary files (plain text .txt format) under [`chembfn_webui/model/vocab`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/vocab).
67
- * Place base model files (pretrained model in .pt format) under [`chembfn_webui/model/base_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/base_model).
68
- * Group standalone model files (`model.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/standalone_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/standalone_model).
69
- * Group LoRA model files (`lora.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/lora`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/lora).
70
-
71
- For example,
72
-
73
- ```
74
- ├───chembfn_webui
75
- ├───bin
76
- ├───cache
77
- ├───lib
78
- └───model
79
- ├───base_model
80
- | └───zinc15_190m.pt
81
- ├───lora
82
- │ └───csd_ees
83
- │ ├───lora.pt
84
- | ├───mlp.pt
85
- | └───config.json
86
- ├───standalone_model
87
- │ ├───guacamol
88
- │ | ├───model.pt
89
- │ | └───config.json
90
- │ └───qm9
91
- | ├───model.pt
92
- | ├───mlp.pt
93
- | └───config.json
94
- └───vocab
95
- └───moses_selfies_vocab.txt
96
- ```
97
-
98
- > Note:
99
- >
100
- > >The file `config.json` is automatically saved by CLI tool `Madmol` provided in `bayesianflow-for-chem` package. If you train models via Python API, you need to manually create that file for your models by filling in the tempate:
101
- > >```json
102
- > >{
103
- > > "padding_index": 0,
104
- > > "start_index": 1,
105
- > > "end_index": 2,
106
- > > "padding_strategy": "static",
107
- > > "padding_length": PADDING_LENGTH,
108
- > > "label": [LABEL_NAME_I, LABEL_NAME_II, ...],
109
- > > "name": JOB_NAME
110
- > >}
111
- > >```
112
- > >The configureation file for base models can be downloaded [here](https://huggingface.co/suenoomozawa/ChemBFN/resolve/main/config.json).
113
-
114
- If placed correctly, all these files can be seen in the "model explorer" tab.
115
-
116
- > You can use an external folder to host the models if it follows the same structure as [`chembfn_webui/model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model). See the next section for the method.
117
-
118
- ### 3. Launch the program
119
-
120
- I. launch the web-UI
121
- ```bash
122
- $ chembfn
123
- ```
124
-
125
- II. launch the web in a public link
126
- ```bash
127
- $ chembfn --public
128
- ```
129
-
130
- III. use an external directory to hold the model files (Linux and MacOS)
131
- ```bash
132
- $ CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} chembfn
133
- ```
134
-
135
- IV. use an external directory to hold the model files (Windows)
136
- ```powershell
137
- # if you use CMD
138
- > set CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} & chembfn
139
-
140
- # if you use PowerShell
141
- > $env:CHEMBFN_WEBUI_MODEL_DIR="{YOUR/MODEL/DIR}" & chembfn
142
- ```
143
-
144
- V. use an external directory to hold the model files (Notebook, Google Colab)
145
- ```python
146
- import os
147
- os.environ["CHEMBFN_WEBUI_MODEL_DIR"] = "{YOUR/MODEL/DIR}"
148
- !chembfn --public
149
- ```
150
-
151
- VI. create an empty folder to hold the model files
152
- ```bash
153
- $ chembfn --create_model_dir {YOUR/MODEL/DIR}
154
- ```
155
- A structured folder `YOUR/MODEL/DIR/model` will be created.
156
-
157
- ### 4. Write the prompt
158
-
159
- * Leave prompt blank for unconditional generation.
160
- * For standalone models, key in objective values in the format of `[a,b,c,...]` to pass the values to the model.
161
- * Key in `<name:A>` or `<name:A>:[a,b,c,...]` to select LoRA parameter and pass the objective values if necessary, where `name` is the LoRA model name and `A` is the LoRA scaling. You can easily select a LoRA model by clicking the model name in "LoRA models" tab as well.
162
- * You can stack several LoRA models together to form an ensemble model by prompt like `<name1:A1>:[a1,b1,c1,...];<name2:A2>:[a2,b2,...];...`. Note that here `A1`, `A2`, _etc_ are contributions of each model to the ensemble.
163
-
164
- ### 5. Advanced control
165
-
166
- Under "advanced control" tab
167
-
168
- * You can control semi-autoregressive behaviours by key in `F` for switching off SAR, `T` for switching on SAR, and prompt like `F,F,T,...` to individually control the SAR in an ensemble model.
169
- * You can add unwanted tokens, e.g., `[Cu],p,[Si]`.
170
- * You can customise the result preprocessing function, e.g., the model output a reaction SMILES "CCI.C[O-]>>COCC" which couldn't be recognised by RDKit; you can pass `lambda x: x.split(">>")[-1]` to force the program only looking at the products.
171
-
172
- ### 6. Generate molecules
173
-
174
- Click "RUN" then here you go! If error occured, please check your prompts and settings.
175
-
176
- ## Where to obtain the models?
177
-
178
- * Pretrained models: [https://huggingface.co/suenoomozawa/ChemBFN](https://huggingface.co/suenoomozawa/ChemBFN)
179
- * ChemBFN source code: [https://github.com/Augus1999/bayesian-flow-network-for-chemistry](https://github.com/Augus1999/bayesian-flow-network-for-chemistry)
180
- * ChemBFN document: [https://augus1999.github.io/bayesian-flow-network-for-chemistry/](https://augus1999.github.io/bayesian-flow-network-for-chemistry/)
181
- * ChemBFN package: [https://pypi.org/project/bayesianflow-for-chem/](https://pypi.org/project/bayesianflow-for-chem/)
1
+ Metadata-Version: 2.4
2
+ Name: chembfn_webui
3
+ Version: 2.2.2
4
+ Summary: WebUI for ChemBFN
5
+ Home-page: https://github.com/Augus1999/ChemBFN-WebUI
6
+ Author: Nianze A. Tao
7
+ Author-email: tao-nianze@hiroshima-u.ac.jp
8
+ License: AGPL-3.0-or-later
9
+ Project-URL: Source, https://github.com/Augus1999/ChemBFN-WebUI
10
+ Keywords: Chemistry,CLM,ChemBFN,WebUI
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: bayesianflow_for_chem>=2.4.0
26
+ Requires-Dist: mol2chemfigPy3>=1.5.12
27
+ Requires-Dist: gradio<7.0.0,>=6.0.0
28
+ Requires-Dist: torch>=2.9.0
29
+ Requires-Dist: rdkit!=2026.9.2,>=2025.3.5; platform_system == "Darwin"
30
+ Requires-Dist: rdkit>=2025.3.5
31
+ Requires-Dist: selfies>=2.2.0
32
+ Dynamic: author
33
+ Dynamic: author-email
34
+ Dynamic: classifier
35
+ Dynamic: description
36
+ Dynamic: description-content-type
37
+ Dynamic: home-page
38
+ Dynamic: keywords
39
+ Dynamic: license
40
+ Dynamic: license-file
41
+ Dynamic: project-url
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ ## Web-based UI visualisation tool for ChemBFN method
47
+
48
+ [![PyPI](https://img.shields.io/pypi/v/chembfn-webui?color=white)](https://pypi.org/project/chembfn-webui/)
49
+ ![black](https://img.shields.io/badge/code%20style-black-black)
50
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
51
+ ![CI](https://github.com/Augus1999/ChemBFN-WebUI/actions/workflows/pytest.yml/badge.svg)
52
+
53
+
54
+
55
+ > Important:
56
+ >
57
+ > For the security concerning, it is not recommended to use this application as a public service.
58
+ > When deploying on a local host as a shared application, it is better to install this application in a container or VM, to prevent this application from accessing the Internet, and to limit the premissions of read, create, and delete loacal files and directories.
59
+
60
+ ### 1. Install
61
+
62
+ ```bash
63
+ $ pip install -U chembfn_webui
64
+ ```
65
+
66
+ ### 2. Place model files
67
+
68
+ * Place customised vocabulary files (plain text .txt format) under [`chembfn_webui/model/vocab`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/vocab).
69
+ * Place base model files (pretrained model in .pt format) under [`chembfn_webui/model/base_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/base_model).
70
+ * Group standalone model files (`model.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/standalone_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/standalone_model).
71
+ * Group LoRA model files (`lora.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/lora`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/lora).
72
+
73
+ For example,
74
+
75
+ ```
76
+ ├───chembfn_webui
77
+ ├───bin
78
+ ├───cache
79
+ ├───lib
80
+ └───model
81
+ ├───base_model
82
+ | └───zinc15_190m.pt
83
+ ├───lora
84
+ │ └───csd_ees
85
+ │ ├───lora.pt
86
+ | ├───mlp.pt
87
+ | └───config.json
88
+ ├───standalone_model
89
+ │ ├───guacamol
90
+ │ | ├───model.pt
91
+ │ | └───config.json
92
+ │ └───qm9
93
+ | ├───model.pt
94
+ | ├───mlp.pt
95
+ | └───config.json
96
+ └───vocab
97
+ └───moses_selfies_vocab.txt
98
+ ```
99
+
100
+ > Note:
101
+ >
102
+ > >The file `config.json` is automatically saved by CLI tool `Madmol` provided in `bayesianflow-for-chem` package. If you train models via Python API, you need to manually create that file for your models by filling in the tempate:
103
+ > >```json
104
+ > >{
105
+ > > "padding_index": 0,
106
+ > > "start_index": 1,
107
+ > > "end_index": 2,
108
+ > > "padding_strategy": "static",
109
+ > > "padding_length": PADDING_LENGTH,
110
+ > > "label": [LABEL_NAME_I, LABEL_NAME_II, ...],
111
+ > > "name": JOB_NAME
112
+ > >}
113
+ > >```
114
+ > >The configureation file for base models can be downloaded [here](https://huggingface.co/suenoomozawa/ChemBFN/resolve/main/config.json).
115
+
116
+ If placed correctly, all these files can be seen in the "model explorer" tab.
117
+
118
+ > You can use an external folder to host the models if it follows the same structure as [`chembfn_webui/model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model). See the next section for the method.
119
+
120
+ ### 3. Launch the program
121
+
122
+ I. launch the web-UI
123
+ ```bash
124
+ $ chembfn
125
+ ```
126
+
127
+ II. launch the web in a public link
128
+ ```bash
129
+ $ chembfn --public
130
+ ```
131
+
132
+ III. use an external directory to hold the model files (Linux and MacOS)
133
+ ```bash
134
+ $ CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} chembfn
135
+ ```
136
+
137
+ IV. use an external directory to hold the model files (Windows)
138
+ ```powershell
139
+ # if you use CMD
140
+ > set CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} & chembfn
141
+
142
+ # if you use PowerShell
143
+ > $env:CHEMBFN_WEBUI_MODEL_DIR="{YOUR/MODEL/DIR}" & chembfn
144
+ ```
145
+
146
+ V. use an external directory to hold the model files (Notebook, Google Colab)
147
+ ```python
148
+ import os
149
+ os.environ["CHEMBFN_WEBUI_MODEL_DIR"] = "{YOUR/MODEL/DIR}"
150
+ !chembfn --public
151
+ ```
152
+
153
+ VI. create an empty folder to hold the model files
154
+ ```bash
155
+ $ chembfn --create_model_dir {YOUR/MODEL/DIR}
156
+ ```
157
+ A structured folder `YOUR/MODEL/DIR/model` will be created.
158
+
159
+ ### 4. Write the prompt
160
+
161
+ * Leave prompt blank for unconditional generation.
162
+ * For standalone models, key in objective values in the format of `[a,b,c,...]` to pass the values to the model.
163
+ * Key in `<name:A>` or `<name:A>:[a,b,c,...]` to select LoRA parameter and pass the objective values if necessary, where `name` is the LoRA model name and `A` is the LoRA scaling. You can easily select a LoRA model by clicking the model name in "LoRA models" tab as well.
164
+ * You can stack several LoRA models together to form an ensemble model by prompt like `<name1:A1>:[a1,b1,c1,...];<name2:A2>:[a2,b2,...];...`. Note that here `A1`, `A2`, _etc_ are contributions of each model to the ensemble.
165
+
166
+ ### 5. Advanced control
167
+
168
+ Under "advanced control" tab
169
+
170
+ * You can control semi-autoregressive behaviours by key in `F` for switching off SAR, `T` for switching on SAR, and prompt like `F,F,T,...` to individually control the SAR in an ensemble model.
171
+ * You can add unwanted tokens, e.g., `[Cu],p,[Si]`.
172
+ * You can customise the result preprocessing function, e.g., the model output a reaction SMILES "CCI.C[O-]>>COCC" which couldn't be recognised by RDKit; you can pass `lambda x: x.split(">>")[-1]` to force the program only looking at the products.
173
+
174
+ ### 6. Generate molecules
175
+
176
+ Click "RUN" then here you go! If error occured, please check your prompts and settings.
177
+
178
+ ## Where to obtain the models?
179
+
180
+ * Pretrained models: [https://huggingface.co/suenoomozawa/ChemBFN](https://huggingface.co/suenoomozawa/ChemBFN)
181
+ * ChemBFN source code: [https://github.com/Augus1999/bayesian-flow-network-for-chemistry](https://github.com/Augus1999/bayesian-flow-network-for-chemistry)
182
+ * ChemBFN document: [https://augus1999.github.io/bayesian-flow-network-for-chemistry/](https://augus1999.github.io/bayesian-flow-network-for-chemistry/)
183
+ * ChemBFN package: [https://pypi.org/project/bayesianflow-for-chem/](https://pypi.org/project/bayesianflow-for-chem/)
@@ -314,7 +314,7 @@ def run(
314
314
  standalone_model_dict[model_name] / "mlp.pt"
315
315
  )
316
316
  y = torch.tensor([prompt_info["objective"][0]], dtype=torch.float32)
317
- y = mlp.forward(y)
317
+ y = mlp(y)
318
318
  else:
319
319
  y = None
320
320
  _message.append(f"Sequence length set to {lmax} from model metadata.")
@@ -322,7 +322,7 @@ def run(
322
322
  if quantise == "on":
323
323
  quantise_model_(bfn)
324
324
  if jited == "on":
325
- bfn.compile()
325
+ bfn.compile(dynamic=True)
326
326
  elif len(prompt_info["lora"]) == 1:
327
327
  if not (lm := prompt_info["lora"][0]) in lora_model_dict:
328
328
  raise LoRAError(f"Cannot find LoRA model: &lt{lm}&gt")
@@ -349,7 +349,7 @@ def run(
349
349
  lora_model_dict[prompt_info["lora"][0]] / "mlp.pt"
350
350
  )
351
351
  y = torch.tensor([prompt_info["objective"][0]], dtype=torch.float32)
352
- y = mlp.forward(y)
352
+ y = mlp(y)
353
353
  else:
354
354
  y = None
355
355
  if prompt_info["lora_scaling"][0] != 1.0:
@@ -359,7 +359,7 @@ def run(
359
359
  if quantise == "on":
360
360
  quantise_model_(bfn)
361
361
  if jited == "on":
362
- bfn.compile()
362
+ bfn.compile(dynamic=True)
363
363
  else:
364
364
  for i in prompt_info["lora"]:
365
365
  if not i in lora_model_dict:
@@ -391,7 +391,7 @@ def run(
391
391
  if quantise == "on":
392
392
  bfn.quantise()
393
393
  if jited == "on":
394
- bfn.compile()
394
+ bfn.compile(dynamic=True)
395
395
  _message.append(f"Sequence length set to {lmax} from model metadata.")
396
396
  result_prep_fn_ = lambda x: [_result_prep_fn(i) for i in x]
397
397
  # ------- inference -------
@@ -4,5 +4,5 @@
4
4
  Version info.
5
5
  """
6
6
 
7
- __version__ = "2.2.1"
7
+ __version__ = "2.2.2"
8
8
  __author__ = "Nianze A. TAO"
@@ -1,181 +1,183 @@
1
- Metadata-Version: 2.4
2
- Name: chembfn_webui
3
- Version: 2.2.1
4
- Summary: WebUI for ChemBFN
5
- Home-page: https://github.com/Augus1999/ChemBFN-WebUI
6
- Author: Nianze A. Tao
7
- Author-email: tao-nianze@hiroshima-u.ac.jp
8
- License: AGPL-3.0-or-later
9
- Project-URL: Source, https://github.com/Augus1999/ChemBFN-WebUI
10
- Keywords: Chemistry,CLM,ChemBFN,WebUI
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Classifier: Programming Language :: Python :: 3.14
19
- Classifier: Topic :: Scientific/Engineering :: Chemistry
20
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
- Requires-Python: >=3.11
22
- Description-Content-Type: text/markdown
23
- License-File: LICENSE
24
- Requires-Dist: bayesianflow_for_chem>=2.4.0
25
- Requires-Dist: mol2chemfigPy3>=1.5.12
26
- Requires-Dist: gradio<7.0.0,>=6.0.0
27
- Requires-Dist: torch>=2.9.0
28
- Requires-Dist: rdkit>=2025.3.5
29
- Requires-Dist: selfies>=2.2.0
30
- Dynamic: author
31
- Dynamic: author-email
32
- Dynamic: classifier
33
- Dynamic: description
34
- Dynamic: description-content-type
35
- Dynamic: home-page
36
- Dynamic: keywords
37
- Dynamic: license
38
- Dynamic: license-file
39
- Dynamic: project-url
40
- Dynamic: requires-dist
41
- Dynamic: requires-python
42
- Dynamic: summary
43
-
44
- ## Web-based UI visualisation tool for ChemBFN method
45
-
46
- [![PyPI](https://img.shields.io/pypi/v/chembfn-webui?color=white)](https://pypi.org/project/chembfn-webui/)
47
- ![black](https://img.shields.io/badge/code%20style-black-black)
48
- [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
49
- ![CI](https://github.com/Augus1999/ChemBFN-WebUI/actions/workflows/pytest.yml/badge.svg)
50
-
51
-
52
-
53
- > Important:
54
- >
55
- > For the security concerning, it is not recommended to use this application as a public service.
56
- > When deploying on a local host as a shared application, it is better to install this application in a container or VM, to prevent this application from accessing the Internet, and to limit the premissions of read, create, and delete loacal files and directories.
57
-
58
- ### 1. Install
59
-
60
- ```bash
61
- $ pip install -U chembfn_webui
62
- ```
63
-
64
- ### 2. Place model files
65
-
66
- * Place customised vocabulary files (plain text .txt format) under [`chembfn_webui/model/vocab`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/vocab).
67
- * Place base model files (pretrained model in .pt format) under [`chembfn_webui/model/base_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/base_model).
68
- * Group standalone model files (`model.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/standalone_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/standalone_model).
69
- * Group LoRA model files (`lora.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/lora`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/lora).
70
-
71
- For example,
72
-
73
- ```
74
- ├───chembfn_webui
75
- ├───bin
76
- ├───cache
77
- ├───lib
78
- └───model
79
- ├───base_model
80
- | └───zinc15_190m.pt
81
- ├───lora
82
- │ └───csd_ees
83
- │ ├───lora.pt
84
- | ├───mlp.pt
85
- | └───config.json
86
- ├───standalone_model
87
- │ ├───guacamol
88
- │ | ├───model.pt
89
- │ | └───config.json
90
- │ └───qm9
91
- | ├───model.pt
92
- | ├───mlp.pt
93
- | └───config.json
94
- └───vocab
95
- └───moses_selfies_vocab.txt
96
- ```
97
-
98
- > Note:
99
- >
100
- > >The file `config.json` is automatically saved by CLI tool `Madmol` provided in `bayesianflow-for-chem` package. If you train models via Python API, you need to manually create that file for your models by filling in the tempate:
101
- > >```json
102
- > >{
103
- > > "padding_index": 0,
104
- > > "start_index": 1,
105
- > > "end_index": 2,
106
- > > "padding_strategy": "static",
107
- > > "padding_length": PADDING_LENGTH,
108
- > > "label": [LABEL_NAME_I, LABEL_NAME_II, ...],
109
- > > "name": JOB_NAME
110
- > >}
111
- > >```
112
- > >The configureation file for base models can be downloaded [here](https://huggingface.co/suenoomozawa/ChemBFN/resolve/main/config.json).
113
-
114
- If placed correctly, all these files can be seen in the "model explorer" tab.
115
-
116
- > You can use an external folder to host the models if it follows the same structure as [`chembfn_webui/model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model). See the next section for the method.
117
-
118
- ### 3. Launch the program
119
-
120
- I. launch the web-UI
121
- ```bash
122
- $ chembfn
123
- ```
124
-
125
- II. launch the web in a public link
126
- ```bash
127
- $ chembfn --public
128
- ```
129
-
130
- III. use an external directory to hold the model files (Linux and MacOS)
131
- ```bash
132
- $ CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} chembfn
133
- ```
134
-
135
- IV. use an external directory to hold the model files (Windows)
136
- ```powershell
137
- # if you use CMD
138
- > set CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} & chembfn
139
-
140
- # if you use PowerShell
141
- > $env:CHEMBFN_WEBUI_MODEL_DIR="{YOUR/MODEL/DIR}" & chembfn
142
- ```
143
-
144
- V. use an external directory to hold the model files (Notebook, Google Colab)
145
- ```python
146
- import os
147
- os.environ["CHEMBFN_WEBUI_MODEL_DIR"] = "{YOUR/MODEL/DIR}"
148
- !chembfn --public
149
- ```
150
-
151
- VI. create an empty folder to hold the model files
152
- ```bash
153
- $ chembfn --create_model_dir {YOUR/MODEL/DIR}
154
- ```
155
- A structured folder `YOUR/MODEL/DIR/model` will be created.
156
-
157
- ### 4. Write the prompt
158
-
159
- * Leave prompt blank for unconditional generation.
160
- * For standalone models, key in objective values in the format of `[a,b,c,...]` to pass the values to the model.
161
- * Key in `<name:A>` or `<name:A>:[a,b,c,...]` to select LoRA parameter and pass the objective values if necessary, where `name` is the LoRA model name and `A` is the LoRA scaling. You can easily select a LoRA model by clicking the model name in "LoRA models" tab as well.
162
- * You can stack several LoRA models together to form an ensemble model by prompt like `<name1:A1>:[a1,b1,c1,...];<name2:A2>:[a2,b2,...];...`. Note that here `A1`, `A2`, _etc_ are contributions of each model to the ensemble.
163
-
164
- ### 5. Advanced control
165
-
166
- Under "advanced control" tab
167
-
168
- * You can control semi-autoregressive behaviours by key in `F` for switching off SAR, `T` for switching on SAR, and prompt like `F,F,T,...` to individually control the SAR in an ensemble model.
169
- * You can add unwanted tokens, e.g., `[Cu],p,[Si]`.
170
- * You can customise the result preprocessing function, e.g., the model output a reaction SMILES "CCI.C[O-]>>COCC" which couldn't be recognised by RDKit; you can pass `lambda x: x.split(">>")[-1]` to force the program only looking at the products.
171
-
172
- ### 6. Generate molecules
173
-
174
- Click "RUN" then here you go! If error occured, please check your prompts and settings.
175
-
176
- ## Where to obtain the models?
177
-
178
- * Pretrained models: [https://huggingface.co/suenoomozawa/ChemBFN](https://huggingface.co/suenoomozawa/ChemBFN)
179
- * ChemBFN source code: [https://github.com/Augus1999/bayesian-flow-network-for-chemistry](https://github.com/Augus1999/bayesian-flow-network-for-chemistry)
180
- * ChemBFN document: [https://augus1999.github.io/bayesian-flow-network-for-chemistry/](https://augus1999.github.io/bayesian-flow-network-for-chemistry/)
181
- * ChemBFN package: [https://pypi.org/project/bayesianflow-for-chem/](https://pypi.org/project/bayesianflow-for-chem/)
1
+ Metadata-Version: 2.4
2
+ Name: chembfn_webui
3
+ Version: 2.2.2
4
+ Summary: WebUI for ChemBFN
5
+ Home-page: https://github.com/Augus1999/ChemBFN-WebUI
6
+ Author: Nianze A. Tao
7
+ Author-email: tao-nianze@hiroshima-u.ac.jp
8
+ License: AGPL-3.0-or-later
9
+ Project-URL: Source, https://github.com/Augus1999/ChemBFN-WebUI
10
+ Keywords: Chemistry,CLM,ChemBFN,WebUI
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
20
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: bayesianflow_for_chem>=2.4.0
26
+ Requires-Dist: mol2chemfigPy3>=1.5.12
27
+ Requires-Dist: gradio<7.0.0,>=6.0.0
28
+ Requires-Dist: torch>=2.9.0
29
+ Requires-Dist: rdkit!=2026.9.2,>=2025.3.5; platform_system == "Darwin"
30
+ Requires-Dist: rdkit>=2025.3.5
31
+ Requires-Dist: selfies>=2.2.0
32
+ Dynamic: author
33
+ Dynamic: author-email
34
+ Dynamic: classifier
35
+ Dynamic: description
36
+ Dynamic: description-content-type
37
+ Dynamic: home-page
38
+ Dynamic: keywords
39
+ Dynamic: license
40
+ Dynamic: license-file
41
+ Dynamic: project-url
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ ## Web-based UI visualisation tool for ChemBFN method
47
+
48
+ [![PyPI](https://img.shields.io/pypi/v/chembfn-webui?color=white)](https://pypi.org/project/chembfn-webui/)
49
+ ![black](https://img.shields.io/badge/code%20style-black-black)
50
+ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
51
+ ![CI](https://github.com/Augus1999/ChemBFN-WebUI/actions/workflows/pytest.yml/badge.svg)
52
+
53
+
54
+
55
+ > Important:
56
+ >
57
+ > For the security concerning, it is not recommended to use this application as a public service.
58
+ > When deploying on a local host as a shared application, it is better to install this application in a container or VM, to prevent this application from accessing the Internet, and to limit the premissions of read, create, and delete loacal files and directories.
59
+
60
+ ### 1. Install
61
+
62
+ ```bash
63
+ $ pip install -U chembfn_webui
64
+ ```
65
+
66
+ ### 2. Place model files
67
+
68
+ * Place customised vocabulary files (plain text .txt format) under [`chembfn_webui/model/vocab`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/vocab).
69
+ * Place base model files (pretrained model in .pt format) under [`chembfn_webui/model/base_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/base_model).
70
+ * Group standalone model files (`model.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/standalone_model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/standalone_model).
71
+ * Group LoRA model files (`lora.pt`, optional `mlp.pt`) and configuration file (`config.json`) in one folder for each model and place these folders under [`chembfn_webui/model/lora`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model/lora).
72
+
73
+ For example,
74
+
75
+ ```
76
+ ├───chembfn_webui
77
+ ├───bin
78
+ ├───cache
79
+ ├───lib
80
+ └───model
81
+ ├───base_model
82
+ | └───zinc15_190m.pt
83
+ ├───lora
84
+ │ └───csd_ees
85
+ │ ├───lora.pt
86
+ | ├───mlp.pt
87
+ | └───config.json
88
+ ├───standalone_model
89
+ │ ├───guacamol
90
+ │ | ├───model.pt
91
+ │ | └───config.json
92
+ │ └───qm9
93
+ | ├───model.pt
94
+ | ├───mlp.pt
95
+ | └───config.json
96
+ └───vocab
97
+ └───moses_selfies_vocab.txt
98
+ ```
99
+
100
+ > Note:
101
+ >
102
+ > >The file `config.json` is automatically saved by CLI tool `Madmol` provided in `bayesianflow-for-chem` package. If you train models via Python API, you need to manually create that file for your models by filling in the tempate:
103
+ > >```json
104
+ > >{
105
+ > > "padding_index": 0,
106
+ > > "start_index": 1,
107
+ > > "end_index": 2,
108
+ > > "padding_strategy": "static",
109
+ > > "padding_length": PADDING_LENGTH,
110
+ > > "label": [LABEL_NAME_I, LABEL_NAME_II, ...],
111
+ > > "name": JOB_NAME
112
+ > >}
113
+ > >```
114
+ > >The configureation file for base models can be downloaded [here](https://huggingface.co/suenoomozawa/ChemBFN/resolve/main/config.json).
115
+
116
+ If placed correctly, all these files can be seen in the "model explorer" tab.
117
+
118
+ > You can use an external folder to host the models if it follows the same structure as [`chembfn_webui/model`](https://github.com/Augus1999/ChemBFN-WebUI/tree/main/chembfn_webui/model). See the next section for the method.
119
+
120
+ ### 3. Launch the program
121
+
122
+ I. launch the web-UI
123
+ ```bash
124
+ $ chembfn
125
+ ```
126
+
127
+ II. launch the web in a public link
128
+ ```bash
129
+ $ chembfn --public
130
+ ```
131
+
132
+ III. use an external directory to hold the model files (Linux and MacOS)
133
+ ```bash
134
+ $ CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} chembfn
135
+ ```
136
+
137
+ IV. use an external directory to hold the model files (Windows)
138
+ ```powershell
139
+ # if you use CMD
140
+ > set CHEMBFN_WEBUI_MODEL_DIR={YOUR/MODEL/DIR} & chembfn
141
+
142
+ # if you use PowerShell
143
+ > $env:CHEMBFN_WEBUI_MODEL_DIR="{YOUR/MODEL/DIR}" & chembfn
144
+ ```
145
+
146
+ V. use an external directory to hold the model files (Notebook, Google Colab)
147
+ ```python
148
+ import os
149
+ os.environ["CHEMBFN_WEBUI_MODEL_DIR"] = "{YOUR/MODEL/DIR}"
150
+ !chembfn --public
151
+ ```
152
+
153
+ VI. create an empty folder to hold the model files
154
+ ```bash
155
+ $ chembfn --create_model_dir {YOUR/MODEL/DIR}
156
+ ```
157
+ A structured folder `YOUR/MODEL/DIR/model` will be created.
158
+
159
+ ### 4. Write the prompt
160
+
161
+ * Leave prompt blank for unconditional generation.
162
+ * For standalone models, key in objective values in the format of `[a,b,c,...]` to pass the values to the model.
163
+ * Key in `<name:A>` or `<name:A>:[a,b,c,...]` to select LoRA parameter and pass the objective values if necessary, where `name` is the LoRA model name and `A` is the LoRA scaling. You can easily select a LoRA model by clicking the model name in "LoRA models" tab as well.
164
+ * You can stack several LoRA models together to form an ensemble model by prompt like `<name1:A1>:[a1,b1,c1,...];<name2:A2>:[a2,b2,...];...`. Note that here `A1`, `A2`, _etc_ are contributions of each model to the ensemble.
165
+
166
+ ### 5. Advanced control
167
+
168
+ Under "advanced control" tab
169
+
170
+ * You can control semi-autoregressive behaviours by key in `F` for switching off SAR, `T` for switching on SAR, and prompt like `F,F,T,...` to individually control the SAR in an ensemble model.
171
+ * You can add unwanted tokens, e.g., `[Cu],p,[Si]`.
172
+ * You can customise the result preprocessing function, e.g., the model output a reaction SMILES "CCI.C[O-]>>COCC" which couldn't be recognised by RDKit; you can pass `lambda x: x.split(">>")[-1]` to force the program only looking at the products.
173
+
174
+ ### 6. Generate molecules
175
+
176
+ Click "RUN" then here you go! If error occured, please check your prompts and settings.
177
+
178
+ ## Where to obtain the models?
179
+
180
+ * Pretrained models: [https://huggingface.co/suenoomozawa/ChemBFN](https://huggingface.co/suenoomozawa/ChemBFN)
181
+ * ChemBFN source code: [https://github.com/Augus1999/bayesian-flow-network-for-chemistry](https://github.com/Augus1999/bayesian-flow-network-for-chemistry)
182
+ * ChemBFN document: [https://augus1999.github.io/bayesian-flow-network-for-chemistry/](https://augus1999.github.io/bayesian-flow-network-for-chemistry/)
183
+ * ChemBFN package: [https://pypi.org/project/bayesianflow-for-chem/](https://pypi.org/project/bayesianflow-for-chem/)
@@ -4,3 +4,6 @@ gradio<7.0.0,>=6.0.0
4
4
  torch>=2.9.0
5
5
  rdkit>=2025.3.5
6
6
  selfies>=2.2.0
7
+
8
+ [:platform_system == "Darwin"]
9
+ rdkit!=2026.9.2,>=2025.3.5
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -88,6 +88,7 @@ setup(
88
88
  "mol2chemfigPy3>=1.5.12",
89
89
  "gradio>=6.0.0,<7.0.0",
90
90
  "torch>=2.9.0",
91
+ "rdkit>=2025.3.5,!=2026.9.2;platform_system=='Darwin'",
91
92
  "rdkit>=2025.3.5",
92
93
  "selfies>=2.2.0",
93
94
  ],
@@ -101,6 +102,7 @@ setup(
101
102
  "Programming Language :: Python :: 3.12",
102
103
  "Programming Language :: Python :: 3.13",
103
104
  "Programming Language :: Python :: 3.14",
105
+ "Programming Language :: Python :: 3.15",
104
106
  "Topic :: Scientific/Engineering :: Chemistry",
105
107
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
106
108
  ],
File without changes
File without changes