Update README.md
Browse files
README.md
CHANGED
@@ -134,19 +134,17 @@ print(sentences.shape) # E.g. a batch of 1 sentence
|
|
134 |
|
135 |
import onnxruntime as ort
|
136 |
|
137 |
-
sess = ort.InferenceSession(
|
138 |
-
"path_to_model_dot_onnx",
|
139 |
-
providers=['CPUExecutionProvider'],
|
140 |
-
)
|
141 |
|
142 |
-
outputs = [o.name for o in sess.get_outputs()]
|
143 |
preds_onnx = sess.run(_outputs, {'logits': _label_embeddings})
|
144 |
-
# preds_onnx is a list with 28 entries,
|
|
|
145 |
|
146 |
print(outputs[0])
|
147 |
-
|
148 |
print(preds_onnx[0])
|
149 |
-
|
150 |
```
|
151 |
|
152 |
### Commentary on the dataset
|
|
|
134 |
|
135 |
import onnxruntime as ort
|
136 |
|
137 |
+
sess = ort.InferenceSession("path_to_model_dot_onnx", providers=['CPUExecutionProvider'])
|
|
|
|
|
|
|
138 |
|
139 |
+
outputs = [o.name for o in sess.get_outputs()] # list of labels, in the order of the outputs
|
140 |
preds_onnx = sess.run(_outputs, {'logits': _label_embeddings})
|
141 |
+
# preds_onnx is a list with 28 entries, one per label,
|
142 |
+
# each with a numpy array of shape (1, 2) given the input was a batch of 1
|
143 |
|
144 |
print(outputs[0])
|
145 |
+
> surprise
|
146 |
print(preds_onnx[0])
|
147 |
+
> array([[0.97136074, 0.02863926]], dtype=float32)
|
148 |
```
|
149 |
|
150 |
### Commentary on the dataset
|