ChemAligner-T5
Collection
ChemAligner T5 is a text-based molecular text alignment model based on contrastive targeting. • 5 items • Updated
How to use Neeze/ChemAligner-T5-Pro with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Neeze/ChemAligner-T5-Pro") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("Neeze/ChemAligner-T5-Pro")
model = AutoModelForSeq2SeqLM.from_pretrained("Neeze/ChemAligner-T5-Pro")How to use Neeze/ChemAligner-T5-Pro with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Neeze/ChemAligner-T5-Pro"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Neeze/ChemAligner-T5-Pro",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Neeze/ChemAligner-T5-Pro
How to use Neeze/ChemAligner-T5-Pro with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Neeze/ChemAligner-T5-Pro" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Neeze/ChemAligner-T5-Pro",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "Neeze/ChemAligner-T5-Pro" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Neeze/ChemAligner-T5-Pro",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Neeze/ChemAligner-T5-Pro with Docker Model Runner:
docker model run hf.co/Neeze/ChemAligner-T5-Pro
Below is an example of how to load and generate outputs with this model:
import torch
import transformers
from huggingface_hub import login
from transformers import AutoTokenizer
from transformers.models.t5 import T5ForConditionalGeneration
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained("Neeze/ChemAligner-T5-Pro")
model = T5ForConditionalGeneration.from_pretrained("Neeze/ChemAligner-T5-Pro").to(device)
sample_caption = (
"The molecule is a energy storage and a fat storage, which impacts cardiovascular "
"disease, cancer, and metabolic syndrome, and is characterized as thyroxine treatment. "
"The molecule is a membrane stabilizer and inflammatory, and it impacts pancreatitis. "
"The molecule is a energy source and a nutrient, impacting both obesity and atherosclerosis."
)
task_input = (
f"Task: Translate description to SELFIES representation.\n"
f"Input: {sample_caption}\n"
f"Output:"
)
inputs = tokenizer(
task_input,
return_tensors="pt",
truncation=True,
max_length=512,
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=512,
num_beams=4,
do_sample=False,
early_stopping= True,
temperature=1.0,
no_repeat_ngram_size=0,
length_penalty=1.0,
decoder_start_token_id=0,
eos_token_id=1,
pad_token_id=0
)
outputs = [
s.replace("<unk>", "").replace("<pad>", "").replace("</s>", "").strip()
for s in tokenizer.batch_decode(outputs)
]
print(*outputs)
@inproceedings{Phan2026ChemAlignerT5,
title = {ChemAligner-T5: A Unified Text-to-Molecule Model via Representation Alignment},
author = {Nam, Van Hai Phan and
Khoa, Minh Nguyen and
Phu, Nguyen Ngoc Thien and
Nguyen, Doan Hieu Nguyen and
Tri, Minh Pham and
Duc, Dang Ngoc Minh},
booktitle = {Proceedings of the 2nd International Conference on Computational Intelligence in Engineering Science},
year = {2026},
month = apr,
address = {Nha Trang, Khanh Hoa, Vietnam}
}
Base model
QizhiPei/biot5-plus-base