Xenova HF Staff commited on
Commit
921f626
·
verified ·
1 Parent(s): 9e3e5cd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -15,6 +15,27 @@ NeoBERT is a **next-generation encoder** model for English text representation,
15
  - Paper: [paper](https://arxiv.org/abs/2502.19587)
16
  - Repository: [github](https://github.com/chandar-lab/NeoBERT).
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ## Conversion
19
 
20
  The export script can be found at [./export.py](https://huggingface.co/onnx-community/NeoBERT-ONNX/blob/main/export.py).
 
15
  - Paper: [paper](https://arxiv.org/abs/2502.19587)
16
  - Repository: [github](https://github.com/chandar-lab/NeoBERT).
17
 
18
+ ## Usage
19
+
20
+ ### ONNXRuntime
21
+
22
+ ```py
23
+ from transformers import AutoTokenizer
24
+ from huggingface_hub import hf_hub_download
25
+ import onnxruntime as ort
26
+
27
+ model_id = "onnx-community/NeoBERT-ONNX"
28
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
29
+ model_file = hf_hub_download(model_id, filename="onnx/model.onnx")
30
+ session = ort.InferenceSession(model_file)
31
+
32
+ text = ["NeoBERT is the most efficient model of its kind!"]
33
+ inputs = tokenizer(text, return_tensors="np").data
34
+ outputs = session.run(None, inputs)[0]
35
+ embeddings = outputs[:, 0, :]
36
+ print(f"{embeddings.shape=}") # (1, 768)
37
+ ```
38
+
39
  ## Conversion
40
 
41
  The export script can be found at [./export.py](https://huggingface.co/onnx-community/NeoBERT-ONNX/blob/main/export.py).