Image-Text-to-Text
Transformers
Safetensors
qwen2_5_vl
chemistry
molecular-structure
reaction-diagram
robustrdp
conversational
text-generation-inference
Instructions to use Jingcz/RobustRDP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jingcz/RobustRDP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Jingcz/RobustRDP") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Jingcz/RobustRDP") model = AutoModelForMultimodalLM.from_pretrained("Jingcz/RobustRDP") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jingcz/RobustRDP with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jingcz/RobustRDP" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jingcz/RobustRDP", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Jingcz/RobustRDP
- SGLang
How to use Jingcz/RobustRDP 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 "Jingcz/RobustRDP" \ --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": "Jingcz/RobustRDP", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "Jingcz/RobustRDP" \ --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": "Jingcz/RobustRDP", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Jingcz/RobustRDP with Docker Model Runner:
docker model run hf.co/Jingcz/RobustRDP
metadata
license: other
library_name: transformers
tags:
- chemistry
- molecular-structure
- reaction-diagram
- robustrdp
base_model: Qwen/Qwen2.5-VL-3B-Instruct
pipeline_tag: image-text-to-text
RobustRDP
Fine-tuned model for the paper: RobustRDP: Advancing Reaction Diagram Parsing via Synthetic-to-Real Data Scaling and Robustness-Oriented Training.
Description
This model is a fine-tuned checkpoint based on Qwen2.5-VL-3B-Instruct, trained with a three-stage pipeline:
- Pretrain stage: Synthetic data pretraining on large-scale synthetic reaction diagrams.
- SFT stage: Supervised fine-tuning with three specialized tasks:
- Vanilla Reaction Parsing (VRP): Standard reaction diagram parsing
- Region-Guided Reaction Parsing (RGRP): Region-aware parsing with spatial guidance
- Prefix-Perturbed Reaction Parsing (PPRP): Robustness-oriented parsing with prefix perturbations
- DPO stage: Direct Preference Optimization to further align model outputs with ground-truth annotations.
Training Details
| Config | Pretrain | SFT | DPO |
|---|---|---|---|
| Base Model | Qwen2.5-VL-3B-Instruct | Qwen2.5-VL-3B-Instruct | Qwen2.5-VL-3B-Instruct |
| Learning Rate | 1.0×10⁻⁶ | 1.0×10⁻⁵ | 3.0×10⁻⁷ |
| Batch Size | 16 | 4 | 64 |
| Epochs | 1 | 1 | 1 |
| Scheduler | Cosine (warmup 0.03) | Cosine (warmup 0.03) | Cosine (warmup 0.03) |
| Optimizer | AdamW | AdamW | AdamW |
| Trainable Params | LLM only | Full (vision + LLM) | LLM only |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Jingcz/RobustRDP"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
Related Resources
- Dataset: RxnLabelData
- Annotation Platform: RxnLabel