Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tfhe-rs compatibility for model inputs /outputs #997

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions deps_licenses/licenses_linux_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -60,7 +60,7 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion deps_licenses/licenses_linux_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6c9432ce0ab521acdbdda0c5d449fad4
2510d7b4979e76a6c90ed2a319e6d547
10 changes: 5 additions & 5 deletions deps_licenses/licenses_mac_intel_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,7 +47,7 @@ threadpoolctl, 3.5.0, BSD License
torch, 2.2.2, BSD License
tqdm, 4.67.1, MIT License; Mozilla Public License 2.0 (MPL 2.0)
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
Expand Down
2 changes: 1 addition & 1 deletion deps_licenses/licenses_mac_intel_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10b8bbfd257f8aa7432f49ae1733338e
2510d7b4979e76a6c90ed2a319e6d547
10 changes: 5 additions & 5 deletions deps_licenses/licenses_mac_silicon_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,7 +47,7 @@ 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)
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
Expand Down
2 changes: 1 addition & 1 deletion deps_licenses/licenses_mac_silicon_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6c9432ce0ab521acdbdda0c5d449fad4
2510d7b4979e76a6c90ed2a319e6d547
364 changes: 182 additions & 182 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 19 additions & 0 deletions src/concrete/ml/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ def is_valid(fhe: Union["FheMode", str]) -> bool:
return fhe in FheMode.__members__.values()


class CiphertextFormat(str, enum.Enum):
"""Type of ciphertext used as input/output for a model."""

CONCRETE = "concrete"
TFHE_RS = "tfhe-rs"

@staticmethod
def is_valid(ct_format: Union["CiphertextFormat", str]) -> bool:
"""Indicate if the given name is a supported FHE ciphertext format.

Args:
ct_format (Union[CiphertextFormat, str]): The ciphertext format to check.

Returns:
bool: Whether the ciphertext format is valid.
"""
return ct_format in CiphertextFormat.__members__.values()


class HybridFHEMode(enum.Enum):
"""Simple enum for different modes of execution of HybridModel."""

Expand Down
Loading
Loading