Views
No views yet
molcrawl-molecule-nat-lang-gpt2-small pre-trained model.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained("kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small")
5tokenizer = AutoTokenizer.from_pretrained("kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small")
6
7# Generate molecule-related text
8prompt = "The compound with SMILES CC(=O)Oc1ccccc1C(=O)O represents aspirin, which"
9inputs = tokenizer(prompt, return_tensors="pt")
10with torch.no_grad():
11 output_ids = model.generate(
12 **inputs,
13 max_new_tokens=100,
14 do_sample=True,
15 temperature=0.8,
16 eos_token_id=None, # HF config.json has legacy eos_token_id=0; disable early stop
17 pad_token_id=0,
18 )
19print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
201@misc{molcrawl_molecule_nat_lang_mol_instructions_gpt2_small,
2 title={molcrawl-molecule-nat-lang-mol-instructions-gpt2-small},
3 author={{RIKEN}},
4 year={2026},
5 publisher={{Hugging Face}},
6 url={{https://huggingface.co/kojima-lab/molcrawl-molecule-nat-lang-mol-instructions-gpt2-small}}
7}