Complete Concrete→Torus rebrand in all files

- Update all requirements.txt files
- Update all GitHub workflow files
- Update Makefile and federated_learning/Makefile
- Update script files (shell scripts)
- Update deps_licenses files
- Rename raw_cml examples to raw_tml
This commit is contained in:
Zach Kelling
2026-01-26 20:58:18 -08:00
parent 2d521b827f
commit 9f7326f9c4
43 changed files with 228 additions and 228 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
name: Benchmark CML
name: Benchmark TML
on:
workflow_dispatch:
@@ -42,7 +42,7 @@ on:
type: string
# Add recurrent launching
# FIXME: https://github.com/luxfhe-ai/concrete-ml-internal/issues/1851
# FIXME: https://github.com/luxfhe-ai/torus-ml-internal/issues/1851
permissions:
contents: read
+6 -6
View File
@@ -1,6 +1,6 @@
# This workflow uses GitHub CLI to get timings of last 50 runs of Concrete ML main CI
# This workflow uses GitHub CLI to get timings of last 50 runs of Torus ML main CI
# and send it to slack and add it as an artifact on the workflow
name: CML build time
name: TML build time
on:
workflow_dispatch:
@@ -59,8 +59,8 @@ jobs:
- name: Archive figure
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: cml_ci_time_evolution.png
path: cml_ci_time_evolution.png
name: tml_ci_time_evolution.png
path: tml_ci_time_evolution.png
- name: Archive raw data
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
@@ -82,12 +82,12 @@ jobs:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "CML-CI timings over last 4 weeks available at: (${{ env.ACTION_RUN_URL }})"
SLACK_MESSAGE: "TML-CI timings over last 4 weeks available at: (${{ env.ACTION_RUN_URL }})"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Upload figure to Slack
run: |
curl -F file=@cml_ci_time_evolution.png -F "initial_comment=CML CI time evolution (over last 4 weeks)" -F channels=${{ secrets.CML_INTERNAL_UPDATE_SLACK_CHANNEL_ID }} -H "Authorization: Bearer ${{ secrets.SLACK_CI_MONITORING_BOT_TOKEN }}" https://slack.com/api/files.upload
curl -F file=@tml_ci_time_evolution.png -F "initial_comment=TML CI time evolution (over last 4 weeks)" -F channels=${{ secrets.TML_INTERNAL_UPDATE_SLACK_CHANNEL_ID }} -H "Authorization: Bearer ${{ secrets.SLACK_CI_MONITORING_BOT_TOKEN }}" https://slack.com/api/files.upload
+14 -14
View File
@@ -1,4 +1,4 @@
name: CIFAR-10 benchmark CML
name: CIFAR-10 benchmark TML
on:
schedule:
- cron: '0 0 1 * *'
@@ -38,7 +38,7 @@ on:
required: true
# FIXME: Add recurrent launching
# https://github.com/luxfhe-ai/concrete-ml-internal/issues/1851
# https://github.com/luxfhe-ai/torus-ml-internal/issues/1851
permissions:
contents: read
@@ -129,7 +129,7 @@ jobs:
- name: Verify CPU Installation
run: |
source .venv/bin/activate
echo "=== CONCRETE-PYTHON INSTALLATION VERIFICATION (CPU) ==="
echo "=== CONCRETE-PYTHON INSTALLATION VERIFICATION (CPU; TORUS-ML) ==="
python3 -c "
import concrete.compiler
print('Concrete GPU enabled:', concrete.compiler.check_gpu_enabled())
@@ -145,14 +145,14 @@ jobs:
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o concrete-python.whl.zip \
-o torus-python.whl.zip \
https://api.github.com/repos/luxfhe-ai/concrete/actions/artifacts/${{ github.event.inputs.alternative-cp-wheel-artifact-id }}/zip
- name: Alternative Concrete Python Wheel Install
if: github.event.inputs.alternative-cp-wheel-artifact-id != 'none'
run: |
source .venv/bin/activate
unzip concrete-python.whl.zip
unzip torus-python.whl.zip
pip install concrete_python-*.whl
- name: Alternative Concrete Python Branch Checkout
@@ -167,7 +167,7 @@ jobs:
- name: Alternative Concrete Python Branch Source Install
if: github.event.inputs.alternative-cp-branch != 'none'
run: |
cp -R concrete/frontends/concrete-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
cp -R concrete/frontends/torus-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
# CIFAR-10-8b benchmark
- name: Benchmark - CIFAR-10-8b
@@ -284,14 +284,14 @@ jobs:
./script/make_utils/setup_os_deps.sh
make setup_env
source .venv/bin/activate
CP_VERSION=$(pip freeze | grep concrete-python)
pip uninstall -y concrete-python
CP_VERSION=$(pip freeze | grep torus-python)
pip uninstall -y torus-python
pip install --extra-index-url https://pypi.luxfhe.ai/gpu ${CP_VERSION}
- name: Verify GPU Installation
run: |
source .venv/bin/activate
echo "=== CONCRETE-PYTHON INSTALLATION VERIFICATION (GPU) ==="
echo "=== CONCRETE-PYTHON INSTALLATION VERIFICATION (GPU; TORUS-ML) ==="
python3 -c "
import concrete.compiler
print('Concrete GPU enabled:', concrete.compiler.check_gpu_enabled())
@@ -307,14 +307,14 @@ jobs:
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o concrete-python.whl.zip \
-o torus-python.whl.zip \
https://api.github.com/repos/luxfhe-ai/concrete/actions/artifacts/${{ github.event.inputs.alternative-cp-wheel-artifact-id }}/zip
- name: Alternative Concrete Python Wheel Install
if: github.event.inputs.alternative-cp-wheel-artifact-id != 'none'
run: |
source .venv/bin/activate
unzip concrete-python.whl.zip
unzip torus-python.whl.zip
pip install concrete_python-*.whl
- name: Alternative Concrete Python Branch Checkout
@@ -329,14 +329,14 @@ jobs:
- name: Alternative Concrete Python Branch Source Install
if: github.event.inputs.alternative-cp-branch != 'none'
run: |
cp -R concrete/frontends/concrete-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
cp -R concrete/frontends/torus-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
# CIFAR-10-8b benchmark
- name: Benchmark - CIFAR-10-8b
if: github.event.inputs.benchmark == 'cifar-10-8b'
run: |
source .venv/bin/activate
export CML_USE_GPU=1
export TML_USE_GPU=1
NUM_SAMPLES=${{ github.event.inputs.num_samples }} python3 ./use_case_examples/cifar/cifar_brevitas_with_model_splitting/infer_fhe.py
python3 ./benchmarks/convert_cifar.py --model-name "8-bit-split-v0"
@@ -345,7 +345,7 @@ jobs:
if: github.event.inputs.benchmark == 'cifar-10-16b'
run: |
source .venv/bin/activate
export CML_USE_GPU=1
export TML_USE_GPU=1
NUM_SAMPLES=${{ github.event.inputs.num_samples }} P_ERROR=${{ github.event.inputs.p_error }} python3 ./use_case_examples/cifar/cifar_brevitas_training/evaluate_one_example_fhe.py
python3 ./benchmarks/convert_cifar.py --model-name "16-bits-trained-v0"
@@ -1,4 +1,4 @@
name: CML tests - common
name: TML tests - common
on:
workflow_call:
@@ -549,15 +549,15 @@ jobs:
# Run Pytest on all of our tests (except flaky ones) using PyPI's local wheel in the weekly
# or during the release process
- name: PyTest (no flaky) with PyPI local wheel of Concrete ML (weekly, release)
- name: PyTest (no flaky) with PyPI local wheel of Torus ML (weekly, release)
if: |
(fromJSON(env.IS_WEEKLY) || fromJSON(env.IS_RELEASE))
&& steps.conformance.outcome == 'success'
&& !cancelled()
run: |
make pytest_pypi_wheel_cml_no_flaky
make pytest_pypi_wheel_tml_no_flaky
# Run Pytest on all of our tests (except flaky ones) using Concrete ML's latest version
# Run Pytest on all of our tests (except flaky ones) using Torus ML's latest version
# available on PyPI after publishing a release
- name: PyTest (no flaky) with PyPI (published release)
if: |
@@ -567,7 +567,7 @@ jobs:
run: |
PROJECT_VERSION="$(poetry version --short)"
make pytest_pypi_cml_no_flaky VERSION="$PROJECT_VERSION"
make pytest_pypi_tml_no_flaky VERSION="$PROJECT_VERSION"
# Compute coverage only on reference build
- name: Test coverage (regular, weekly)
@@ -614,15 +614,15 @@ jobs:
make pytest_codeblocks
# Run Pytest on all codeblocks on a weekly basis or while releasing
- name: PyTest CodeBlocks with PyPI local wheel of Concrete ML (weekly, release)
- name: PyTest CodeBlocks with PyPI local wheel of Torus ML (weekly, release)
if: |
(fromJSON(env.IS_WEEKLY) || fromJSON(env.IS_RELEASE))
&& steps.conformance.outcome == 'success'
&& !cancelled()
run: |
make pytest_codeblocks_pypi_wheel_cml
make pytest_codeblocks_pypi_wheel_tml
# Run Pytest on all codeblocks using Concrete ML's latest version available on PyPI after
# Run Pytest on all codeblocks using Torus ML's latest version available on PyPI after
# publishing a release
- name: PyTest CodeBlocks with PyPI (published release)
if: |
@@ -632,7 +632,7 @@ jobs:
run: |
PROJECT_VERSION="$(poetry version --short)"
make pytest_codeblocks_pypi_cml VERSION="$PROJECT_VERSION"
make pytest_codeblocks_pypi_tml VERSION="$PROJECT_VERSION"
# Run Pytest on all notebooks on a weekly basis
# Note: some notebooks need specific data stored in LFS
+4 -4
View File
@@ -1,4 +1,4 @@
name: Concrete ML Tests
name: Torus ML Tests
on:
pull_request:
@@ -46,7 +46,7 @@ on:
# based on 'github.event_name' and both are set to 'workflow_dispatch'. Therefore, an optional
# input 'manual_call' with proper default values is added to both as a workaround, following one
# user's suggestion : https://github.com/actions/runner/discussions/1884
# FIXME: https://github.com/luxfhe-ai/concrete-ml-internal/issues/3930
# FIXME: https://github.com/luxfhe-ai/torus-ml-internal/issues/3930
workflow_call:
inputs:
event_name:
@@ -164,7 +164,7 @@ jobs:
name: Prepare versions and OS
needs: [commit-checks]
# We skip the CI in cases of pushing to internal main (because all pushes to main internal are now from the bot)
if: ${{ !( github.repository != 'luxfhe-ai/concrete-ml' && github.event_name == 'push' && github.ref == 'refs/heads/main' ) }}
if: ${{ !( github.repository != 'luxfhe-ai/torus-ml' && github.event_name == 'push' && github.ref == 'refs/heads/main' ) }}
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
@@ -346,7 +346,7 @@ jobs:
shell: bash
run: |
# success always if wasn't launched due to CI not supposed to be launched
if ${{ github.repository == 'luxfhe-ai/concrete-ml-internal' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if ${{ github.repository == 'luxfhe-ai/torus-ml-internal' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
then
exit 0
fi
+6 -6
View File
@@ -231,14 +231,14 @@ jobs:
./script/make_utils/setup_os_deps.sh
make setup_env
- name: Install GPU concrete-python
id: install-gpu-concrete-python
- name: Install GPU torus-python
id: install-gpu-torus-python
run: |
poetry run pip show concrete-python || echo "concrete-python not installed"
CONCRETE_WITH_VERSION=$(poetry run pip freeze | grep concrete-python)
poetry run pip uninstall -y concrete-python
poetry run pip show torus-python || echo "torus-python not installed"
CONCRETE_WITH_VERSION=$(poetry run pip freeze | grep torus-python)
poetry run pip uninstall -y torus-python
poetry run pip install --extra-index-url https://pypi.luxfhe.ai/gpu $CONCRETE_WITH_VERSION
poetry run pip show concrete-python || echo "concrete-python not installed"
poetry run pip show torus-python || echo "torus-python not installed"
- name: 🚀 Run GPU Tests
run: |
@@ -1,4 +1,4 @@
name: LLama Fine-tuning Benchmark CML
name: LLama Fine-tuning Benchmark TML
on:
schedule:
- cron: '0 0 1 * *'
@@ -195,7 +195,7 @@ jobs:
pip install -r requirements.txt
fi
# Install concrete-ml requirements
# Install torus-ml requirements
pip install -e .
- name: Alternative Concrete Python Wheel Download
@@ -205,14 +205,14 @@ jobs:
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o concrete-python.whl.zip \
-o torus-python.whl.zip \
https://api.github.com/repos/luxfhe-ai/concrete/actions/artifacts/${{ github.event.inputs.alternative-cp-wheel-artifact-id }}/zip
- name: Alternative Concrete Python Wheel Install
if: github.event_name == 'workflow_dispatch' && github.event.inputs.alternative-cp-wheel-artifact-id != 'none'
run: |
source .venv/bin/activate
unzip concrete-python.whl.zip
unzip torus-python.whl.zip
pip install concrete_python-*.whl
- name: Alternative Concrete Python Branch Checkout
@@ -227,7 +227,7 @@ jobs:
- name: Alternative Concrete Python Branch Source Install
if: github.event_name == 'workflow_dispatch' && github.event.inputs.alternative-cp-branch != 'none'
run: |
cp -R concrete/frontends/concrete-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
cp -R concrete/frontends/torus-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
- name: Run Benchmark - LLama LoRA Math Word Problems (${{ matrix.device }})
id: run-benchmark
+10 -10
View File
@@ -1,4 +1,4 @@
# Trigger AWS ImageBuidler pipeline to produce an AmazonMachineImage (AMI) containing concrete-ml
# Trigger AWS ImageBuidler pipeline to produce an AmazonMachineImage (AMI) containing torus-ml
name: Publish AWS AMI
on:
release:
@@ -25,23 +25,23 @@ jobs:
# Just a way to check that if triggered by workflow_dispatch the tag exists
# FIXME: We still need to check that it matches a version tag
# This won't work on automatically triggered based on release
- name: Checkout Concrete ML Repository
- name: Checkout Torus ML Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
ref: ${{ inputs.version || github.ref_name}}
fetch-depth: 1
lfs: false
path: "concrete-ml-version"
path: "torus-ml-version"
# To use the files and all
- name: Checkout Concrete ML Repository
- name: Checkout Torus ML Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
fetch-depth: 1
lfs: false
path: "concrete-ml-latest"
path: "torus-ml-latest"
- name: Checkout Slab Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -64,15 +64,15 @@ jobs:
- name: Trigger build pipeline via Slab
run: |
CML_VERSION="${{ steps.git_ref.outputs.git-ref }}"
CML_VERSION="$(echo $CML_VERSION | cut -d 'v' -f 2)"
TML_VERSION="${{ steps.git_ref.outputs.git-ref }}"
TML_VERSION="$(echo $TML_VERSION | cut -d 'v' -f 2)"
# This basically takes the files and modifies some values from it
COMPONENT_USER_DATA="$(cat concrete-ml-latest/ci/aws_ami_build_component.yaml | sed -e 's|\(concrete-ml==\)${CML_VERSION}|\1'${CML_VERSION}'|' -e 's|${AWS_ACCOUNT_ID}|${{ secrets.AWS_ACCOUNT_ID }}|')"
COMPONENT_USER_DATA="$(cat torus-ml-latest/ci/aws_ami_build_component.yaml | sed -e 's|\(torus-ml==\)${TML_VERSION}|\1'${TML_VERSION}'|' -e 's|${AWS_ACCOUNT_ID}|${{ secrets.AWS_ACCOUNT_ID }}|')"
COMPONENT_USER_DATA=$(echo "$COMPONENT_USER_DATA" | base64 | tr -d "\n")
PAYLOAD='{"name": "luxfhe-concrete-ml-py39-x86_64", "description": "luxfhe Concrete ML ${{ steps.git_ref.outputs.git-ref }} (with Python 3.9 for x86_64 architecture)", "release_tag": "${{ steps.git_ref.outputs.git-ref }}", "region": "eu-west-3", "image_pipeline_arn": "${{ secrets.AMI_PIPELINE_ARN }}", "distribution_configuration_arn": "${{ secrets.AMI_DISTRIB_CONFIG_ARN }}", "component_user_data": "'"${COMPONENT_USER_DATA}"'"}'
PAYLOAD='{"name": "luxfhe-torus-ml-py39-x86_64", "description": "luxfhe Torus ML ${{ steps.git_ref.outputs.git-ref }} (with Python 3.9 for x86_64 architecture)", "release_tag": "${{ steps.git_ref.outputs.git-ref }}", "region": "eu-west-3", "image_pipeline_arn": "${{ secrets.AMI_PIPELINE_ARN }}", "distribution_configuration_arn": "${{ secrets.AMI_DISTRIB_CONFIG_ARN }}", "component_user_data": "'"${COMPONENT_USER_DATA}"'"}'
echo -n "${PAYLOAD}" > payload.json
@@ -94,6 +94,6 @@ jobs:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "AWS AMI build pipeline triggered for concrete-ml ${{ steps.git_ref.outputs.git-ref }}"
SLACK_MESSAGE: "AWS AMI build pipeline triggered for torus-ml ${{ steps.git_ref.outputs.git-ref }}"
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+3 -3
View File
@@ -84,13 +84,13 @@ jobs:
./script/make_utils/setup_os_deps.sh
make setup_env
source .venv/bin/activate
CP_VERSION=$(pip freeze | grep concrete-python)
pip uninstall -y concrete-python
CP_VERSION=$(pip freeze | grep torus-python)
pip uninstall -y torus-python
pip install --extra-index-url https://pypi.luxfhe.ai/gpu ${CP_VERSION}
- name: Refresh Notebooks
run: |
export CML_USE_GPU=1
export TML_USE_GPU=1
make jupyter_execute_gpu
- name: Prepare PR Body
+10 -10
View File
@@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
skip_tests:
description: "Skip tests (only if approved by CML team!)"
description: "Skip tests (only if approved by TML team!)"
type: boolean
required: false
default: false
@@ -300,7 +300,7 @@ jobs:
tags: true
# This action creates docker and pypi images directly on the AWS Slab instance
# The 'PRIVATE_RELEASE_IMAGE_BASE' variable is kept here in case Concrete ML starts to publish
# The 'PRIVATE_RELEASE_IMAGE_BASE' variable is kept here in case Torus ML starts to publish
# private nightly releases one day. Currently, release candidates and actual releases are all
# done through the 'PUBLIC_RELEASE_IMAGE_BASE' image. The private image is also used to list all
# tags easily
@@ -318,8 +318,8 @@ jobs:
run:
shell: bash
env:
PRIVATE_RELEASE_IMAGE_BASE: ghcr.io/luxfhe-ai/concrete-ml
PUBLIC_RELEASE_IMAGE_BASE: luxfhefhe/concrete-ml
PRIVATE_RELEASE_IMAGE_BASE: ghcr.io/luxfhe-ai/torus-ml
PUBLIC_RELEASE_IMAGE_BASE: luxfhefhe/torus-ml
PIP_INDEX_URL: ${{ secrets.PIP_INDEX_URL }}
GIT_TAG: ${{ needs.release-checks.outputs.git_tag }}
PROJECT_VERSION: ${{ needs.release-checks.outputs.project_version }}
@@ -386,7 +386,7 @@ jobs:
EXISTING_TAGS=$(curl \
-X GET \
-H "Authorization: Bearer $(echo ${{ secrets.BOT_TOKEN }} | base64)" \
https://ghcr.io/v2/luxfhe-ai/concrete-ml/tags/list | jq -rc '.tags | join(" ")')
https://ghcr.io/v2/luxfhe-ai/torus-ml/tags/list | jq -rc '.tags | join(" ")')
# We want the space separated list of versions to be expanded
# shellcheck disable=SC2086
@@ -482,13 +482,13 @@ jobs:
CN_VERSION_SPEC_FOR_RC="$(poetry run python \
./script/make_utils/pyproject_version_parser_helper.py \
--pyproject-toml-file pyproject.toml \
--get-pip-install-spec-for-dependency concrete-python)"
--get-pip-install-spec-for-dependency torus-python)"
SECRETS_FILE="$(mktemp)"
echo "" >> "${SECRETS_FILE}"
echo "SECRETS_FILE=${SECRETS_FILE}" >> "$GITHUB_ENV"
- name: Build Docker Concrete ML Image
- name: Build Docker Torus ML Image
if: ${{ success() && !cancelled() }}
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
with:
@@ -527,9 +527,9 @@ jobs:
cp ./script/actions_utils/RELEASE_TEMPLATE.md "${RELEASE_BODY_FILE}"
{
echo "Docker Image: ${PUBLIC_RELEASE_IMAGE_BASE}:${{ env.GIT_TAG }}";
echo "Docker Hub: https://hub.docker.com/r/luxfhefhe/concrete-ml/tags";
echo "pip: https://pypi.org/project/concrete-ml/${{ env.PROJECT_VERSION }}";
echo "Documentation: https://docs.luxfhe.ai/concrete-ml";
echo "Docker Hub: https://hub.docker.com/r/luxfhefhe/torus-ml/tags";
echo "pip: https://pypi.org/project/torus-ml/${{ env.PROJECT_VERSION }}";
echo "Documentation: https://docs.luxfhe.ai/torus-ml";
echo "";
} >> "${RELEASE_BODY_FILE}"
cat "${RAW_CHANGELOG_DIR}"/* >> "${RELEASE_BODY_FILE}"
+5 -5
View File
@@ -1,4 +1,4 @@
name: ResNet Hybrid FHE Benchmark CML
name: ResNet Hybrid FHE Benchmark TML
on:
schedule:
- cron: '0 0 1 * *'
@@ -158,7 +158,7 @@ jobs:
# Install other dependencies
pip install 'transformers>=4.30.0' 'datasets>=2.12.0' 'tqdm>=4.65.0' 'numpy>=1.24.0' 'psutil>=5.9.0' 'py-cpuinfo>=9.0.0'
# Install concrete-ml requirements
# Install torus-ml requirements
pip install -e .
- name: Alternative Concrete Python Wheel Download
@@ -168,14 +168,14 @@ jobs:
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-o concrete-python.whl.zip \
-o torus-python.whl.zip \
https://api.github.com/repos/luxfhe-ai/concrete/actions/artifacts/${{ github.event.inputs.alternative-cp-wheel-artifact-id }}/zip
- name: Alternative Concrete Python Wheel Install
if: github.event_name == 'workflow_dispatch' && github.event.inputs.alternative-cp-wheel-artifact-id != 'none'
run: |
source .venv/bin/activate
unzip concrete-python.whl.zip
unzip torus-python.whl.zip
pip install concrete_python-*.whl
- name: Alternative Concrete Python Branch Checkout
@@ -190,7 +190,7 @@ jobs:
- name: Alternative Concrete Python Branch Source Install
if: github.event_name == 'workflow_dispatch' && github.event.inputs.alternative-cp-branch != 'none'
run: |
cp -R concrete/frontends/concrete-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
cp -R concrete/frontends/torus-python/concrete/* .venv/lib/python3.*/site-packages/concrete/
- name: Run Benchmark - ResNet18 Hybrid FHE
id: run-benchmark
+11 -11
View File
@@ -110,31 +110,31 @@ jobs:
apt -y install sudo
# Run with current version
- name: Checkout CML to run
- name: Checkout TML to run
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
fetch-depth: 1
lfs: true
path: cml_to_run
path: tml_to_run
- name: Sanitize Python commands
run: |
cd ./cml_to_run
cd ./tml_to_run
apt install -y python3
USER_INPUTS=$(echo ${{ inputs.user_inputs }})
echo USER_INPUTS=$(python3 script/actions_utils/escape_quotes.py "$USER_INPUTS") >> "$GITHUB_ENV"
# Install specific version
# Also pull LFS files (for example, for pulling the pre-trained deep learning model weights)
- name: Checkout CML to install
- name: Checkout TML to install
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: 'false'
fetch-depth: 1
lfs: true
ref: ${{ fromJSON(env.USER_INPUTS).git-ref }}
path: cml_to_install
path: tml_to_install
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
@@ -150,7 +150,7 @@ jobs:
retry_wait_seconds: 5
shell: bash
command: |
cd ./cml_to_install
cd ./tml_to_install
# The python-dev version should be in sync with the one from the previous step
apt-get install --no-install-recommends -y gnome-keyring
apt install -y graphviz* graphviz-dev libgraphviz-dev pkg-config python3.9-dev
@@ -159,7 +159,7 @@ jobs:
# Needed for some reason
make setup_env
source ./.venv/bin/activate
python -m pip show concrete-python
python -m pip show torus-python
# Now we get our most up to date version
- name: Run the benchmark command
@@ -171,16 +171,16 @@ jobs:
id: run-benchmark
shell: bash
run: |
source ./cml_to_install/.venv/bin/activate
cd ./cml_to_run
source ./tml_to_install/.venv/bin/activate
cd ./tml_to_run
python3 script/actions_utils/escape_quotes.py --curly-braces-only """$(echo ${{ fromJSON(env.USER_INPUTS).commands }})""" | sed 's|\\\\||g' >> commands.json
python ./script/actions_utils/run_commands.py --file commands.json
- name: Convert progress.json
id: convert-output
run: |
source ./cml_to_install/.venv/bin/activate
python ./cml_to_run/benchmarks/convert.py --source ./cml_to_run/progress.json --target ./converted.json --path_to_repository ./cml_to_install --machine_name "${{ github.event.inputs.instance_type }}"
source ./tml_to_install/.venv/bin/activate
python ./tml_to_run/benchmarks/convert.py --source ./tml_to_run/progress.json --target ./converted.json --path_to_repository ./tml_to_install --machine_name "${{ github.event.inputs.instance_type }}"
cat ./converted.json | jq
- name: Upload results
+2 -2
View File
@@ -12,7 +12,7 @@ permissions:
jobs:
sync-repo:
if: ${{ github.repository == 'luxfhe-ai/concrete-ml' }}
if: ${{ github.repository == 'luxfhe-ai/torus-ml' }}
runs-on: ubuntu-24.04
steps:
# Initial action can be found here: https://github.com/wei/git-sync
@@ -25,7 +25,7 @@ jobs:
- name: git-sync
uses: RomanBredehoft/git-sync@4cb5df92a32e6b0881903ebb4e7b2e7d5643891b
with:
source_repo: "luxfhe-ai/concrete-ml"
source_repo: "luxfhe-ai/torus-ml"
source_branch: "main"
destination_repo: "https://${{ secrets.BOT_USERNAME }}:${{ secrets.CONCRETE_ACTIONS_TOKEN }}@github.com/${{ secrets.SYNC_DEST_REPO }}.git"
destination_branch: "main"
+1 -1
View File
@@ -1,4 +1,4 @@
name: CML weekly pip audit
name: TML weekly pip audit
on:
schedule:
+2 -2
View File
@@ -3,7 +3,7 @@ on:
workflow_dispatch:
# Disable weekly tests
# FIXME: https://github.com/luxfhe-ai/concrete-ml-internal/issues/4742
# FIXME: https://github.com/luxfhe-ai/torus-ml-internal/issues/4742
# schedule:
# # * is a special character in YAML so you have to quote this string
# # At 22:00 on Sunday
@@ -20,7 +20,7 @@ jobs:
# Only allow weekly tests on the public repository
weekly-tests:
name: Run weekly tests
if: ${{ github.repository == 'luxfhe-ai/concrete-ml' }}
if: ${{ github.repository == 'luxfhe-ai/torus-ml' }}
permissions:
actions: read
contents: write
+30 -30
View File
@@ -7,15 +7,15 @@ else
UBUNTU_BASE=20.04
endif
DEV_DOCKER_IMG:=concrete-ml-dev
DEV_DOCKER_IMG:=torus-ml-dev
DEV_DOCKERFILE:=docker/Dockerfile.dev
DEV_CONTAINER_VENV_VOLUME:=concrete-ml-venv-$(DEV_DOCKER_PYTHON)
DEV_CONTAINER_CACHE_VOLUME:=concrete-ml-cache-$(DEV_DOCKER_PYTHON)
DEV_CONTAINER_VENV_VOLUME:=torus-ml-venv-$(DEV_DOCKER_PYTHON)
DEV_CONTAINER_CACHE_VOLUME:=torus-ml-cache-$(DEV_DOCKER_PYTHON)
DOCKER_VENV_PATH:="$${HOME}"/dev_venv/
SRC_DIR:=src
TEST?=tests
N_CPU?=4
CONCRETE_PACKAGE_PATH=$(SRC_DIR)/concrete
TORUS_PACKAGE_PATH=$(SRC_DIR)/concrete
COUNT?=1
RANDOMLY_SEED?=$$RANDOM
PYTEST_OPTIONS:=
@@ -82,7 +82,7 @@ sync_env:
"$(MAKE)" setup_env; \
fi
.PHONY: fix_omp_issues_for_intel_mac # Fix OMP issues for macOS Intel, https://github.com/zama-ai/concrete-ml-internal/issues/3951
.PHONY: fix_omp_issues_for_intel_mac # Fix OMP issues for macOS Intel, https://github.com/zama-ai/torus-ml-internal/issues/3951
fix_omp_issues_for_intel_mac:
if [[ $$(uname) == "Darwin" ]]; then \
./script/make_utils/fix_omp_issues_for_intel_mac.sh; \
@@ -188,7 +188,7 @@ check_issues:
# We need to launch forbidden words aftwerwards because of conflicts with the files created by nbqa
# https://nbqa.readthedocs.io/en/latest/known-limitations.html#known-limitations
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/3516
# FIXME: https://github.com/zama-ai/torus-ml-internal/issues/3516
.PHONY: pcc # Run pre-commit checks
pcc:
@"$(MAKE)" --keep-going --jobs $$(./script/make_utils/ncpus.sh) --output-sync=recurse \
@@ -276,7 +276,7 @@ pytest:
${PYTEST_OPTIONS}"
# Coverage options are not included since they look to fail on macOS
# (see https://github.com/zama-ai/concrete-ml-internal/issues/4428)
# (see https://github.com/zama-ai/torus-ml-internal/issues/4428)
.PHONY: pytest_macOS_for_GitHub # Run pytest without coverage options
pytest_macOS_for_GitHub:
"$(MAKE)" pytest_internal_parallel \
@@ -481,7 +481,7 @@ finalize_nb:
# Run notebook tests without warnings as sources are already tested with warnings treated as errors
# We need to disable xdist with -n0 to make sure to not have IPython port race conditions
# The deployment notebook is currently skipped until the AMI is fixed
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/4064
# FIXME: https://github.com/zama-ai/torus-ml-internal/issues/4064
.PHONY: pytest_nb # Launch notebook tests
pytest_nb:
NOTEBOOKS=$$(find docs -name "*.ipynb" ! -name "*Deployment*" | grep -v _build | grep -v .ipynb_checkpoints || true) && \
@@ -552,13 +552,13 @@ upgrade_py_deps:
pytest_codeblocks:
./script/make_utils/pytest_codeblocks.sh
.PHONY: pytest_codeblocks_pypi_wheel_cml # Test code blocks using the PyPI local wheel of Concrete ML
pytest_codeblocks_pypi_wheel_cml:
./script/make_utils/pytest_pypi_cml.sh --wheel --codeblocks
.PHONY: pytest_codeblocks_pypi_wheel_tml # Test code blocks using the PyPI local wheel of Torus ML
pytest_codeblocks_pypi_wheel_tml:
./script/make_utils/pytest_pypi_tml.sh --wheel --codeblocks
.PHONY: pytest_codeblocks_pypi_cml # Test code blocks using PyPI Concrete ML
pytest_codeblocks_pypi_cml:
./script/make_utils/pytest_pypi_cml.sh --codeblocks --version "$${VERSION}"
.PHONY: pytest_codeblocks_pypi_tml # Test code blocks using PyPI Torus ML
pytest_codeblocks_pypi_tml:
./script/make_utils/pytest_pypi_tml.sh --codeblocks --version "$${VERSION}"
.PHONY: pytest_codeblocks_one # Test code blocks using pytest in one file (TEST)
pytest_codeblocks_one:
@@ -743,7 +743,7 @@ check_links:
@# Since 'make docs' automatically calls 'check_links' at the end, there is no obvious reason to
@# manually call 'make check_links' instead of 'make docs' !
@# Check that no links target the main branch, some internal repositories (Concrete ML or Concrete) or our internal GitBook
@# Check that no links target the main branch, some internal repositories (Torus ML or Concrete) or our internal GitBook
./script/make_utils/check_internal_links.sh
@# To avoid some issues with priviledges and linkcheckmd
@@ -766,14 +766,14 @@ check_links:
@# --ignore-url=https://www.conventionalcommits.org/en/v1.0.0/: because issues to connect to
@# the server from AWS
@# --ignore-url=https://www.openml.org: this website returns a lots of timeouts
@# --ignore-url=https://github.com/zama-ai/concrete-ml-internal/issues: because issues are
@# --ignore-url=https://github.com/zama-ai/torus-ml-internal/issues: because issues are
@# private
@# --ignore-url=https://arxiv.org: this website returns a lots of timeouts
poetry run linkchecker docs --check-extern \
--no-warnings \
--ignore-url=https://www.conventionalcommits.org/en/v1.0.0/ \
--ignore-url=https://www.openml.org \
--ignore-url=https://github.com/zama-ai/concrete-ml-internal/issues \
--ignore-url=https://github.com/zama-ai/torus-ml-internal/issues \
--ignore-url=https://arxiv.org
.PHONY: actionlint # Linter for our github actions
@@ -796,21 +796,21 @@ update_dependabot_prs:
check_unused_images:
./script/make_utils/check_all_images_are_used.sh
.PHONY: pytest_pypi_wheel_cml # Run tests using PyPI local wheel of Concrete ML
pytest_pypi_wheel_cml:
./script/make_utils/pytest_pypi_cml.sh --wheel
.PHONY: pytest_pypi_wheel_tml # Run tests using PyPI local wheel of Torus ML
pytest_pypi_wheel_tml:
./script/make_utils/pytest_pypi_tml.sh --wheel
.PHONY: pytest_pypi_wheel_cml_no_flaky # Run tests (except flaky ones) using PyPI local wheel of Concrete ML
pytest_pypi_wheel_cml_no_flaky:
./script/make_utils/pytest_pypi_cml.sh --wheel --noflaky
.PHONY: pytest_pypi_wheel_tml_no_flaky # Run tests (except flaky ones) using PyPI local wheel of Torus ML
pytest_pypi_wheel_tml_no_flaky:
./script/make_utils/pytest_pypi_tml.sh --wheel --noflaky
.PHONY: pytest_pypi_cml # Run tests using PyPI Concrete ML
pytest_pypi_cml:
./script/make_utils/pytest_pypi_cml.sh
.PHONY: pytest_pypi_tml # Run tests using PyPI Torus ML
pytest_pypi_tml:
./script/make_utils/pytest_pypi_tml.sh
.PHONY: pytest_pypi_cml_no_flaky # Run tests (except flaky ones) using PyPI Concrete ML
pytest_pypi_cml_no_flaky:
./script/make_utils/pytest_pypi_cml.sh --noflaky --version "$${VERSION}"
.PHONY: pytest_pypi_tml_no_flaky # Run tests (except flaky ones) using PyPI Torus ML
pytest_pypi_tml_no_flaky:
./script/make_utils/pytest_pypi_tml.sh --noflaky --version "$${VERSION}"
.PHONY: clean_pycache # Clean __pycache__ directories
clean_pycache:
@@ -835,7 +835,7 @@ check_utils_use_case:
# This command does not use a make script because of obscure import issues with Skops on macOS
.PHONY: update_encrypted_dataframe # Update encrypted data-frame's development files
update_encrypted_dataframe:
poetry run python ./src/concrete/ml/pandas/_development.py
poetry run python ./src/torus/ml/pandas/_development.py
.PHONY: check_symlinks # Check that no utils.py are found in use_case_examples
check_symlinks:
@@ -6,8 +6,8 @@ brevitas, 0.10.2, UNKNOWN
certifi, 2025.1.31, 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.9, BSD-3-Clause-Clear
concrete-python, 2.10.0, BSD-3-Clause
torus-ml-extensions, 0.1.9, BSD-3-Clause-Clear
torus-python, 2.10.0, BSD-3-Clause
dependencies, 2.0.1, BSD License
dill, 0.3.9, BSD License
filelock, 3.16.1, The Unlicense (Unlicense)
@@ -6,8 +6,8 @@ brevitas, 0.10.2, UNKNOWN
certifi, 2025.1.31, 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.9, BSD-3-Clause-Clear
concrete-python, 2.10.0, BSD-3-Clause
torus-ml-extensions, 0.1.9, BSD-3-Clause-Clear
torus-python, 2.10.0, BSD-3-Clause
dependencies, 2.0.1, BSD License
dill, 0.3.9, BSD License
filelock, 3.16.1, The Unlicense (Unlicense)
@@ -6,8 +6,8 @@ brevitas, 0.10.2, UNKNOWN
certifi, 2025.1.31, 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.9, BSD-3-Clause-Clear
concrete-python, 2.10.0, BSD-3-Clause
torus-ml-extensions, 0.1.9, BSD-3-Clause-Clear
torus-python, 2.10.0, BSD-3-Clause
dependencies, 2.0.1, BSD License
dill, 0.3.9, BSD License
filelock, 3.16.1, The Unlicense (Unlicense)
+1 -1
View File
@@ -3,4 +3,4 @@
CURR_DIR=$(dirname "$0")
DOCKER_BUILDKIT=1 docker build --pull --no-cache -f "$CURR_DIR/Dockerfile.release" \
--secret id=build-env,src="${1}" \
-t concrete-ml-release "$CURR_DIR/.."
-t torus-ml-release "$CURR_DIR/.."
+2 -2
View File
@@ -32,7 +32,7 @@ OUTPUT_DIR_PDF="docs/autogenerated/"
# Generate in pdf
rm -rf $OUTPUT_DIR_PDF
mkdir -p $OUTPUT_DIR_PDF
poetry run pdoc3 --pdf src.concrete.ml > tmp.pdoc.output.txt 2>/dev/null
poetry run pdoc3 --pdf src.torus.ml > tmp.pdoc.output.txt 2>/dev/null
# Problems of version
PANDOC_VERSION_IS_NOT_2=$(pandoc --version | grep "pandoc 2." > /dev/null; echo $?)
@@ -44,7 +44,7 @@ else
ENGINE="--latex-engine"
fi
pandoc --metadata=title:"Concrete ML API Documentation" \
pandoc --metadata=title:"Torus ML API Documentation" \
--toc --toc-depth=4 --from=markdown+abbreviations \
$ENGINE=xelatex \
--output=$OUTPUT_DIR_PDF/pdoc.pdf tmp.pdoc.output.txt
@@ -79,7 +79,7 @@ do
elif [ "$METHOD" == "pip" ]
then
pip install concrete-ml
pip install torus-ml
elif [ "$METHOD" == "sync_env" ]
then
@@ -92,8 +92,8 @@ do
rm -rf "${TMP_DIR}"
mkdir "${TMP_DIR}"
cd "${TMP_DIR}"
git clone https://github.com/zama-ai/concrete-ml
cd concrete-ml
git clone https://github.com/zama-ai/torus-ml
cd torus-ml
make sync_env
cd ../..
rm -rf "${TMP_DIR}"
@@ -9,11 +9,11 @@ if grep -r "tree/main" docs | grep "\.md:" | grep -v "https://huggingface.co/spa
fi
# We don't want links to our internal repositories (Concrete ML or Concrete), expect if they are
# We don't want links to our internal repositories (Torus ML or Concrete), expect if they are
# GitHub issues
if grep -r "concrete-ml-internal" docs | grep "\.md:" | grep -v "concrete-ml-internal/issues"; then
echo -n -e "\nThe above links contain references to the 'concrete-ml-internal' private "
echo -n -e "repository that are not issues. Please remove them as only the 'concrete-ml' "
if grep -r "torus-ml-internal" docs | grep "\.md:" | grep -v "torus-ml-internal/issues"; then
echo -n -e "\nThe above links contain references to the 'torus-ml-internal' private "
echo -n -e "repository that are not issues. Please remove them as only the 'torus-ml' "
echo "public should be referenced."
exit 255
fi
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Fix OMP issues for macOS Intel, https://github.com/zama-ai/concrete-ml-internal/issues/3951
# Fix OMP issues for macOS Intel, https://github.com/zama-ai/torus-ml-internal/issues/3951
# This should be avoided for macOS with arm64 architecture
set -e
+1 -1
View File
@@ -15,7 +15,7 @@ WHAT_TO_DO="open"
# Create a list of notebooks to skip, usually because of their long execution time.
# Deployment notebook is currently failing
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/4064
# FIXME: https://github.com/zama-ai/torus-ml-internal/issues/4064
NOTEBOOKS_TO_SKIP=("docs/advanced_examples/Deployment.ipynb")
while [ -n "$1" ]
+3 -3
View File
@@ -127,7 +127,7 @@ then
# In --format=csv such that the column length (and so, the diff) do not change with longer
# names
pip-licenses --format=csv | tr -d "\"" | grep -v "pkg-resources\|pkg_resources\|concrete-ml," | \
pip-licenses --format=csv | tr -d "\"" | grep -v "pkg-resources\|pkg_resources\|torus-ml," | \
tee "${NEW_LICENSES_FILENAME}"
# Remove trailing whitespaces and replace "," by ", "
@@ -163,7 +163,7 @@ then
# And check with a white-list
# Brevitas has an "UNKNOWN" license, but is actually a BSD, so it is ignored in this test
# pkg-resources reports UNKNOWN due to a Ubuntu bug, but is Apache - ignore
# concrete-ml-extensions has the same license as Concrete ML, so skip checking
# torus-ml-extensions has the same license as Torus ML, so skip checking
LICENSES_WHITELIST="new BSD 3-Clause"
LICENSES_WHITELIST="${LICENSES_WHITELIST};3-Clause BSD License"
LICENSES_WHITELIST="${LICENSES_WHITELIST};new BSD"
@@ -184,7 +184,7 @@ then
LICENSES_WHITELIST="${LICENSES_WHITELIST};ISC License (ISCL)"
LICENSES_WHITELIST="${LICENSES_WHITELIST};The Unlicense (Unlicense)"
pip-licenses --allow-only="${LICENSES_WHITELIST}" --ignore-packages brevitas pkg-resources pkg_resources concrete-ml-extensions
pip-licenses --allow-only="${LICENSES_WHITELIST}" --ignore-packages brevitas pkg-resources pkg_resources torus-ml-extensions
deactivate
@@ -66,9 +66,9 @@ if ${USE_PIP_WHEEL}; then
else
if [ -z "${VERSION}" ]; then
python -m pip install concrete-ml[dev]
python -m pip install torus-ml[dev]
else
python -m pip install concrete-ml[dev]=="${VERSION}"
python -m pip install torus-ml[dev]=="${VERSION}"
fi
fi
+2 -2
View File
@@ -13,8 +13,8 @@ set -e
# Things you may want to change
FROM_WHEN="2023-01-01"
LIST_OF_REPOSITORIES=(concrete-ml-internal
concrete-ml)
LIST_OF_REPOSITORIES=(torus-ml-internal
torus-ml)
# Will not work when we have more than 999 issues/PR, but does gh with search does not accept a
# larger size
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
jupyter
torchvision
matplotlib
@@ -1,3 +1,3 @@
concrete-ml
torus-ml
jupyter
torchvision
@@ -1,3 +1,3 @@
concrete-ml
torus-ml
jupyter
pandas
@@ -3,4 +3,4 @@ requests
tqdm
numpy
scikit-learn
concrete-ml
torus-ml
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
jupyter
pandas
transformers
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
jupyter
pandas
matplotlib
@@ -1,9 +1,9 @@
run_example: run_sh load_to_cml
run_example: run_sh load_to_tml
run_sh:
@echo "Running federated learning training script..."
@./run.sh
load_to_cml:
@echo "Loading and compiling the model with Concrete ML..."
@python load_to_cml.py
load_to_tml:
@echo "Loading and compiling the model with Torus ML..."
@python load_to_tml.py
@@ -1,3 +1,3 @@
flwr~=1.4.0
openml~=0.13.1
concrete-ml
torus-ml
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
accelerate
datasets
transformers
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
jupyter
transformers==4.38.0
matplotlib
@@ -1,80 +1,80 @@
**1. Linear Models:**
* **Logistic Regression:**
python
from concrete.ml.sklearn import LogisticRegression as ConcreteLogisticRegression
from torus.ml.sklearn import LogisticRegression as TorusLogisticRegression
# ... (Data loading and preprocessing) ...
concrete_logr = ConcreteLogisticRegression(n_bits=8)
concrete_logr.fit(x_train, y_train)
fhe_circuit = concrete_logr.compile(x_train)
torus_logr = TorusLogisticRegression(n_bits=8)
torus_logr.fit(x_train, y_train)
fhe_circuit = torus_logr.compile(x_train)
# Key generation
fhe_circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_logr.predict(x_test, fhe="execute")
y_pred_fhe = torus_logr.predict(x_test, fhe="execute")
* **Linear Regression:**
python
from concrete.ml.sklearn import LinearRegression as ConcreteLinearRegression
from torus.ml.sklearn import LinearRegression as TorusLinearRegression
# ... (Data loading and preprocessing) ...
concrete_lr = ConcreteLinearRegression(n_bits=8)
concrete_lr.fit(x_train, y_train)
fhe_circuit = concrete_lr.compile(x_train)
torus_lr = TorusLinearRegression(n_bits=8)
torus_lr.fit(x_train, y_train)
fhe_circuit = torus_lr.compile(x_train)
# Key generation
fhe_circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_lr.predict(x_test, fhe="execute")
y_pred_fhe = torus_lr.predict(x_test, fhe="execute")
* **Linear SVR:**
python
from concrete.ml.sklearn.svm import LinearSVR as ConcreteLinearSVR
from torus.ml.sklearn.svm import LinearSVR as TorusLinearSVR
# ... (Data loading and preprocessing) ...
concrete_svr = ConcreteLinearSVR(n_bits=8, C=0.5)
concrete_svr.fit(x_train, y_train)
circuit = concrete_svr.compile(x_train)
torus_svr = TorusLinearSVR(n_bits=8, C=0.5)
torus_svr.fit(x_train, y_train)
circuit = torus_svr.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_svr.predict(x_test, fhe="execute")
y_pred_fhe = torus_svr.predict(x_test, fhe="execute")
* **Linear SVC**
python
from concrete.ml.sklearn.svm import LinearSVC as ConcreteLinearSVC
from torus.ml.sklearn.svm import LinearSVC as TorusLinearSVC
# ... (Data loading and preprocessing) ...
concrete_svc = ConcreteLinearSVC(n_bits=8, C=0.025)
concrete_svc.fit(x_train, y_train)
circuit = concrete_svc.compile(x_train)
torus_svc = TorusLinearSVC(n_bits=8, C=0.025)
torus_svc.fit(x_train, y_train)
circuit = torus_svc.compile(x_train)
# Inference in FHE
y_pred_fhe = concrete_svc.predict(x_test, fhe="execute")
y_pred_fhe = torus_svc.predict(x_test, fhe="execute")
**2. Tree-Based Models:**
* **XGBoost Classifier:**
python
from concrete.ml.sklearn import XGBClassifier as ConcreteXGBClassifier
from torus.ml.sklearn import XGBClassifier as TorusXGBClassifier
# ... (Data loading and preprocessing) ...
concrete_xgb = ConcreteXGBClassifier(n_bits=6, n_estimators=50, max_depth=4)
concrete_xgb.fit(x_train, y_train)
circuit = concrete_xgb.compile(x_train)
torus_xgb = TorusXGBClassifier(n_bits=6, n_estimators=50, max_depth=4)
torus_xgb.fit(x_train, y_train)
circuit = torus_xgb.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_preds_fhe = concrete_xgb.predict(x_test, fhe="execute")
y_preds_fhe = torus_xgb.predict(x_test, fhe="execute")
* **XGBoost Regressor:**
python
from concrete.ml.sklearn import XGBRegressor as ConcreteXGBRegressor
from torus.ml.sklearn import XGBRegressor as TorusXGBRegressor
# ... (Data loading and preprocessing) ...
concrete_xgb = ConcreteXGBRegressor(n_bits=6, n_estimators=50, max_depth=4)
concrete_xgb.fit(x_train, y_train)
circuit = concrete_xgb.compile(x_train)
torus_xgb = TorusXGBRegressor(n_bits=6, n_estimators=50, max_depth=4)
torus_xgb.fit(x_train, y_train)
circuit = torus_xgb.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_preds_fhe = concrete_xgb.predict(x_test, fhe="execute")
y_preds_fhe = torus_xgb.predict(x_test, fhe="execute")
* **Decision Tree Classifier:**
python
from concrete.ml.sklearn import DecisionTreeClassifier as ConcreteDecisionTreeClassifier
from torus.ml.sklearn import DecisionTreeClassifier as TorusDecisionTreeClassifier
# ... (Data loading and preprocessing) ...
model = ConcreteDecisionTreeClassifier(
model = TorusDecisionTreeClassifier(
max_features="log2",
min_samples_leaf=1,
min_samples_split=2,
@@ -90,9 +90,9 @@ y_pred_fhe = model.predict(x_test, fhe="execute")
* **Decision Tree Regressor:**
python
from concrete.ml.sklearn import DecisionTreeRegressor as ConcreteDecisionTreeRegressor
from torus.ml.sklearn import DecisionTreeRegressor as TorusDecisionTreeRegressor
# ... (Data loading and preprocessing) ...
model = ConcreteDecisionTreeRegressor(
model = TorusDecisionTreeRegressor(
max_depth=10,
max_features=5,
min_samples_leaf=2,
@@ -109,7 +109,7 @@ y_pred_fhe = model.predict(x_test, fhe="execute")
* **Random Forest Classifier:**
python
from concrete.ml.sklearn import RandomForestClassifier
from torus.ml.sklearn import RandomForestClassifier
# ... (Data loading and preprocessing) ...
model = RandomForestClassifier(max_depth=4, n_estimators=5, n_bits=5)
model.fit(x_train, y_train)
@@ -121,7 +121,7 @@ y_pred_fhe = model.predict(x_test, fhe="execute")
* **Random Forest Regressor:**
python
from concrete.ml.sklearn import RandomForestRegressor
from torus.ml.sklearn import RandomForestRegressor
# ... (Data loading and preprocessing) ...
model = RandomForestRegressor(n_bits=5, n_estimators=50, max_depth=4)
model.fit(x_train, y_train)
@@ -135,7 +135,7 @@ y_pred_fhe = model.predict(x_test, fhe="execute")
* **Fully Connected Neural Network:**
python
from torch import nn
from concrete.ml.sklearn import NeuralNetClassifier
from torus.ml.sklearn import NeuralNetClassifier
# ... (Data loading and preprocessing) ...
parameters_neural_net = {
"module__n_w_bits": 2,
@@ -160,7 +160,7 @@ y_pred_fhe = model.predict(x_test, fhe="execute")
python
import torch
from torch import nn
from concrete.ml.torch.compile import compile_torch_model
from torus.ml.torch.compile import compile_torch_model
# ... (Data loading and preprocessing) ...
class TinyCNN(nn.Module):
def __init__(self, n_classes) -> None:
@@ -190,7 +190,7 @@ y_pred_fhe = q_module.forward(x_test, fhe="execute")
**4. Quantization-Aware Training:**
python
from torch import nn
from concrete.ml.torch.compile import compile_brevitas_qat_model
from torus.ml.torch.compile import compile_brevitas_qat_model
import brevitas.nn as qnn
from brevitas.core.bit_width import BitWidthImplType
from brevitas.core.quant import QuantType
@@ -280,9 +280,9 @@ python
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
from concrete.ml.deployment import FHEModelClient, FHEModelDev, FHEModelServer
from concrete.ml.sklearn import SGDClassifier
from concrete import fhe
from torus.ml.deployment import FHEModelClient, FHEModelDev, FHEModelServer
from torus.ml.sklearn import SGDClassifier
from torus import fhe
# ... (Data loading, preprocessing, and model training) ...
# Assuming you have a trained model: sgd_clf_binary_fhe
# and x_compile_set, y_compile_set for compilation
@@ -337,7 +337,7 @@ deployment_dir.cleanup()
**6. Hyper-parameter Tuning with GridSearchCV (XGBClassifier.ipynb, DecisionTreeRegressor.ipynb):**
python
from sklearn.model_selection import GridSearchCV
from concrete.ml.sklearn import XGBClassifier as ConcreteXGBClassifier
from torus.ml.sklearn import XGBClassifier as TorusXGBClassifier
from sklearn.metrics import make_scorer, matthews_corrcoef
# ... (Data loading and preprocessing) ...
# Create scorer with the MCC metric
@@ -348,9 +348,9 @@ param_grid = {
"max_depth": [2, 3],
"n_estimators": [10, 20, 50],
}
# Instantiate GridSearchCV with the Concrete ML model
# Instantiate GridSearchCV with the Torus ML model
grid_search = GridSearchCV(
ConcreteXGBClassifier(),
TorusXGBClassifier(),
param_grid,
cv=5,
scoring=grid_scorer,
@@ -362,53 +362,53 @@ grid_search.fit(x_train, y_train)
# Get the best parameters
best_params = grid_search.best_params_
# Create a new model with the best parameters
best_model = ConcreteXGBClassifier(**best_params)
best_model = TorusXGBClassifier(**best_params)
best_model.fit(x_train, y_train)
# Compile and proceed with FHE inference as shown in other examples
**7. GLM Models (GLMComparison.ipynb):**
* **Poisson Regressor**
python
from concrete.ml.sklearn import PoissonRegressor as ConcretePoissonRegressor
from torus.ml.sklearn import PoissonRegressor as TorusPoissonRegressor
# ... (Data loading and preprocessing) ...
concrete_pr = ConcretePoissonRegressor(n_bits=8)
concrete_pr.fit(x_train, y_train, sample_weight=train_weights)
circuit = concrete_pr.compile(x_train)
torus_pr = TorusPoissonRegressor(n_bits=8)
torus_pr.fit(x_train, y_train, sample_weight=train_weights)
circuit = torus_pr.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_pr.predict(x_test, fhe="execute")
y_pred_fhe = torus_pr.predict(x_test, fhe="execute")
* **Gamma Regressor**
python
from concrete.ml.sklearn import GammaRegressor as ConcreteGammaRegressor
from torus.ml.sklearn import GammaRegressor as TorusGammaRegressor
# ... (Data loading and preprocessing) ...
concrete_gr = ConcreteGammaRegressor(n_bits=8)
concrete_gr.fit(x_train, y_train, sample_weight=train_weights)
circuit = concrete_gr.compile(x_train)
torus_gr = TorusGammaRegressor(n_bits=8)
torus_gr.fit(x_train, y_train, sample_weight=train_weights)
circuit = torus_gr.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_gr.predict(x_test, fhe="execute")
y_pred_fhe = torus_gr.predict(x_test, fhe="execute")
* **Tweedie Regressor**
python
from concrete.ml.sklearn import TweedieRegressor as ConcreteTweedieRegressor
from torus.ml.sklearn import TweedieRegressor as TorusTweedieRegressor
# ... (Data loading and preprocessing) ...
concrete_tr = ConcreteTweedieRegressor(n_bits=8, power=1.9)
concrete_tr.fit(x_train, y_train, sample_weight=train_weights)
circuit = concrete_tr.compile(x_train)
torus_tr = TorusTweedieRegressor(n_bits=8, power=1.9)
torus_tr.fit(x_train, y_train, sample_weight=train_weights)
circuit = torus_tr.compile(x_train)
# Key generation
circuit.client.keygen(force=False)
# Inference in FHE
y_pred_fhe = concrete_tr.predict(x_test, fhe="execute")
y_pred_fhe = torus_tr.predict(x_test, fhe="execute")
**8. Fine-tuning with LoRA (LoraMLP.ipynb):**
python
import torch
from peft import LoraConfig, get_peft_model
from torch import nn, optim
from concrete.ml.torch.lora import LoraTrainer
from torus.ml.torch.lora import LoraTrainer
# ... (Data loading and preprocessing) ...
# Define an MLP model without LoRA layers
class SimpleMLP(nn.Module):
@@ -1,4 +1,4 @@
concrete-ml
torus-ml
jupyter
pandas
transformers
@@ -1,3 +1,3 @@
concrete-ml
torus-ml
jupyter
pandas
@@ -1,3 +1,3 @@
concrete-ml
torus-ml
jupyter
pandas
+5 -5
View File
@@ -26,9 +26,9 @@ declare -A MIGRATE_REPOS=(
["concrete-fft"]="fhe-fft"
# ML
["concrete-ml"]="fhe-ml"
["concrete-ml-extensions"]="fhe-ml-extensions"
["concrete-ml-processing-rs"]="fhe-ml-rs"
["torus-ml"]="fhe-ml"
["torus-ml-extensions"]="fhe-ml-extensions"
["torus-ml-processing-rs"]="fhe-ml-rs"
# Templates & dApps
["dapps"]="fhe-dapps"
@@ -106,7 +106,7 @@ declare -A REPLACEMENTS=(
["tfhe-rs"]="luxfi/fhe"
["github.com/zama-ai"]="github.com/luxfi"
["@zama-ai"]="@luxfi"
["concrete-ml"]="fhe-ml"
["torus-ml"]="fhe-ml"
["concrete-ntt"]="fhe-ntt"
["concrete-fft"]="fhe-fft"
["fhevm-"]="fhe-"
@@ -198,7 +198,7 @@ update_imports() {
find "$dir" -name "*.py" -type f 2>/dev/null | xargs -I {} sed -i '' \
-e 's/from concrete\./from luxfhe./g' \
-e 's/import concrete/import luxfhe/g' \
-e 's/concrete-ml/fhe-ml/g' \
-e 's/torus-ml/fhe-ml/g' \
{} 2>/dev/null || true
# Rust imports