File size: 4,919 Bytes
4509e64
 
 
 
 
 
 
 
 
8deb6b8
4509e64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86a35e9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4509e64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8deb6b8
 
 
 
 
 
 
 
 
 
 
 
 
 
4509e64
 
8deb6b8
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
---
library_name: transformers
pipeline_tag: image-to-text
tags:
- chemistry
- image-to-text
datasets:
- UniParser/MolParser-7M
- UniParser/MolGallery
license: cc-by-nc-sa-4.0
---

# MolParser Mobile

<p align="center">
πŸ’» <a href="https://github.com/dptech-corp/MolParser">Github</a> |
πŸ“„ <a>Report (Coming soon...)</a> |
πŸš€ <a href="https://ocsr.dp.tech/">Demo</a>
</p>

**MolParser-Mobile** is the next-generation lightweight version of **MolParser**, designed for **ultrafast Optical Chemical Structure Recognition (OCSR)**. It converts molecular structure images into **E-SMILES** representations with significantly higher throughput while maintaining state-of-the-art recognition accuracy.

Compared with MolParser 1.0, MolParser-Mobile reduces the model size by **95.4%** (216M β†’ **9.98M** parameters) and increases inference throughput by **38Γ—**, reaching **1,520 molecules/second** on a single NVIDIA RTX 4090D GPU. Despite its compact architecture, it achieves better accuracy on multiple real-world OCSR benchmarks, making it suitable for large-scale chemical literature mining and industrial deployment.


## πŸš€ Highlights

* **38Γ— faster** than MolParser 1.0 (**1,520 Mol/s** on RTX 4090D)
* **9.98M parameters** (**95.4% smaller** than MolParser 1.0)
* **State-of-the-art** accuracy on challenging real-world OCSR benchmarks (BioVista)
* Designed for **web-scale** chemical literature mining
* Converts molecular images directly into **E-SMILES** strings


## πŸ“Š Performance

| Model                |         Parameters |     Throughput (RTX 4090D) |   Uni-Parser Bench |           BioVista |    WildMol-10k |
| -------------------- | -----------------: | -------------------------: | -----------------: | -----------------: | -------------: |
| Gemma4-31B           |                31B |                        OOM |              0.073 |              0.118 |          0.232 |
| Qwen3.5-397B-A17B    |               397B |                        OOM |              0.272 |              0.347 |          0.303 |
| MolParser 1.0        |               216M |                 39.8 Mol/s |              0.800 |              0.703 |      **0.769** |
| **MolParser-Mobile** | **9.98M (-95.4%)** | **1,520 Mol/s (+3819.1%)** | **0.823 (+0.023)** | **0.801 (+0.098)** | 0.734 (-0.035) |


## ⚑ Usage

### Option 1. MolParser Library (Recommended)

The [MolParser library](https://github.com/dptech-corp/MolParser) provides a convenient interface for molecule detection and recognition.

Clone the repository and install the package:

```bash
git clone https://github.com/dptech-corp/MolParser.git
cd MolParser
pip install -e .
```

Then run:

```python
from molparser import MolParser

parser = MolParser()

result = parser.parse(
    "mol.png",
    rec_only=True,   # Recognition only
)
```

### Option 2. πŸ€— Transformers
Load MolParser-Mobile directly with the Hugging Face transformers library.

```python
import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor

repo_id = "UniParser/MolParser-Mobile"
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.float16 if device == "cuda" else torch.float32

processor = AutoProcessor.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
    repo_id,
    dtype=dtype,
    trust_remote_code=True,
).to(device).eval()

image = Image.open("mol.png").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
inputs = {k: v.to(device, dtype=dtype) for k, v in inputs.items()}

output_ids = model.generate(**inputs, max_length=256, num_beams=1, do_sample=False)
caption = processor.batch_decode(output_ids, skip_special_tokens=True)[0]
print(caption)
```


## πŸ“œ License

### MolParser-Mobile Weight

The **MolParser-Mobile model weights** are provided for **non-commercial use only**.

For commercial licensing, please contact **fangxi@dp.tech** or open a discussion on Hugging Face.

### MolParser Github Repo

The **MolParser** library (including E-SMILES post-processing and rendering) is available at https://github.com/dptech-corp/MolParser and is licensed under the **Apache License 2.0**, which permits commercial use, modification, and distribution, provided that the license and copyright notices are retained.

**Note:** Model weights, datasets, and third-party dependencies are subject to their respective licenses.

## πŸ“– Citation

If you use this datasets in your work, please cite:

```
@inproceedings{fang2025molparser,
  title={Molparser: End-to-end visual recognition of molecule structures in the wild},
  author={Fang, Xi and Wang, Jiankun and Cai, Xiaochen and Chen, Shangqian and Yang, Shuwen and Tao, Haoyi and Wang, Nan and Yao, Lin and Zhang, Linfeng and Ke, Guolin},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={24528--24538},
  year={2025}
}
```