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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Jingcz/RobustRDP") model = AutoModelForMultimodalLM.from_pretrained("Jingcz/RobustRDP", device_map="auto") 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=256) 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
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- chemistry
|
| 6 |
+
- molecular-structure
|
| 7 |
+
- reaction-diagram
|
| 8 |
+
- robustrdp
|
| 9 |
+
base_model: Qwen/Qwen2.5-VL-3B-Instruct
|
| 10 |
+
pipeline_tag: image-text-to-text
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# RobustRDP
|
| 14 |
+
|
| 15 |
+
Fine-tuned model for the paper: *RobustRDP: Advancing Reaction Diagram Parsing via Synthetic-to-Real Data Scaling and Robustness-Oriented Training*.
|
| 16 |
+
|
| 17 |
+
## Description
|
| 18 |
+
|
| 19 |
+
This model is a fine-tuned checkpoint based on **Qwen2.5-VL-3B-Instruct**, trained with a three-stage pipeline:
|
| 20 |
+
|
| 21 |
+
1. **Pretrain stage**: Synthetic data pretraining on large-scale synthetic reaction diagrams.
|
| 22 |
+
2. **SFT stage**: Supervised fine-tuning with three specialized tasks:
|
| 23 |
+
- **Vanilla Reaction Parsing (VRP)**: Standard reaction diagram parsing
|
| 24 |
+
- **Region-Guided Reaction Parsing (RGRP)**: Region-aware parsing with spatial guidance
|
| 25 |
+
- **Prefix-Perturbed Reaction Parsing (PPRP)**: Robustness-oriented parsing with prefix perturbations
|
| 26 |
+
3. **DPO stage**: Direct Preference Optimization to further align model outputs with ground-truth annotations.
|
| 27 |
+
|
| 28 |
+
## Training Details
|
| 29 |
+
|
| 30 |
+
| Config | Pretrain | SFT | DPO |
|
| 31 |
+
|--------|----------|-----|-----|
|
| 32 |
+
| Base Model | Qwen2.5-VL-3B-Instruct | Qwen2.5-VL-3B-Instruct | Qwen2.5-VL-3B-Instruct |
|
| 33 |
+
| Learning Rate | 1.0×10⁻⁶ | 1.0×10⁻⁵ | 3.0×10⁻⁷ |
|
| 34 |
+
| Batch Size | 16 | 4 | 64 |
|
| 35 |
+
| Epochs | 1 | 1 | 1 |
|
| 36 |
+
| Scheduler | Cosine (warmup 0.03) | Cosine (warmup 0.03) | Cosine (warmup 0.03) |
|
| 37 |
+
| Optimizer | AdamW | AdamW | AdamW |
|
| 38 |
+
| Trainable Params | LLM only | Full (vision + LLM) | LLM only |
|
| 39 |
+
|
| 40 |
+
## Usage
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 44 |
+
|
| 45 |
+
model_name = "Jingcz/RobustRDP"
|
| 46 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 47 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Related Resources
|
| 51 |
+
|
| 52 |
+
- **Dataset**: [RxnLabelData](https://huggingface.co/datasets/Jingcz/RxnLabelData)
|
| 53 |
+
- **Annotation Platform**: [RxnLabel](https://github.com/jaydetang/RxnLabel)
|