Skip to content

Commit 4012b20

Browse files
committed
Move .md to models
1 parent e5982cc commit 4012b20

2 files changed

Lines changed: 49 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
### C++ ###
21
# Prerequisites
32
**/*.d
43

@@ -47,9 +46,9 @@ bkp/
4746

4847
# Ignore everything in the models folder
4948
models/*
50-
# But DO NOT ignore these two files
5149
!models/hf_extract_model.py
5250
!models/hf_model_to_onnx.py
51+
!models/README.md
5352

5453
libtorch*.zip
5554
libs/libtorch

models/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
---
3+
4+
# Download Pre-trained Models
5+
6+
## 🛠️ Hugging Face to **ONNX** Converter:
7+
8+
These Python scripts convert Hugging Face models into the ONNX format for optimized inference.
9+
10+
These scripts handle two primary use cases:
11+
1. **Feature extraction models** (e.g., `sentence-transformers`).
12+
2. **Token classification models** (e.g., Named Entity Recognition - NER).
13+
14+
It automatically downloads the model and organizes the exported files in a structured subdirectory.
15+
16+
## Requirements
17+
18+
*Before running the script, make sure you have the following Python packages installed:*
19+
```bash
20+
pip install torch transformers onnx onnxruntime optimum
21+
```
22+
23+
## Examples
24+
25+
```bash
26+
python3 models/hf_model_to_onnx.py -m="dbmdz/bert-large-cased-finetuned-conll03-english" -o="bert-large-cased-finetuned-conll03-english"
27+
```
28+
29+
```bash
30+
python3 models/hf_model_to_onnx.py -m="sentence-transformers/all-MiniLM-L6-v2" -o="sentence-transformers/all-MiniLM-L6-v2"
31+
```
32+
33+
## Output
34+
35+
```
36+
./models/
37+
├── hf_extract_model.py
38+
├── hf_model_to_onnx.py
39+
├── sentence-transformers/all-MiniLM-L6-v2/
40+
│ ├── model.onnx (via optimum)
41+
│ └── tokenizer/
42+
└── dslim/bert-base-NER/
43+
├── model.onnx
44+
├── label_map.json
45+
└── tokenizer/
46+
```
47+
48+
---

0 commit comments

Comments
 (0)