Views
No views yet
attention_mask when pooling or selecting valid positions.1pip install -r requirements.txt
2git clone https://huggingface.co/Kiria-Nozan/ApexOracle
3cd ApexOracle
4python example.py1import torch
2from transformers import AutoTokenizer
3
4from DLM_emb_model import MolEmbDLM
5
6model_dir = "Kiria-Nozan/ApexOracle"
7device = torch.device("cuda")
8tokenizer = AutoTokenizer.from_pretrained(model_dir)
9model = MolEmbDLM.from_pretrained(model_dir).eval().to(device)
10
11batch = tokenizer(
12 ["[C] [C] [O]", "[C] [=C] [C] [=C] [C] [=C] [Ring1] [=Branch1]"],
13 padding=True,
14 truncation=False,
15 return_tensors="pt",
16).to(device)
17
18with torch.no_grad():
19 hidden_states = model(**batch)
20
21print(hidden_states.shape) # [batch, padded_sequence_length, 768]attention_mask may be the ordinary integer mask returned by Transformers;
the wrapper validates and converts it to the boolean mask required by the
non-padding FlashAttention backbone. A complete tokenizer batch, including
token_type_ids, can be passed directly with model(**batch).b472f7508aaf0fdab4c935caf221415b48a5f8afd4d104a731c9d72d410c2c44ibm-research/materials.selfies-ted, audited revision
55e83392264cb998f7aa5014847df29868aefeb8THIRD_PARTY_NOTICES.md and LICENSES/Apache-2.0.txt.1@article{leng2025predicting,
2 title={Predicting and generating antibiotics against future pathogens with ApexOracle},
3 author={Leng, Tianang and Wan, Fangping and Torres, Marcelo Der Torossian and de la Fuente-Nunez, Cesar},
4 journal={arXiv preprint arXiv:2507.07862},
5 year={2025}
6}