Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: broadfield-dev/bert-small-ner-pii-tuned-12261022
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- onnx
|
| 6 |
+
- transformers
|
| 7 |
+
- optimum
|
| 8 |
+
- onnxruntime
|
| 9 |
+
- token-classification
|
| 10 |
+
- int8
|
| 11 |
+
- quantized
|
| 12 |
+
- mobile
|
| 13 |
+
language: en
|
| 14 |
+
pipeline_tag: token-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# ONNX Export: broadfield-dev/bert-small-ner-pii-tuned-12261022
|
| 18 |
+
|
| 19 |
+
This is a version of [broadfield-dev/bert-small-ner-pii-tuned-12261022](https://huggingface.co/broadfield-dev/bert-small-ner-pii-tuned-12261022) that has been converted to ONNX and optimized.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
- **Base Model:** `broadfield-dev/bert-small-ner-pii-tuned-12261022`
|
| 23 |
+
- **Task:** `token-classification`
|
| 24 |
+
- **Opset Version:** `17`
|
| 25 |
+
- **Optimization:** `INT8 - Optimized for Mobile (ARM64)`
|
| 26 |
+
|
| 27 |
+
## Usage
|
| 28 |
+
|
| 29 |
+
### Installation
|
| 30 |
+
```bash
|
| 31 |
+
pip install onnxruntime transformers
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
### Python Example
|
| 35 |
+
```python
|
| 36 |
+
|
| 37 |
+
from transformers import AutoTokenizer
|
| 38 |
+
import onnxruntime as ort
|
| 39 |
+
import numpy as np
|
| 40 |
+
|
| 41 |
+
# 1. Load Tokenizer
|
| 42 |
+
tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/bert-small-ner-pii-tuned-12261022-onnx")
|
| 43 |
+
|
| 44 |
+
# 2. Load Model
|
| 45 |
+
session = ort.InferenceSession("model.onnx")
|
| 46 |
+
|
| 47 |
+
# 3. Preprocess
|
| 48 |
+
text = "This is a test sentence."
|
| 49 |
+
inputs = tokenizer(text, return_tensors="np")
|
| 50 |
+
|
| 51 |
+
# 4. Inference
|
| 52 |
+
outputs = session.run(None, dict(inputs))
|
| 53 |
+
print(outputs[0])
|
| 54 |
+
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## About this Export
|
| 58 |
+
This model was exported using [Optimum](https://huggingface.co/docs/optimum/index) and `onnxruntime`.
|
| 59 |
+
It includes the `INT8 - Optimized for Mobile (ARM64)` quantization settings.
|