Update README.md
Browse files
README.md
CHANGED
@@ -61,7 +61,7 @@ def load_onnx_model(model_filepath):
|
|
61 |
model = load_onnx_model("path_to_model_dot_onnx_or_model_quantized_dot_onnx")
|
62 |
output_names = [model.get_outputs()[0].name] # E.g. ["logits"]
|
63 |
|
64 |
-
|
65 |
"input_ids": [t.ids for t in tokens_obj],
|
66 |
"attention_mask": [t.attention_mask for t in tokens_obj]
|
67 |
}
|
@@ -69,10 +69,7 @@ model_input = {
|
|
69 |
def sigmoid(_outputs):
|
70 |
return 1.0 / (1.0 + np.exp(-_outputs))
|
71 |
|
72 |
-
model_output = model.run(
|
73 |
-
output_names=output_names,
|
74 |
-
input_feed=create_model_input(batch_sentences, model, verbose=False),
|
75 |
-
)[0]
|
76 |
|
77 |
embeddings = sigmoid(model_output)
|
78 |
print(embeddings)
|
|
|
61 |
model = load_onnx_model("path_to_model_dot_onnx_or_model_quantized_dot_onnx")
|
62 |
output_names = [model.get_outputs()[0].name] # E.g. ["logits"]
|
63 |
|
64 |
+
input_feed_dict = {
|
65 |
"input_ids": [t.ids for t in tokens_obj],
|
66 |
"attention_mask": [t.attention_mask for t in tokens_obj]
|
67 |
}
|
|
|
69 |
def sigmoid(_outputs):
|
70 |
return 1.0 / (1.0 + np.exp(-_outputs))
|
71 |
|
72 |
+
model_output = model.run(output_names=output_names, input_feed=input_feed_dict)[0]
|
|
|
|
|
|
|
73 |
|
74 |
embeddings = sigmoid(model_output)
|
75 |
print(embeddings)
|