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.
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/PKG-INFO +183 -181
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/bin/app.py +5 -5
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/version.py +1 -1
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/PKG-INFO +183 -181
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/requires.txt +3 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/setup.cfg +4 -4
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/setup.py +2 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/LICENSE +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/README.md +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/__init__.py +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/bin/favicon.png +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/cache/cache_file_here.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/cache/results.csv +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/structs.py +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/lib/utilities.py +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/base_model/place_base_model_here.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/lora/place_lora_folder_here.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/standalone_model/place_standalone_model_folder_here.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/vocab/place_vocabulary_file_here.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/SOURCES.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/dependency_links.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/entry_points.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui.egg-info/top_level.txt +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/test/test_mk_model_dir.py +0 -0
- {chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/test/test_prompt_parsing.py +0 -0
- {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.
|
|
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:
|
|
20
|
-
Classifier: Topic :: Scientific/Engineering ::
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Dynamic:
|
|
33
|
-
Dynamic:
|
|
34
|
-
Dynamic:
|
|
35
|
-
Dynamic:
|
|
36
|
-
Dynamic:
|
|
37
|
-
Dynamic:
|
|
38
|
-
Dynamic:
|
|
39
|
-
Dynamic:
|
|
40
|
-
Dynamic:
|
|
41
|
-
Dynamic:
|
|
42
|
-
Dynamic:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[](https://pypi.org/project/chembfn-webui/)
|
|
49
|
+

|
|
50
|
+
[](https://stand-with-ukraine.pp.ua)
|
|
51
|
+

|
|
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
|
|
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: <{lm}>")
|
|
@@ -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
|
|
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 -------
|
|
@@ -1,181 +1,183 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: chembfn_webui
|
|
3
|
-
Version: 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:
|
|
20
|
-
Classifier: Topic :: Scientific/Engineering ::
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Dynamic:
|
|
33
|
-
Dynamic:
|
|
34
|
-
Dynamic:
|
|
35
|
-
Dynamic:
|
|
36
|
-
Dynamic:
|
|
37
|
-
Dynamic:
|
|
38
|
-
Dynamic:
|
|
39
|
-
Dynamic:
|
|
40
|
-
Dynamic:
|
|
41
|
-
Dynamic:
|
|
42
|
-
Dynamic:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[](https://pypi.org/project/chembfn-webui/)
|
|
49
|
+

|
|
50
|
+
[](https://stand-with-ukraine.pp.ua)
|
|
51
|
+

|
|
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/)
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/base_model/place_base_model_here.txt
RENAMED
|
File without changes
|
{chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/lora/place_lora_folder_here.txt
RENAMED
|
File without changes
|
|
File without changes
|
{chembfn_webui-2.2.1 → chembfn_webui-2.2.2}/chembfn_webui/model/vocab/place_vocabulary_file_here.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|