Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-4.0
|
3 |
+
tags:
|
4 |
+
- nougat
|
5 |
+
- small
|
6 |
+
- ocr
|
7 |
+
---
|
8 |
+
|
9 |
+
|
10 |
+
# nougat-base onnx
|
11 |
+
|
12 |
+
|
13 |
+
https://huggingface.co/facebook/nougat-base but exported to onnx. This is **not quantized**.
|
14 |
+
|
15 |
+
|
16 |
+
```python
|
17 |
+
from transformers import NougatProcessor
|
18 |
+
from optimum.onnxruntime import ORTModelForVision2Seq
|
19 |
+
|
20 |
+
model_name = 'pszemraj/nougat-base-onnx'
|
21 |
+
processor = NougatProcessor.from_pretrained(model_name)
|
22 |
+
model = ORTModelForVision2Seq.from_pretrained(
|
23 |
+
model_name,
|
24 |
+
provider="CPUExecutionProvider", # 'CUDAExecutionProvider' for gpu
|
25 |
+
use_merged=False,
|
26 |
+
use_io_binding=True
|
27 |
+
)
|
28 |
+
```
|
29 |
+
|
30 |
+
- on colab (_at time of writing_) if on CPU-only you may get `CuPy` errors, `pip uninstall cupy-cuda11x -y` solves this
|
31 |
+
|
32 |
+
|
33 |
+
## how do da inference?
|
34 |
+
|
35 |
+
See [here](https://github.com/NielsRogge/Transformers-Tutorials/blob/b46d3e89e631701ef205297435064ab780c4853a/Nougat/Inference_with_Nougat_to_read_scientific_PDFs.ipynb)
|