Update README.md
Browse files
README.md
CHANGED
@@ -6,6 +6,37 @@ license: apache-2.0
|
|
6 |
|
7 |
#### Notice: The input should contain 4 context examples and the cutoff length should be set to 2048 to ensure best performance.
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
Paper Link: https://arxiv.org/abs/2403.04197
|
|
|
6 |
|
7 |
#### Notice: The input should contain 4 context examples and the cutoff length should be set to 2048 to ensure best performance.
|
8 |
|
9 |
+
A simple inference example
|
10 |
+
```
|
11 |
+
from transformers import AutoModelForCausalLM
|
12 |
+
|
13 |
+
model = AutoModelForCausalLM.from_pretrained("phenixace/ICMA-Galactica-125M-M2C")
|
14 |
+
|
15 |
+
from transformers import AutoTokenizer
|
16 |
+
tk = AutoTokenizer.from_pretrained("phenixace/ICMA-Galactica-125M-M2C")
|
17 |
+
|
18 |
+
text ="""Generate a molecule for the caption: The molecule is a fluorinated steroid that is pregn-4-ene substituted by a fluoro group at position 2, a methyl group at position 2 and oxo groups at positions 3, 11 and 20. It is a 3-oxo-Delta(4) steroid, an 11-oxo steroid, a 20-oxo steroid and a fluorinated steroid. It derives from a progesterone. It derives from a hydride of a pregnane.
|
19 |
+
Molecule: C[C@@H]1C[C@]2(C(=CC1=O)CC[C@@H]3[C@@]2(C(=O)C[C@]4([C@H]3CC[C@@H]4C(=O)C)C)F)C
|
20 |
+
|
21 |
+
Generate a molecule for the caption: The molecule is a steroid ester that is pregn-4-en-21-yl acetate substituted by oxo group at positions 3 and 20, a methyl group at position 6 and hydroxy groups at positions 11 and 17 respectively. It is a 3-oxo-Delta(4) steroid, a steroid ester, an 11beta-hydroxy steroid, a 17alpha-hydroxy steroid, a 20-oxo steroid and a tertiary alpha-hydroxy ketone. It derives from a hydride of a pregnane.
|
22 |
+
Molecule: C[C@H]1C[C@H]2[C@@H]3CC[C@@]([C@]3(C[C@@H]([C@@H]2[C@@]4(C1=CC(=O)CC4)C)O)C)(C(=O)COC(=O)C)O
|
23 |
+
|
24 |
+
Based on the above examples, analyse the similarities and differences between the examples and finally generate a molecule for the caption: The molecule is a steroid ester that is methyl (17E)-pregna-4,17-dien-21-oate substituted by oxo groups at positions 3 and 11. It is a 3-oxo-Delta(4) steroid, an 11-oxo steroid, a steroid ester and a methyl ester. It derives from a hydride of a pregnane."""
|
25 |
+
generation_config = GenerationConfig(
|
26 |
+
do_sample=True,
|
27 |
+
temperature=0.7,
|
28 |
+
top_p=0.85,
|
29 |
+
top_k=40,
|
30 |
+
num_beams=1,
|
31 |
+
repetition_penalty=1.0,
|
32 |
+
pad_token_id=0,
|
33 |
+
)
|
34 |
+
inputs = tk(text, return_tensors="pt", return_token_type_ids=False)
|
35 |
+
outputs = model.generate(**inputs, return_dict_in_generate=True, output_scores=True, num_return_sequences=1, max_new_tokens=256, generation_config=generation_config)
|
36 |
+
|
37 |
+
# decode
|
38 |
+
decoded = tk.decode(outputs.sequences[0], skip_special_tokens=True)
|
39 |
+
print(decoded)
|
40 |
+
```
|
41 |
|
42 |
Paper Link: https://arxiv.org/abs/2403.04197
|