ZJU-Fangyin
commited on
Commit
•
2a45f64
1
Parent(s):
de6bcbd
Update README.md
Browse files
README.md
CHANGED
@@ -19,10 +19,10 @@ You can use the raw model for molecular generation or fine-tune it to a downstre
|
|
19 |
### How to use
|
20 |
Molecule generation example:
|
21 |
```python
|
22 |
-
>>> from transformers import AutoTokenizer,
|
23 |
|
24 |
>>> tokenizer = AutoTokenizer.from_pretrained("zjunlp/MolGen")
|
25 |
-
>>> model =
|
26 |
|
27 |
>>> sf_input = tokenizer("[C][=C][C][=C][C][=C][Ring1][=Branch1]", return_tensors="pt")
|
28 |
>>> # beam search
|
@@ -34,7 +34,8 @@ Molecule generation example:
|
|
34 |
num_beams=5,
|
35 |
past_prompt=None)
|
36 |
>>> sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
|
37 |
-
['[C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C@H1][C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C][=C][C][=C][C][=C][Ring1][=Branch1]
|
|
|
38 |
```
|
39 |
|
40 |
|
|
|
19 |
### How to use
|
20 |
Molecule generation example:
|
21 |
```python
|
22 |
+
>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
23 |
|
24 |
>>> tokenizer = AutoTokenizer.from_pretrained("zjunlp/MolGen")
|
25 |
+
>>> model = AutoModelForSeq2SeqLMq.from_pretrained("zjunlp/MolGen")
|
26 |
|
27 |
>>> sf_input = tokenizer("[C][=C][C][=C][C][=C][Ring1][=Branch1]", return_tensors="pt")
|
28 |
>>> # beam search
|
|
|
34 |
num_beams=5,
|
35 |
past_prompt=None)
|
36 |
>>> sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
|
37 |
+
['[C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C@H1][C][=C][C][=C][C][=C][Ring1][=Branch1]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C][=C][C][=C][C][=C][Ring1][=Branch1]
|
38 |
+
', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C@H1][=C][C][=C][Ring1][=Branch1]']
|
39 |
```
|
40 |
|
41 |
|