Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Cast tokens to int64 before passing to ONNX to fix Windows issue

davidmezzetti30bb6562c084
diff --git a/test/python/testonnx.py b/test/python/testonnx.py
index 5d3e580c..3a74f0f8 100644
--- a/test/python/testonnx.py
+++ b/test/python/testonnx.py
@@ -62,8 +62,9 @@ class TestOnnx(unittest.TestCase):
options = SessionOptions()
session = InferenceSession(model, options)
- # Tokenize
+ # Tokenize and cast to int64 to support all platforms
tokens = tokenizer(["cat"], return_tensors="np")
+ tokens = {x: tokens[x].astype(np.int64) for x in tokens}
# Run inference and validate
outputs = session.run(None, dict(tokens))
@@ -84,8 +85,9 @@ class TestOnnx(unittest.TestCase):
options = SessionOptions()
session = InferenceSession(model, options)
- # Tokenize
+ # Tokenize and cast to int64 to support all platforms
tokens = tokenizer(["cat"], return_tensors="np")
+ tokens = {x: tokens[x].astype(np.int64) for x in tokens}
# Run inference and validate
outputs = session.run(None, dict(tokens))