From 81cad157453526a958dee33674cbd1ca74f2d543 Mon Sep 17 00:00:00 2001 From: Andrei Stoian Date: Tue, 28 Jan 2025 18:19:54 +0100 Subject: [PATCH] chore: update deps --- deps_licenses/licenses_linux_user.txt | 15 +++++++------- deps_licenses/licenses_linux_user.txt.md5 | 2 +- pyproject.toml | 4 ++-- src/concrete/ml/sklearn/base.py | 25 ++++++----------------- 4 files changed, 16 insertions(+), 30 deletions(-) diff --git a/deps_licenses/licenses_linux_user.txt b/deps_licenses/licenses_linux_user.txt index 84c766edd..de52dbddd 100644 --- a/deps_licenses/licenses_linux_user.txt +++ b/deps_licenses/licenses_linux_user.txt @@ -6,14 +6,14 @@ brevitas, 0.10.2, UNKNOWN certifi, 2024.12.14, Mozilla Public License 2.0 (MPL 2.0) charset-normalizer, 3.4.1, MIT License coloredlogs, 15.0.1, MIT License -concrete-ml-extensions, 0.1.4, BSD-3-Clause-Clear -concrete-python, 2.9.0, BSD-3-Clause +concrete-ml-extensions, 0.1.5, BSD-3-Clause-Clear +concrete-python, 2.9.0rc2.dev20250128, BSD-3-Clause dependencies, 2.0.1, BSD License dill, 0.3.9, BSD License filelock, 3.16.1, The Unlicense (Unlicense) -flatbuffers, 24.12.23, Apache Software License +flatbuffers, 25.1.24, Apache Software License fsspec, 2024.12.0, BSD License -huggingface-hub, 0.27.1, Apache Software License +huggingface-hub, 0.28.0, Apache Software License humanfriendly, 10.0, MIT License hummingbird-ml, 0.4.11, MIT License idna, 3.10, BSD License @@ -33,7 +33,7 @@ nvidia-curand-cu12, 10.3.2.106, Other/Proprietary License nvidia-cusolver-cu12, 11.4.5.107, Other/Proprietary License nvidia-cusparse-cu12, 12.1.0.106, Other/Proprietary License nvidia-nccl-cu12, 2.20.5, Other/Proprietary License -nvidia-nvjitlink-cu12, 12.6.85, Other/Proprietary License +nvidia-nvjitlink-cu12, 12.8.61, Other/Proprietary License nvidia-nvtx-cu12, 12.1.105, Other/Proprietary License onnx, 1.17.0, Apache License v2.0 onnxconverter-common, 1.13.0, MIT License @@ -42,7 +42,7 @@ onnxoptimizer, 0.3.13, Apache License v2.0 onnxruntime, 1.18.0, MIT License packaging, 24.2, Apache Software License; BSD License pandas, 2.0.3, BSD License -protobuf, 3.20.3, BSD-3-Clause +protobuf, 5.29.3, 3-Clause BSD License psutil, 5.9.8, BSD License python-dateutil, 2.9.0.post0, Apache Software License; BSD License pytz, 2024.2, MIT License @@ -58,9 +58,8 @@ tabulate, 0.8.10, MIT License threadpoolctl, 3.5.0, BSD License torch, 2.3.1, BSD License tqdm, 4.67.1, MIT License; Mozilla Public License 2.0 (MPL 2.0) -triton, 2.3.1, MIT License typing_extensions, 4.12.2, Python Software Foundation License -tzdata, 2024.2, Apache Software License +tzdata, 2025.1, Apache Software License unfoldNd, 0.2.3, MIT License urllib3, 2.2.3, MIT License xgboost, 1.6.2, Apache Software License diff --git a/deps_licenses/licenses_linux_user.txt.md5 b/deps_licenses/licenses_linux_user.txt.md5 index d6b009154..35daa5881 100644 --- a/deps_licenses/licenses_linux_user.txt.md5 +++ b/deps_licenses/licenses_linux_user.txt.md5 @@ -1 +1 @@ -6c9432ce0ab521acdbdda0c5d449fad4 +05f0be957df3f4c282a9ed4378c7ce85 diff --git a/pyproject.toml b/pyproject.toml index 9805dd91b..fc2afd343 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,8 +38,8 @@ python = ">=3.8.1,<3.13" # source, so we should only use this for Concrete Python's non-public releases # https://python-poetry.org/docs/1.7/repositories#project-configuration # concrete-python = {version="==2.7.0", source = "zama-pypi-cpu"} -concrete-ml-extensions = "0.1.4" -concrete-python = {version="==2.9.0", source = "zama-pypi-cpu"} +concrete-ml-extensions = "0.1.5" +concrete-python = {version="==2.9.0rc2.dev20250128", source = "zama-pypi-cpu"} setuptools = "75.3.0" skops = {version = "0.5.0"} xgboost = "1.6.2" diff --git a/src/concrete/ml/sklearn/base.py b/src/concrete/ml/sklearn/base.py index 7a40854d4..02ff104a3 100644 --- a/src/concrete/ml/sklearn/base.py +++ b/src/concrete/ml/sklearn/base.py @@ -711,34 +711,18 @@ def encrypt_run_decrypt_tfhers_concrete(self, *inputs): assert self._tfhers_bridge is not None input_is_signed = self.input_quantizers[0].is_signed - encrypt_func = ( - fhext.encrypt_serialize_i8_radix_2d # pylint: disable=no-member - if input_is_signed - else fhext.encrypt_serialize_u8_radix_2d # pylint: disable=no-member - ) + encrypt_dtype = numpy.int8 if input_is_signed else numpy.uint8 output_0 = self.fhe_circuit.graph.ordered_outputs()[0] output_is_signed = output_0.inputs[0].dtype.is_signed output_bitwidth = output_0.inputs[0].dtype.bit_width - if output_bitwidth == 16: - decrypt_func = ( - fhext.decrypt_serialized_i16_radix_2d # pylint: disable=no-member - if output_is_signed - else fhext.decrypt_serialized_u16_radix_2d # pylint: disable=no-member - ) - else: - decrypt_func = ( - fhext.decrypt_serialized_i8_radix_2d # pylint: disable=no-member - if output_is_signed - else fhext.decrypt_serialized_u8_radix_2d # pylint: disable=no-member - ) assert self.tfhers_sk is not None tfhers_x = tuple( [ self._tfhers_bridge.import_value( - encrypt_func(inputs[idx].astype(encrypt_dtype), self.tfhers_sk), + fhext.encrypt_radix(inputs[idx].astype(encrypt_dtype), self.tfhers_sk), input_idx=idx, ) for idx in range(len(inputs)) @@ -756,7 +740,10 @@ def encrypt_run_decrypt_tfhers_concrete(self, *inputs): shape = out_shapes[func_name][0] num_cols = shape[1] if len(shape) > 1 else shape[0] - result_np = decrypt_func(buff, num_cols, self.tfhers_sk) + # The output bitwidth for trees should be the same as the input one + result_np = fhext.decrypt_radix( + buff, (-1, 1), output_bitwidth, output_is_signed, self.tfhers_sk + ) result_np = result_np.reshape(shape) return result_np