Skip to content

armgit / txtai

Public Imported from GitHub
0

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

Fix import error with latest version of onnx, closes #907

davidmezzetti34ba1051105f
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 01096827..e23f91d9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -49,7 +49,7 @@ jobs:
- name: Build
run: |
pip install -U wheel
- pip install .[all,dev] onnx==1.17.0 skl2onnx==1.18.0
+ pip install .[all,dev]
pip cache purge
python -c "import nltk; nltk.download(['punkt', 'punkt_tab', 'averaged_perceptron_tagger_eng'])"
python --version
diff --git a/src/python/txtai/pipeline/train/mlonnx.py b/src/python/txtai/pipeline/train/mlonnx.py
index 126e025c..92c1af9a 100644
--- a/src/python/txtai/pipeline/train/mlonnx.py
+++ b/src/python/txtai/pipeline/train/mlonnx.py
@@ -5,9 +5,14 @@ Machine learning model to ONNX export module
from ..base import Pipeline
try:
+ # Workaround for issue with onnx 1.18 and onnxmltools 1.13
+ import onnx
+
+ onnx.helper.split_complex_to_pairs = None
+
from onnxmltools import convert_sklearn
- from onnxmltools.convert.common.data_types import StringTensorType
+ from skl2onnx.common.data_types import StringTensorType
from skl2onnx.helpers.onnx_helper import save_onnx_model, select_model_inputs_outputs
ONNX_MLTOOLS = True