Downloads · 30 days
8
7% of all-time downloads
oleh13/retro-agent-qwen25-7b-merged-fp16
retro-agent-qwen25-7b-merged-fp16 is a text generation model from oleh13. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Standalone fp16 retrosynthesis assistant model for serving. The model is based on Qwen/Qwen2.5-7B-Instruct with these LoRA adapters merged into the base weights:
Downloads · 30 days
8
7% of all-time downloads
All-time downloads
113
Public
Parameters
7.6B
15.2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.2 GB · 100%
From the Hugging Face model README
Standalone fp16 retrosynthesis assistant model for serving. The model is based on Qwen/Qwen2.5-7B-Instruct with these LoRA adapters merged into the base weights:
Because the LoRA weights are merged, deployment does not need PEFT adapter loading. Load and serve this repository as a normal causal language model.
This model is intended for structured retrosynthesis assistance:
Use RDKit or another chemistry toolkit to validate generated SMILES before acting on model output.
Use explicit task labels and request JSON only. Low temperature is recommended for repeatable API calls.
System: You are a retrosynthesis assistant. Return valid JSON only.
User: Task: predict_reactants
Product SMILES: CC(=O)Oc1ccccc1C(=O)O
Return JSON with keys: reactants_smiles, confidence, rationale.
System: You are a reaction condition assistant. Return valid JSON only.
User: Task: predict_conditions
Product SMILES: CC(=O)Oc1ccccc1C(=O)O
Reactants SMILES: CC(=O)O.Oc1ccccc1C(=O)O
Return JSON with keys: solvent, reagents, catalyst, temperature_celsius, time, confidence, rationale.
System: You are a retrosynthesis assistant. Return valid JSON only.
User: Task: retrosynthesis_step
Target product SMILES: CC(=O)Oc1ccccc1C(=O)O
Return one JSON object with keys: reactants_smiles, conditions, confidence, rationale.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "<your-namespace>/retro-agent-qwen25-7b-merged-fp16"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True,
)
messages = [
{"role": "system", "content": "You are a retrosynthesis assistant. Return valid JSON only."},
{"role": "user", "content": "Task: retrosynthesis_step\nTarget product SMILES: CC(=O)Oc1ccccc1C(=O)O\nReturn one JSON object with keys: reactants_smiles, conditions, confidence, rationale."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.1,
do_sample=False,
)
new_tokens = output_ids[0][inputs.input_ids.shape[-1]:]
print(tokenizer.decode(new_tokens, skip_special_tokens=True))
This works only if the model is available through Hugging Face Inference Providers. For custom merged models, a dedicated endpoint is often more reliable.
export HF_TOKEN=hf_...
curl https://router.huggingface.co/v1/chat/completions \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "<your-namespace>/retro-agent-qwen25-7b-merged-fp16",
"messages": [
{"role": "system", "content": "You are a retrosynthesis assistant. Return valid JSON only."},
{"role": "user", "content": "Task: retrosynthesis_step\nTarget product SMILES: CC(=O)Oc1ccccc1C(=O)O"}
],
"temperature": 0.1,
"max_tokens": 512,
"stream": false
}'
Create a dedicated endpoint from this model repository, then call the endpoint URL directly.
export HF_TOKEN=hf_...
export ENDPOINT_URL=https://<your-endpoint>.<region>.<provider>.endpoints.huggingface.cloud
curl "$ENDPOINT_URL" \
-X POST \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"inputs": "Task: retrosynthesis_step\nTarget product SMILES: CC(=O)Oc1ccccc1C(=O)O\nReturn one JSON object with keys: reactants_smiles, conditions, confidence, rationale.",
"parameters": {
"max_new_tokens": 512,
"temperature": 0.1,
"return_full_text": false
}
}'
This model merges adapters trained for related but distinct tasks. Evaluate both reactant prediction and condition prediction after merge, because independently trained LoRA adapters can interfere with each other.