Commit
•
f090ac0
1
Parent(s):
e82f7e2
Update README.md
Browse files
README.md
CHANGED
@@ -25,10 +25,8 @@ Molecule generation example:
|
|
25 |
>>> model = BartForConditionalGeneration.from_pretrained("zjunlp/MolGen", use_auth_token=True)
|
26 |
|
27 |
>>> sf_input = tokenizer("[C][=C][C][=C][C][=C][Ring1][=Branch1]", return_tensors="pt")
|
28 |
-
|
29 |
>>> # beam search
|
30 |
>>> molecules = model.generate(input_ids=sf_input["input_ids"],attention_mask=sf_input["attention_mask"],max_length=20,min_length=5,num_return_sequences=5,num_beams=5,past_prompt=None)
|
31 |
-
|
32 |
>>> sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
|
33 |
['[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]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C@H1][=C][C][=C][Ring1][=Branch1]']
|
34 |
```
|
|
|
25 |
>>> model = BartForConditionalGeneration.from_pretrained("zjunlp/MolGen", use_auth_token=True)
|
26 |
|
27 |
>>> sf_input = tokenizer("[C][=C][C][=C][C][=C][Ring1][=Branch1]", return_tensors="pt")
|
|
|
28 |
>>> # beam search
|
29 |
>>> molecules = model.generate(input_ids=sf_input["input_ids"],attention_mask=sf_input["attention_mask"],max_length=20,min_length=5,num_return_sequences=5,num_beams=5,past_prompt=None)
|
|
|
30 |
>>> sf_output = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True).replace(" ","") for g in molecules]
|
31 |
['[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]', '[C][=C][C][=C][C][=C][Ring1][=Branch1][C@H1][=C][C][=C][Ring1][=Branch1]']
|
32 |
```
|