Instructions to use oleh13/retro-agent-qwen25-7b-merged-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oleh13/retro-agent-qwen25-7b-merged-fp16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oleh13/retro-agent-qwen25-7b-merged-fp16") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("oleh13/retro-agent-qwen25-7b-merged-fp16") model = AutoModelForCausalLM.from_pretrained("oleh13/retro-agent-qwen25-7b-merged-fp16", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oleh13/retro-agent-qwen25-7b-merged-fp16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oleh13/retro-agent-qwen25-7b-merged-fp16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oleh13/retro-agent-qwen25-7b-merged-fp16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/oleh13/retro-agent-qwen25-7b-merged-fp16
- SGLang
How to use oleh13/retro-agent-qwen25-7b-merged-fp16 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "oleh13/retro-agent-qwen25-7b-merged-fp16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oleh13/retro-agent-qwen25-7b-merged-fp16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "oleh13/retro-agent-qwen25-7b-merged-fp16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oleh13/retro-agent-qwen25-7b-merged-fp16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use oleh13/retro-agent-qwen25-7b-merged-fp16 with Docker Model Runner:
docker model run hf.co/oleh13/retro-agent-qwen25-7b-merged-fp16
retro-agent-qwen25-7b-merged-fp16
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:
- retro-reactants-qwen25-7b
- retro-conditions-qwen25-7b
Because the LoRA weights are merged, deployment does not need PEFT adapter loading. Load and serve this repository as a normal causal language model.
Intended Use
This model is intended for structured retrosynthesis assistance:
- predict likely reactants for a target product SMILES
- predict plausible reaction conditions
- return machine-readable JSON for downstream validation and rendering
Use RDKit or another chemistry toolkit to validate generated SMILES before acting on model output.
Prompt Templates
Use explicit task labels and request JSON only. Low temperature is recommended for repeatable API calls.
Reactant Prediction
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.
Condition Prediction
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.
Combined Planning Prompt
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.
Python Example
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))
REST API Examples
Hugging Face Router / OpenAI-compatible Chat Completions
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
}'
Dedicated Hugging Face Inference Endpoint
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
}
}'
Notes
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.
- Downloads last month
- 11