Views
No views yet
SmilesTokenizer and was trained on a combined dataset of ZINC15 and MuMOInstruct. It is designed for unconditional molecule generation.| Metric | Score |
|---|---|
| Parameters | 57.2 M |
| Validity | 100.0% |
| Average QED | 0.6400 |
| Diversity | 0.8363 |
transformers library. The model generates SMILES strings by prompting it with the [bos] (Beginning of Sequence) token.1pip install transformers torch deepchem
21import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# 1. Load Model and Tokenizer
5model_id = "jonghyunlee/MoLLaMA"
6
7tokenizer = AutoTokenizer.from_pretrained(model_id)
8model = AutoModelForCausalLM.from_pretrained(
9 model_id,
10 torch_dtype=torch.float16,
11 device_map="auto"
12)
13
14# 2. Prepare Prompt for Unconditional Generation
15prompt = "[bos]"
16inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
17
18# 3. Generate SMILES
19model.eval()
20with torch.no_grad():
21 outputs = model.generate(
22 input_ids=inputs.input_ids,
23 attention_mask=inputs.attention_mask,
24 max_new_tokens=256,
25 do_sample=True,
26 temperature=0.7,
27 top_p=0.9,
28 )
29
30# 4. Decode the output
31generated_smiles = tokenizer.decode(outputs[0], skip_special_tokens=True).replace(" ", "")
32print(f"Generated SMILES: {generated_smiles}")
33ZINC15 + MuMOInstruct (Parquet format)