chore: rename package

This commit is contained in:
Arthur Meyre
2022-01-05 12:40:01 +01:00
parent c7b9380b4c
commit e2fc523596
50 changed files with 157 additions and 157 deletions

View File

@@ -2,7 +2,7 @@
name: New Operator
about: Organise the support of a new operator or notion in the framework.
labels: feature
title: Support of **please-fill** in Concrete Framework
title: Support of **please-fill** in Concrete Numpy
---
## Umbrella

View File

@@ -1,4 +1,4 @@
name: concrete-framework CI Pipeline
name: concrete-numpy CI Pipeline
on:
pull_request:
push:
@@ -28,10 +28,10 @@ on:
env:
FORCE_REBUILD_DOCKER: ${{ (github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.rebuild-env-docker)) || (github.event_name == 'repository_dispatch' && github.event.action == 'rebuild-env-docker') }}
ENV_DOCKERFILE: docker/Dockerfile.concrete-framework-env
PREFLIGHT_IMAGE_BASE: ghcr.io/zama-ai/concrete-framework-env:preflight
LATEST_IMAGE: ghcr.io/zama-ai/concrete-framework-env:latest
BASE_IMAGE: ghcr.io/zama-ai/concrete-framework-env
ENV_DOCKERFILE: docker/Dockerfile.env
PREFLIGHT_IMAGE_BASE: ghcr.io/zama-ai/concrete-numpy-env:preflight
LATEST_IMAGE: ghcr.io/zama-ai/concrete-numpy-env:latest
BASE_IMAGE: ghcr.io/zama-ai/concrete-numpy-env
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
IS_PR: ${{ github.event_name == 'pull_request' }}
@@ -41,7 +41,7 @@ jobs:
group: ${{ github.ref }}
cancel-in-progress: true
name: Build & Push the concrete-framework-env preflight Docker Image
name: Build & Push the concrete-numpy-env preflight Docker Image
runs-on: ubuntu-20.04
outputs:
image: ${{ steps.set_image.outputs.image || env.LATEST_IMAGE }}
@@ -91,7 +91,7 @@ jobs:
echo "Docker image up to date."
echo "BUILD_DOCKER=false" >> "$GITHUB_ENV"
fi
# https://github.com/zama-ai/concrete-framework-internal/issues/809
# https://github.com/zama-ai/concrete-numpy-internal/issues/809
# Remove gh_dl_release call once package is on PyPi
- name: Set prefligh Docker image download compiler
id: set_image
@@ -124,7 +124,7 @@ jobs:
registry: ghcr.io
username: ${{ secrets.BOT_USERNAME }}
password: ${{ secrets.BOT_TOKEN }}
- name: Build concrete-framework-env Image
- name: Build concrete-numpy-env Image
if: ${{ success() && !cancelled() && fromJSON(env.BUILD_DOCKER) }}
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229
with:
@@ -132,12 +132,12 @@ jobs:
# builder: ${{ steps.buildx.outputs.name }}
build-args: |
WHEEL=${{ env.WHEEL }}
file: docker/Dockerfile.concrete-framework-env
file: docker/Dockerfile.env
no-cache: true
push: true
tags: "${{ env.PREFLIGHT_IMAGE }}"
labels: |
concrete_framework_sha=${{ env.LABEL_SHA1 }}
concrete_numpy_sha=${{ env.LABEL_SHA1 }}
- name: Set notification report
id: report
if: ${{ always() }}
@@ -443,7 +443,7 @@ jobs:
echo "::set-output name=has-preprod::true"
echo "::set-output name=aws-bucket::${{ secrets.AWS_REPO_PREPROD_DOCUMENTATION_BUCKET_NAME }}"
echo "::set-output name=aws-distribution::${{ secrets.AWS_REPO_PREPROD_DOCUMENTATION_DISTRIBUTION_ID }}"
echo "::set-output name=dest-dir::concrete-framework/${REF_NAME}"
echo "::set-output name=dest-dir::concrete-numpy/${REF_NAME}"
else
echo "::set-output name=has-preprod::false"
fi
@@ -536,9 +536,9 @@ jobs:
- name: Pull preflight image
run: |
docker pull "${PREFLIGHT_IMAGE}"
# https://github.com/zama-ai/concrete-framework-internal/issues/809
# https://github.com/zama-ai/concrete-numpy-internal/issues/809
# update once release workflow is ok on the compiler side
- name: Retag to latest and concrete_compiler_version-concrete_framework_sha1 and push
- name: Retag to latest and concrete_compiler_version-concrete_numpy_sha1 and push
run: |
SHA1=$(git rev-parse HEAD)
TAGGED_IMAGE="${BASE_IMAGE}:${COMPILER_TAG}-${SHA1}"
@@ -584,7 +584,7 @@ jobs:
runs-on: ubuntu-20.04
env:
RELEASE_IMAGE_BASE: ghcr.io/zama-ai/concrete-framework
RELEASE_IMAGE_BASE: ghcr.io/zama-ai/concrete-numpy
steps:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
@@ -618,7 +618,7 @@ jobs:
EXISTING_TAGS=$(curl \
-X GET \
-H "Authorization: Bearer $(echo ${{ secrets.BOT_TOKEN }} | base64)" \
https://ghcr.io/v2/zama-ai/concrete-framework/tags/list | jq -rc '.tags | join(" ")')
https://ghcr.io/v2/zama-ai/concrete-numpy/tags/list | jq -rc '.tags | join(" ")')
# We want the space separated list of versions to be expanded
# shellcheck disable=SC2086
@@ -648,7 +648,7 @@ jobs:
registry: ghcr.io
username: ${{ secrets.BOT_USERNAME }}
password: ${{ secrets.BOT_TOKEN }}
- name: Build concrete-framework Image
- name: Build concrete-numpy Image
if: ${{ success() && !cancelled() }}
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229
with:
@@ -730,7 +730,7 @@ jobs:
aws s3api get-object \
--bucket ${{ steps.docs-push-infos.outputs.aws-bucket }} \
--key concrete-framework/versions.json "${DOWNLOADED_VERSIONS_JSON_FILE}"
--key concrete-numpy/versions.json "${DOWNLOADED_VERSIONS_JSON_FILE}"
# shellcheck disable=SC2086
poetry run python ./script/actions_utils/generate_versions_json.py \
@@ -765,7 +765,7 @@ jobs:
cp ./script/actions_utils/RELEASE_TEMPLATE.md "${RELEASE_BODY_FILE}"
{
echo "Docker Image: ${RELEASE_IMG_GIT_TAG}";
echo "Documentation: https://${{ steps.docs-push-infos.outputs.aws-bucket }}/concrete-framework/${PROJECT_VERSION}";
echo "Documentation: https://${{ steps.docs-push-infos.outputs.aws-bucket }}/concrete-numpy/${PROJECT_VERSION}";
echo "";
} >> "${RELEASE_BODY_FILE}"
cat "${RAW_CHANGELOG_DIR}"/* >> "${RELEASE_BODY_FILE}"
@@ -778,7 +778,7 @@ jobs:
env:
AWS_S3_BUCKET: ${{ steps.docs-push-infos.outputs.aws-bucket }}
SOURCE_DIR: ${{ steps.download-docs.outputs.download-path }}
DEST_DIR: 'concrete-framework/${{ env.PROJECT_VERSION }}'
DEST_DIR: 'concrete-numpy/${{ env.PROJECT_VERSION }}'
run: |
aws s3 sync "${SOURCE_DIR}" s3://"${AWS_S3_BUCKET}/${DEST_DIR}" --delete --acl public-read
@@ -787,13 +787,13 @@ jobs:
env:
AWS_S3_BUCKET: ${{ steps.docs-push-infos.outputs.aws-bucket }}
SOURCE_DIR: ${{ steps.download-docs.outputs.download-path }}
DEST_DIR: 'concrete-framework/stable'
DEST_DIR: 'concrete-numpy/stable'
run: |
aws s3 sync "${SOURCE_DIR}" s3://"${AWS_S3_BUCKET}/${DEST_DIR}" --delete --acl public-read
- name: Invalidate CloudFront Cache for stable
if: ${{ success() && !fromJSON(env.IS_PRERELEASE) && fromJSON(env.IS_LATEST) }}
env:
SOURCE_PATH: "/concrete-framework/stable/*"
SOURCE_PATH: "/concrete-numpy/stable/*"
DISTRIBUTION_ID: ${{ steps.docs-push-infos.outputs.aws-distribution }}
run: |
aws cloudfront create-invalidation \
@@ -811,18 +811,18 @@ jobs:
tag_name: ${{ env.GIT_TAG }}
fail_on_unmatched_files: true
token: ${{ secrets.BOT_TOKEN }}
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/809
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/809
# Remove versions.html
- name: Push updated versions.html
if: ${{ success() }}
run: |
aws s3 cp "${OUTPUT_VERSIONS_HTML_FILE}" \
s3://${{ steps.docs-push-infos.outputs.aws-bucket }}/concrete-framework/versions.html \
s3://${{ steps.docs-push-infos.outputs.aws-bucket }}/concrete-numpy/versions.html \
--acl public-read
aws cloudfront create-invalidation \
--distribution-id ${{ steps.docs-push-infos.outputs.aws-distribution }} \
--paths /concrete-framework/versions.html
--paths /concrete-numpy/versions.html
- name: Set notification report
id: report
if: ${{ always() }}

View File

@@ -41,7 +41,7 @@ jobs:
--compiler-release-endpoint-url \
https://api.github.com/repos/${{ secrets.COMPILER_REPO }}/releases \
--env_img_url \
https://api.github.com/orgs/zama-ai/packages/container/concrete-framework-env/versions \
https://api.github.com/orgs/zama-ai/packages/container/concrete-numpy-env/versions \
--file "${WHEEL_SPEC}" \
--token ${{ secrets.BOT_TOKEN }} \
--github-env "$GITHUB_ENV"

View File

@@ -1,9 +1,9 @@
SHELL:=/bin/bash
DEV_DOCKER_IMG:=concrete-framework-dev
DEV_DOCKERFILE:=docker/Dockerfile.concrete-framework-dev
DEV_CONTAINER_VENV_VOLUME:=concrete-framework-internal-venv
DEV_CONTAINER_CACHE_VOLUME:=concrete-framework-internal-cache
DEV_DOCKER_IMG:=concrete-numpy-dev
DEV_DOCKERFILE:=docker/Dockerfile.dev
DEV_CONTAINER_VENV_VOLUME:=concrete-numpy-internal-venv
DEV_CONTAINER_CACHE_VOLUME:=concrete-numpy-internal-cache
SRC_DIR:=concrete
.PHONY: setup_env # Set up the environment
@@ -12,7 +12,7 @@ setup_env:
poetry run python -m pip install -U --force-reinstall setuptools
poetry install --extras full
@# This is required to be friendly in the docker and on bare systems until the package is on pip
@# https://github.com/zama-ai/concrete-framework-internal/issues/809
@# https://github.com/zama-ai/concrete-numpy-internal/issues/809
if [[ -d /pkg ]]; then \
NUM_PKG=$$(ls /pkg | wc -l); \
if [[ "$${NUM_PKG}" != "0" ]]; then \
@@ -21,7 +21,7 @@ setup_env:
fi; \
fi
@# we need to pin a specific version of numpy to avoid having license conflicts
@# see https://github.com/zama-ai/concrete-framework-internal/runs/4455022611?check_suite_focus=true for details
@# see https://github.com/zama-ai/concrete-numpy-internal/runs/4455022611?check_suite_focus=true for details
.PHONY: sync_env # Synchronise the environment
sync_env:

View File

@@ -1,10 +1,10 @@
# concrete-framework
# concrete-numpy
Concrete Framework Python API - collection of tools to FHE all the things
Concrete Numpy Python API - collection of tools to FHE all the things
<!-- TOC -->
- [concrete-framework](#concrete-framework)
- [concrete-numpy](#concrete-numpy)
- [For end users](#for-end-users)
- [Using the project](#using-the-project)
- [For developers](#for-developers)
@@ -30,11 +30,11 @@ Information about how to use Docker for development are available in [DOCKER.md]
### Documenting
Some information about how to build the documentation of `concrete-framework` are available in [DOCUMENTING.md](docs/dev/howto/DOCUMENTING.md). Notably, our documentation is pushed to [https://docs.zama.ai/concrete-framework/](https://docs.zama.ai/concrete-framework/).
Some information about how to build the documentation of `concrete-numpy` are available in [DOCUMENTING.md](docs/dev/howto/DOCUMENTING.md). Notably, our documentation is pushed to [https://docs.zama.ai/concrete-numpy/](https://docs.zama.ai/concrete-numpy/).
### Developing
Some information about our terminology and the infrastructure of `concrete-framework` are available in [TERMINOLOGY_AND_STRUCTURE.md](docs/dev/explanation/TERMINOLOGY_AND_STRUCTURE.md). An in-depth look at what is done in `concrete-framework` is available in [COMPILATION.md](docs/dev/explanation/COMPILATION.md).
Some information about our terminology and the infrastructure of `concrete-numpy` are available in [TERMINOLOGY_AND_STRUCTURE.md](docs/dev/explanation/TERMINOLOGY_AND_STRUCTURE.md). An in-depth look at what is done in `concrete-numpy` is available in [COMPILATION.md](docs/dev/explanation/COMPILATION.md).
### Contributing

View File

@@ -161,7 +161,7 @@ def eval_op_graph_bounds_on_inputset(
def generate_input_values_dict(input_data) -> Dict[int, Any]:
if num_input_nodes > 1:
return dict(enumerate(input_data))
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/772
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/772
# update this to support tuple in case of 1-input functions accepting tuples
assert_true(
not isinstance(input_data, tuple),

View File

@@ -110,7 +110,7 @@ def draw_graph(
f"{draw_graph.__name__} requires pygraphviz, install your OS graphviz distribution "
"https://pygraphviz.github.io/documentation/stable/install.html "
"and reinstall with extras: `pip install --force-reinstall "
"concrete-framework[full]`"
"concrete-numpy[full]`"
)
raise ImportError(err_msg) from e
agraph.graph_attr["rankdir"] = "TB" if vertical else "LR"

View File

@@ -477,7 +477,7 @@ def subgraph_nodes_and_values_allow_fusing(
# There *may* be a way to manage the other case by simulating the broadcast of the smaller input
# array and then concatenating/stacking the results. This is not currently doable as we don't
# have a concatenate operator on the compiler side.
# TODO: #587 https://github.com/zama-ai/concrete-framework-internal/issues/587
# TODO: #587 https://github.com/zama-ai/concrete-numpy-internal/issues/587
variable_input_node_output = cast(TensorValue, variable_input_node.outputs[0])
variable_input_node_output_size, variable_input_node_output_shape = (

View File

@@ -318,7 +318,7 @@ class GenericFunction(IntermediateNode):
op_attributes: Dict[str, Any]
_n_in: int
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/798 have a proper
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/798 have a proper
# attribute system
DEFAULT_OP_ATTRIBUTES: Dict[str, Any] = {"fusable": True}

View File

@@ -524,8 +524,8 @@ def compile_numpy_function_into_op_graph_and_measure_bounds(
# HACK
# TODO: remove this ugly hack when
# https://github.com/zama-ai/concrete-framework-internal/issues/1001 is done
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/1015
# https://github.com/zama-ai/concrete-numpy-internal/issues/1001 is done
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/1015
def hack_offset_negative_inputs_to_lookup_tables(op_graph: OPGraph) -> None:
"""Hack the op_graph to add offsets to signed inputs to TLUs.
@@ -606,8 +606,8 @@ def prepare_op_graph_for_mlir(op_graph: OPGraph):
# HACK
# TODO: remove this ugly hack when
# https://github.com/zama-ai/concrete-framework-internal/issues/1001 is done
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/1015
# https://github.com/zama-ai/concrete-numpy-internal/issues/1001 is done
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/1015
hack_offset_negative_inputs_to_lookup_tables(op_graph)

View File

@@ -650,7 +650,7 @@ def _on_numpy_matmul(lhs: NPTracer, rhs: NPTracer):
output_shape = common_output_dtypes_and_shapes[0][1]
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/1174
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/1174
# remove all the reshape logic once matmul supports more combinations of arguments
if isinstance(lhs_output := lhs.output, TensorValue) and isinstance(
rhs_output := rhs.output, TensorValue

View File

@@ -1,4 +1,4 @@
FROM ghcr.io/zama-ai/concrete-framework-env
FROM ghcr.io/zama-ai/concrete-numpy-env
ENV SRC_DIR=/src

View File

@@ -3,7 +3,7 @@ FROM ubuntu:20.04
# Do not change the line below it will be updated automatically when the docker is regenerated
# compiler timestamp: 2022-01-04T16:08:11Z
# Remove once compiler is on PyPi https://github.com/zama-ai/concrete-framework-internal/issues/809
# Remove once compiler is on PyPi https://github.com/zama-ai/concrete-numpy-internal/issues/809
ARG WHEEL
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
@@ -27,6 +27,6 @@ RUN apt-get update && apt-get upgrade --no-install-recommends -y && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir poetry
# Remove once compiler is on PyPi https://github.com/zama-ai/concrete-framework-internal/issues/809
# Remove once compiler is on PyPi https://github.com/zama-ai/concrete-numpy-internal/issues/809
WORKDIR /pkg
COPY pkg/${WHEEL} .

View File

@@ -2,4 +2,4 @@
CURR_DIR=$(dirname "$0")
DOCKER_BUILDKIT=1 docker build --pull --no-cache -f "$CURR_DIR/Dockerfile.release" \
-t concrete-framework-release "$CURR_DIR/.."
-t concrete-numpy-release "$CURR_DIR/.."

View File

@@ -17,11 +17,11 @@ import os
# -- Project information -----------------------------------------------------
project = 'Concrete Framework'
project = 'Concrete Numpy'
copyright = '2021, Zama'
author = 'Zama'
description = 'Zama Concrete Framework'
root_url = os.environ.get("DOC_ROOT_URL", "/concrete-framework")
description = 'Zama Concrete Numpy'
root_url = os.environ.get("DOC_ROOT_URL", "/concrete-numpy")
root_url = root_url if root_url.endswith('/') else root_url + '/'
# The full version, including alpha/beta/rc tags
@@ -71,7 +71,7 @@ html_theme = 'sphinx_zama_theme'
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_theme_options = {
"github_url": "https://github.com/zama-ai/concrete-framework",
"github_url": "https://github.com/zama-ai/concrete-numpy",
"twitter_url": "https://twitter.com/zama_fhe",
"icon_links": [{
"name": "Discourse",

View File

@@ -1,8 +1,8 @@
# Compilation Pipeline In Depth
## What is **concrete-framework**?
## What is **concrete-numpy**?
**concrete-framework** is the python API of the **Concrete** framework for developing homomorphic applications.
**concrete-numpy** is the python API of the **Concrete** framework for developing homomorphic applications.
One of its essential functionalities is to transform Python functions to their `MLIR` equivalent.
Unfortunately, not all python functions can be converted due to the limits of current product (we are in the alpha stage), or sometimes due to inherent restrictions of FHE itself.
However, you can already build interesting and impressing use cases, and more will be available in further versions of the framework.

View File

@@ -19,7 +19,7 @@ In this section we will go over some terms that we use throughout the project.
## Module structure
In this section, we will discuss the module structure of **concrete-framework** briefly. You are encouraged to check individual `.py` files to learn more!
In this section, we will discuss the module structure of **concrete-numpy** briefly. You are encouraged to check individual `.py` files to learn more!
- concrete
- common: types and utilities that can be used by multiple frontends (e.g., numpy, torch)

View File

@@ -2,7 +2,7 @@
# Contributing
```{important}
There are two ways to contribute to **concrete-framework**:
There are two ways to contribute to **concrete-numpy**:
- you can open issues to report bugs, typos and suggest ideas
- you can ask to become an official contributor by emailing hello@zama.ai. Only approved contributors can send pull requests, so please make sure to get in touch before you do!
```
@@ -28,7 +28,7 @@ git checkout -b fix/tracing_indexing_42
### Conformance
Each commit to **concrete-framework** should be conformant to the standards decided by the team. Conformance can be checked using the following command.
Each commit to **concrete-numpy** should be conformant to the standards decided by the team. Conformance can be checked using the following command.
```shell
make pcc

View File

@@ -1,14 +1,14 @@
# Project Setup
```{note}
It is strongly recommended to use the development docker (see the [docker](./docker.md) guide). However you can setup the project on bare macOS and Linux provided you install the required dependencies (check Dockerfile.concrete-framework-env for the required binary packages like make).
It is strongly recommended to use the development docker (see the [docker](./docker.md) guide). However you can setup the project on bare macOS and Linux provided you install the required dependencies (check Dockerfile.env for the required binary packages like make).
The project targets Python 3.8 through 3.9 inclusive.
```
## Installing Python
**concrete-framework** is a `Python` library, so `Python` should be installed to develop **concrete-framework**. `v3.8` and `v3.9` are the only supported versions.
**concrete-numpy** is a `Python` library, so `Python` should be installed to develop **concrete-numpy**. `v3.8` and `v3.9` are the only supported versions.
You can follow [this](https://realpython.com/installing-python/) guide to install it (alternatively you can google `how to install python 3.8 (or 3.9)`).
@@ -45,10 +45,10 @@ In the following sections, be sure to use the proper `make` tool for your system
## Cloning repository
Now, it's time to get the source code of **concrete-framework**. You can use the following command to do that.
Now, it's time to get the source code of **concrete-numpy**. You can use the following command to do that.
```shell
git clone https://github.com/zama-ai/concrete-framework-internal.git
git clone https://github.com/zama-ai/concrete-numpy-internal.git
```
## Setting up environment on your host OS
@@ -56,7 +56,7 @@ git clone https://github.com/zama-ai/concrete-framework-internal.git
We are going to make use of virtual environments. This helps to keep the project isolated from other `Python` projects in the system. The following commands will create a new virtual environment under the project directory and install dependencies to it.
```shell
cd concrete-framework-internal
cd concrete-numpy-internal
make setup_env
```

View File

@@ -2,8 +2,8 @@
## Release Candidate cycle
Before settling for a final release, we go through a Release Candidate (RC) cycle. The idea is that once the code base and documentations look ready for a release you create an RC Release by opening an issue with the release template [here](https://github.com/zama-ai/concrete-framework-internal/issues/new?assignees=&labels=&template=release.md), starting with version `vX.Y.Zrc1` and then with versions `vX.Y.Zrc2`, `vX.Y.Zrc3`...
Before settling for a final release, we go through a Release Candidate (RC) cycle. The idea is that once the code base and documentations look ready for a release you create an RC Release by opening an issue with the release template [here](https://github.com/zama-ai/concrete-numpy-internal/issues/new?assignees=&labels=&template=release.md), starting with version `vX.Y.Zrc1` and then with versions `vX.Y.Zrc2`, `vX.Y.Zrc3`...
## Proper release
Once the last RC is deemed ready, open an issue with the release template using the last RC version from which you remove the `rc?` part (i.e. `v12.67.19` if your last RC version was `v12.67.19-rc4`) on [github](https://github.com/zama-ai/concrete-framework-internal/issues/new?assignees=&labels=&template=release.md).
Once the last RC is deemed ready, open an issue with the release template using the last RC version from which you remove the `rc?` part (i.e. `v12.67.19` if your last RC version was `v12.67.19-rc4`) on [github](https://github.com/zama-ai/concrete-numpy-internal/issues/new?assignees=&labels=&template=release.md).

View File

@@ -1,4 +1,4 @@
Concrete Framework's documentation
Concrete Numpy's documentation
==================================

View File

@@ -11,11 +11,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Trees are a popular class of algorithm in Machine Learning. In this notebook we build a simple Decision Tree Classifier using `scikit-learn` to show that they can be executed homomorphically using the Concrete Framework.\n",
"Trees are a popular class of algorithm in Machine Learning. In this notebook we build a simple Decision Tree Classifier using `scikit-learn` to show that they can be executed homomorphically using the Concrete Numpy.\n",
"\n",
"State of the art classifiers are generally a bit more complex than a single decision tree, here we wanted to demonstrate FHE decision trees so results may not compete with the best models out there!\n",
"\n",
"Converting a tree working over quantized data to its FHE equivalent takes only a few lines of code thanks to the Concrete Framework.\n",
"Converting a tree working over quantized data to its FHE equivalent takes only a few lines of code thanks to the Concrete Numpy.\n",
"\n",
"Let's dive in!"
]
@@ -138,7 +138,7 @@
"source": [
"We now quantize the features to train the tree directly on quantized data, this will make the trained tree FHE friendly by default which is a nice bonus, as well as allowing to see how both trees compare to each other.\n",
"\n",
"The choice here is to compute the quantization parameters over the training set. We use 6 bits for each feature individually as the Concrete Framework precision for PBSes is better for 6 bits of precision."
"The choice here is to compute the quantization parameters over the training set. We use 6 bits for each feature individually as the Concrete Numpy precision for PBSes is better for 6 bits of precision."
]
},
{
@@ -252,7 +252,7 @@
"source": [
"Before we can do that we need to convert the tree to a form that is easy to run homomorphically.\n",
"\n",
"The Hummingbird paper from Microsoft (https://scnakandala.github.io/papers/TR_2020_Hummingbird.pdf and https://github.com/microsoft/hummingbird) gives a method to convert tree evaluation to tensor operations which we support in Concrete Framework.\n",
"The Hummingbird paper from Microsoft (https://scnakandala.github.io/papers/TR_2020_Hummingbird.pdf and https://github.com/microsoft/hummingbird) gives a method to convert tree evaluation to tensor operations which we support in Concrete Numpy.\n",
"\n",
"The next few cells implement the functions necessary for the conversion. They are not optimized well so that they remain readable.\n"
]
@@ -507,7 +507,7 @@
"source": [
"We now have a tensor equivalent of our `DecisionTreeClassifier`, pretty neat isn't it?\n",
"\n",
"Last step is compiling the tensor equivalent to FHE using the Concrete Framework and it's nearly as easy as 1, 2, 3.\n",
"Last step is compiling the tensor equivalent to FHE using the Concrete Numpy and it's nearly as easy as 1, 2, 3.\n",
"\n",
"We use the training input data as well as some synthetic data to calibrate the circuit during compilation."
]
@@ -616,7 +616,7 @@
"source": [
"In this notebook we showed how to quantize a dataset to train a tree directly on integer data so that it's FHE friendly. We saw that despite quantization and its smaller depth the quantized tree classification capabilities were close to a tree trained on the original real-valued dataset.\n",
"\n",
"We then used the Hummingbird paper's algorithm to transform a tree evaluation to a few tensor operations which can be compiled by the Concrete Framework to an FHE circuit.\n",
"We then used the Hummingbird paper's algorithm to transform a tree evaluation to a few tensor operations which can be compiled by the Concrete Numpy to an FHE circuit.\n",
"\n",
"Finally we ran the compiled circuit on a few samples (because inference times are a bit high) to show that clear and FHE computations were the same."
]

View File

@@ -6,7 +6,7 @@
"source": [
"# Fully Connected Neural Network on Iris Dataset\n",
"\n",
"In this example, we show how one can train a neural network on a specific task (here, Iris Classification) and use Concrete Framework to make the model work in FHE settings."
"In this example, we show how one can train a neural network on a specific task (here, Iris Classification) and use Concrete Numpy to make the model work in FHE settings."
]
},
{
@@ -382,7 +382,7 @@
"\n",
"In this notebook, we presented a few steps to have a model (torch neural network) inference in over homomorphically encrypted data: \n",
"- We first trained a fully connected neural network yielding ~100% accuracy\n",
"- Then, we quantized it using Concrete Framework. As we can see, the extreme post training quantization (only 3 bits of precision for weights, inputs and activations) made the neural network accuracy slightly drop (~97%).\n",
"- Then, we quantized it using Concrete Numpy. As we can see, the extreme post training quantization (only 3 bits of precision for weights, inputs and activations) made the neural network accuracy slightly drop (~97%).\n",
"- We then used the compiled inference into its FHE equivalent to get our FHE predictions over the test set\n",
"\n",
"The Homomorphic inference achieves a similar accuracy as the quantized model inference.\n",

View File

@@ -7,7 +7,7 @@
"source": [
"# Generalized Linear Model : Poisson Regression\n",
"\n",
"This tutorial shows how to train several Generalized Linear Models (GLM) with scikit-learn, quantize them and run them in FHE using the Concrete Framework. We make use of strong quantization to insure the accumulator of the linear part does not overflow when computing in FHE (7-bit accumulator). We show that conversion to FHE does not degrade performance with respect to the quantized model working on values in the clear."
"This tutorial shows how to train several Generalized Linear Models (GLM) with scikit-learn, quantize them and run them in FHE using the Concrete Numpy. We make use of strong quantization to insure the accumulator of the linear part does not overflow when computing in FHE (7-bit accumulator). We show that conversion to FHE does not degrade performance with respect to the quantized model working on values in the clear."
]
},
{
@@ -17,7 +17,7 @@
"source": [
"### Import libraries\n",
"\n",
"We import scikit-learn libraries and Concrete framework quantization tools:"
"We import scikit-learn libraries and Concrete Numpy quantization tools:"
]
},
{
@@ -870,11 +870,11 @@
"source": [
"### Conclusion\n",
"\n",
"In this tutorial we have discussed how we can use the Concrete framework to convert a scikit-learn based Poisson regression model to FHE. \n",
"In this tutorial we have discussed how we can use Concrete Numpy to convert a scikit-learn based Poisson regression model to FHE. \n",
"\n",
"First of all, we have shown that, with the proper choice of pipeline and parameters, we can do the conversion with little loss of precision. This decrease in the quality of prediction is due to quantization of model weights and input data, and some minor noise can appear due to FHE. This noise is visible on the single variable FHE trend line as minor deviations of the blue curve with respect to the red one. \n",
"\n",
"Finally, we have shown how conversion of a model to FHE can be done with a single line of code and how quantization is aided by the tools in the Concrete framework. \n"
"Finally, we have shown how conversion of a model to FHE can be done with a single line of code and how quantization is aided by the tools in Concrete Numpy. \n"
]
}
],

View File

@@ -9,7 +9,7 @@ To track our progress over time, we have created a [progress tracker](https://ml
Note that we are not limited to these, and we'll certainly add more information (e.g., key generation time, encryption time, inference time, decryption time, etc.) once the explicit inference API is available.
Our public benchmarks can be used by competing frameworks or technologies for comparison with **Concrete Framework**. Notably, you can see:
Our public benchmarks can be used by competing frameworks or technologies for comparison with **Concrete Numpy**. Notably, you can see:
- if the same functions can be compiled
- what are the discrepancies in the exactness of the evaluations
- how do evaluation times compare

View File

@@ -10,7 +10,7 @@ import concrete.numpy as hnp
## Defining a function to compile
You need to have a python function that follows the [limits](../explanation/fhe_and_framework_limits.md) of the **Concrete Framework**. Here is a simple example:
You need to have a python function that follows the [limits](../explanation/fhe_and_framework_limits.md) of the **Concrete Numpy**. Here is a simple example:
<!--pytest-codeblocks:cont-->
```python

View File

@@ -5,11 +5,11 @@
To install **Concrete** from PyPi, run the following:
```shell
pip install concrete-framework
pip install concrete-numpy
```
```{note}
Note that **concrete-framework** has `pygraphviz` as an optional dependency to draw graphs.
Note that **concrete-numpy** has `pygraphviz` as an optional dependency to draw graphs.
```
```{WARNING}
@@ -24,19 +24,19 @@ Do check <a href="https://pygraphviz.github.io/documentation/stable/install.html
You can install the extra python dependencies for drawing with:
```shell
pip install concrete-framework[full]
pip install concrete-numpy[full]
# you may need to force reinstallation
pip install --force-reinstall concrete-framework[full]
pip install --force-reinstall concrete-numpy[full]
```
## Docker image
You can also get the **concrete-framework** docker image by either pulling the latest docker image or a specific version:
You can also get the **concrete-numpy** docker image by either pulling the latest docker image or a specific version:
```shell
docker pull zamafhe/concrete-framework:latest
docker pull zamafhe/concrete-numpy:latest
# or
docker pull zamafhe/concrete-framework:v0.2.0
docker pull zamafhe/concrete-numpy:v0.2.0
```
The image can be used with docker volumes, [see the docker documentation here](https://docs.docker.com/storage/volumes/).
@@ -45,10 +45,10 @@ You can then use this image with the following command:
```shell
# Without local volume:
docker run --rm -it -p 8888:8888 zamafhe/concrete-framework:v0.2.0
docker run --rm -it -p 8888:8888 zamafhe/concrete-numpy:v0.2.0
# With local volume to save notebooks on host:
docker run --rm -it -p 8888:8888 -v /host/path:/data zamafhe/concrete-framework:v0.2.0
docker run --rm -it -p 8888:8888 -v /host/path:/data zamafhe/concrete-numpy:v0.2.0
```
This will launch a **Concrete** enabled jupyter server in the docker, that you can access from your browser.
@@ -56,5 +56,5 @@ This will launch a **Concrete** enabled jupyter server in the docker, that you c
Alternatively, you can just open a shell in the docker with or without volumes:
```shell
docker run --rm -it zamafhe/concrete-framework:v0.2.0 /bin/bash
docker run --rm -it zamafhe/concrete-numpy:v0.2.0 /bin/bash
```

View File

@@ -3,7 +3,7 @@
## Introduction
**Concrete Framework**, or **Concrete** for short, is an open-source framework which aims to simplify the use of so-called fully homomorphic encryption (FHE) for data scientists.
**Concrete Numpy**, or **Concrete** for short, is an open-source framework which aims to simplify the use of so-called fully homomorphic encryption (FHE) for data scientists.
FHE is a powerful cryptographic tool, which allows servers to perform computations directly on encrypted data without needing to decrypt first. With FHE, privacy is at the center, and you can build services which ensure full privacy of the user and are the perfect equivalent of their unsecure counterpart.

View File

@@ -1,4 +1,4 @@
# FHE and **Concrete Framework** Limits
# FHE and **Concrete Numpy** Limits
## FHE limits
@@ -10,19 +10,19 @@ However, one still has to consider that FHE is slow, as compared to the vanilla
### Multiplying by constants
In the scheme used in the **Concrete Framework**, namely [TFHE](https://tfhe.github.io/tfhe/), multiplications by constants is only defined for integer constants. Notably, one can't multiply by floats. As float multiplication is very usual in the data science (think of weights of dense layers, for example), this could be a problem, but quantization is at our rescue. See [this](quantization.md) section for more details.
In the scheme used in the **Concrete Numpy**, namely [TFHE](https://tfhe.github.io/tfhe/), multiplications by constants is only defined for integer constants. Notably, one can't multiply by floats. As float multiplication is very usual in the data science (think of weights of dense layers, for example), this could be a problem, but quantization is at our rescue. See [this](quantization.md) section for more details.
### Achieving computations of not-linear functions
For most FHE scheme but TFHE, the application of a non-linear function is complicated and slow, if not impossible. Typically, this is a blocker, since activation functions _are_ non-linear. However, in the **Concrete Framework**, we use an operation called _programmable bootstrapping_ (described in this [white paper](https://whitepaper.zama.ai)), which allows to apply any table lookup: by quantizing the non-linear function, any function can thus be replaced.
For most FHE scheme but TFHE, the application of a non-linear function is complicated and slow, if not impossible. Typically, this is a blocker, since activation functions _are_ non-linear. However, in the **Concrete Numpy**, we use an operation called _programmable bootstrapping_ (described in this [white paper](https://whitepaper.zama.ai)), which allows to apply any table lookup: by quantizing the non-linear function, any function can thus be replaced.
## **Concrete Framework** limits
## Limits of this project
Since this is an early version of the product, not everything is done, to say the least. What we wanted to tackle first was the cryptographic complexities. This is why we concentrated on the cryptographic part, and let some engineering problems for later.
### Currently executing locally
As of today, the execution of the FHE program is done locally. Notably, in the current version, there is no client (on which we encrypt the private data, or decrypt the returned result) or server (on which the computation is done completely over encrypted data), but a single host. As explained in [this section](future_features.md), this limit will be removed in the next version, such that the **Concrete Framework** can be used in production.
As of today, the execution of the FHE program is done locally. Notably, in the current version, there is no client (on which we encrypt the private data, or decrypt the returned result) or server (on which the computation is done completely over encrypted data), but a single host. As explained in [this section](future_features.md), this limit will be removed in the next version, such that the **Concrete Numpy** can be used in production.
### Currently slow

View File

@@ -1,10 +1,10 @@
# Future Features
As explained in [this section](fhe_and_framework_limits.md#concrete-framework-limits), the **Concrete Framework**
As explained in [this section](fhe_and_framework_limits.md#limits-of-this-project), the **Concrete Numpy**
is currently in a preliminary version, and quite constrained in term of functionalities. However, the good
news is that we are going to release new versions regularly, where a lot of functionalities will be added progressively.
In this page, we briefly list what the plans for next versions of the **Concrete Framework** are:
In this page, we briefly list what the plans for next versions of the **Concrete Numpy** are:
- **better performance**: further versions will contain improved versions of the **Concrete Library**, with faster
execution; also, the **Concrete Compiler** will be improved, to have faster local execution (with multi-threading
for example) and faster production execution (with distribution over a set of machines or use of hardware accelerations)

View File

@@ -18,7 +18,7 @@ The basic idea of quantization is to take a range of values represented by a _la
Let's first define some notations. Let $ [\alpha, \beta ] $ be the range of our value to quantize where $ \alpha $ is the minimum and $ \beta $ is the maximum.
To quantize a range with floating point values (in $ \mathbb{R} $) to unsigned integer values (in $ \mathbb{N} $), we first need to choose the data type that is going to be used. **ConcreteLib**, the library used in the **Concrete Framework**, is currently limited to 7 bits unsigned integers, so we'll use that for the example. Knowing that, for a value in the range $ [\alpha, \beta ] $, we can compute the `scale` $ S $ of the quantization:
To quantize a range with floating point values (in $ \mathbb{R} $) to unsigned integer values (in $ \mathbb{N} $), we first need to choose the data type that is going to be used. **ConcreteLib**, the library used in the **Concrete Numpy**, is currently limited to 7 bits unsigned integers, so we'll use that for the example. Knowing that, for a value in the range $ [\alpha, \beta ] $, we can compute the `scale` $ S $ of the quantization:
$$ S = \frac{\beta - \alpha}{2^n - 1} $$
@@ -36,9 +36,9 @@ Regarding quantization and FHE compilation, it is important to understand the di
1. the quantization is done before the compilation; notably, the quantization is completely controlled by the user, and can be done by any means, including by using third party frameworks
2. the quantization is done during the compilation (inside our framework), with much less control by the user.
For the moment, only the second method is available in Concrete Framework, but we plan to have the first method available in a further release, since it should give more freedom and better results to the user.
For the moment, only the second method is available in Concrete Numpy, but we plan to have the first method available in a further release, since it should give more freedom and better results to the user.
We detail the use of quantization within Concrete Framework in [here](../howto/use_quantization.md).
We detail the use of quantization within Concrete Numpy in [here](../howto/use_quantization.md).
## Resources

View File

@@ -1,6 +1,6 @@
# Compiling a Torch Model
Concrete Framework allows to compile a torch model to its FHE counterpart.
Concrete Numpy allows to compile a torch model to its FHE counterpart.
A simple command can compile a torch model to its FHE counterpart. This process executes most of the concepts described in the documentation on [how to use quantization](use_quantization.md) and triggers the compilation to be able to run the model over homomorphically encrypted data.

View File

@@ -66,7 +66,7 @@ To simplify our work and let us reproduce your bug easily, we need all the infor
- any insight you might have on the bug
- any workaround you have been able to find
Remember, **Concrete Framework** is a project where we are open to contributions, more information at [Contributing](../../dev/howto/contributing.md).
Remember, **Concrete Numpy** is a project where we are open to contributions, more information at [Contributing](../../dev/howto/contributing.md).
## Submitting an issue

View File

@@ -1,6 +1,6 @@
# FAQ
## What is **Concrete Framework**?
## What is **Concrete Numpy**?
See [here](../basics/intro.md). Also, you can have a look to Zama's [website](https://zama.ai) or to the [Concrete library GitHub](https://github.com/zama-ai/concrete).
@@ -8,7 +8,7 @@ See [here](../basics/intro.md). Also, you can have a look to Zama's [website](ht
Our mission at Zama is to protect peoples privacy by preventing data breaches and unethical surveillance.
Following a recent breakthrough in fully homomorphic encryption, we are building a deep learning framework that enables fast and accurate inference over encrypted data, with minimal performance overhead, no changes to the network architecture, and no retraining necessary. Zama is open-source by design, as we believe privacy-enabling technologies should benefit the widest possible community of developers and researchers. If you are interested in the details, be sure to read our licensing agreement in the root of the repository. In a nutshell, if you plan to use the Concrete Framework for non-commercial purposes, we welcome you and want to hear about all the exciting things you do with FHE!
Following a recent breakthrough in fully homomorphic encryption, we are building a deep learning framework that enables fast and accurate inference over encrypted data, with minimal performance overhead, no changes to the network architecture, and no retraining necessary. Zama is open-source by design, as we believe privacy-enabling technologies should benefit the widest possible community of developers and researchers. If you are interested in the details, be sure to read our licensing agreement in the root of the repository. In a nutshell, if you plan to use the Concrete Numpy for non-commercial purposes, we welcome you and want to hear about all the exciting things you do with FHE!
## Can I use it freely?
@@ -18,7 +18,7 @@ See our license in the root of the repository.
See this [section](../../dev/howto/contributing.md).
## What are the future features of **Concrete Framework**?
## What are the future features of **Concrete Numpy**?
See this [section](../explanation/future_features.md).

View File

@@ -1,6 +1,6 @@
# Numpy Support
In this section, we list the operations which are supported currently in the **Concrete Framework**. Please have a look to numpy [documentation](https://numpy.org/doc/stable/user/index.html) to know what these operations are about.
In this section, we list the operations which are supported currently in the **Concrete Numpy**. Please have a look to numpy [documentation](https://numpy.org/doc/stable/user/index.html) to know what these operations are about.
## Unary operations

View File

@@ -20,11 +20,11 @@ The drawing package required is `pygraphviz` which needs `graphviz` packages ins
To install the required drawing packages once you have `graphviz` installed run:
`pip install concrete-framework[full]`
`pip install concrete-numpy[full]`
You may need to force reinstallation
`pip install --force-reinstall concrete-framework[full]`
`pip install --force-reinstall concrete-numpy[full]`
```
To draw your circuit, you can do the following:

View File

@@ -77,9 +77,9 @@ The end result has a granularity/imprecision linked to the data types used and f
Recent quantization literature often takes a few shortcuts to reach performance similar to those achieved by floating point models. A common one is that the input is left in floating point. This is also true for the first and last layers which have more impact on the resulting model accuracy than hidden layers.
But, in the Concrete framework the inputs, weights and the accumulator must remain on a maximum of 7 bits.
But, in Concrete Numpy the inputs, weights and the accumulator must remain on a maximum of 7 bits.
Thus, in the Concrete framework we also quantize the input data and network output activations in the same way as the rest of the network: everything is quantized to a specific number of bits. It turns out, that the number of bits used for the input or the output of any activation function is crucial to comply with the constraint on accumulator width.
Thus, in Concrete Numpy we also quantize the input data and network output activations in the same way as the rest of the network: everything is quantized to a specific number of bits. It turns out, that the number of bits used for the input or the output of any activation function is crucial to comply with the constraint on accumulator width.
The core operation in neural networks is essentially matrix multiplications (matmul). This operation must be done such that the maximum value of its result requires at most 7 bits of precision.
@@ -91,6 +91,6 @@ where $ n_{\mathsf{max}} = 7 $ is the maximum precision allowed. For example, if
Above $ \Omega $ dimensions in the input and weights, the risk of overflow increases quickly. It may happen that for some distributions of weights and values the computation does not overflow, but the risk increases rapidly with the number of dimensions.
Currently, Concrete Framework pre-computes the number of bits needed for the computation depending on the input set calibration data and does not allow the overflow[^1] to happen.
Currently, Concrete Numpy pre-computes the number of bits needed for the computation depending on the input set calibration data and does not allow the overflow[^1] to happen.
[^1]: [Integer overflow](https://en.wikipedia.org/wiki/Integer_overflow)

View File

@@ -1,10 +1,10 @@
# Using Quantization in Concrete Framework
# Using Quantization in Concrete Numpy
In this section we detail some usage of [quantization](../explanation/quantization.md) as implemented in Concrete.
## Quantization Basics
Concrete Framework implements some basic concepts of quantization. The very basic purpose of it is to convert floating point values to integers. We can apply such conversion using `QuantizedArray` available in `concrete.quantization`.
Concrete Numpy implements some basic concepts of quantization. The very basic purpose of it is to convert floating point values to integers. We can apply such conversion using `QuantizedArray` available in `concrete.quantization`.
`QuantizedArray` takes 2 arguments:
- `n_bits` that defines the precision of the quantization. Currently, `n_bits` is limited to 7, due to some ConcreteLib limits.
@@ -38,12 +38,12 @@ Neural networks are implemented with a diverse set of operations, such as convol
Re-scaling raw input values to the quantized domain implies that we need to make use of floating point operations. In the FHE setting where we only work with integers, this could be a problem, but luckily, the FHE implementation behind the Concrete framework provides a workaround. We essentially make use of a [table lookup](../tutorial/table_lookup.md) which is later translated into a [PBS](https://whitepaper.zama.ai).
Of course, having a PBS for every quantized addition isn't recommended for computational cost reasons. Also, Concrete Framework allows PBS only for univariate operations (i.e. matrix multiplication can't be done in a PBS). Therefore, our quantized modules split the computation of floating point values and unsigned integers as it is currently done in `concrete.quantization.QuantizedLinear`.
Of course, having a PBS for every quantized addition isn't recommended for computational cost reasons. Also, Concrete Numpy allows PBS only for univariate operations (i.e. matrix multiplication can't be done in a PBS). Therefore, our quantized modules split the computation of floating point values and unsigned integers as it is currently done in `concrete.quantization.QuantizedLinear`.
The above operations are all implemented in Concrete Framework and transparent to the user via our Quantized Modules.
The above operations are all implemented in Concrete Numpy and transparent to the user via our Quantized Modules.
Concrete Framework allows you to convert Numpy operations to their FHE counterparts. This essentially opens the door to any python computing framework such as [PyTorch](https://pytorch.org/). Concrete Framework implements a Torch to Numpy converter that makes it easy for the user to use a torch model.
Concrete Numpy allows you to convert Numpy operations to their FHE counterparts. This essentially opens the door to any python computing framework such as [PyTorch](https://pytorch.org/). Concrete Numpy implements a Torch to Numpy converter that makes it easy for the user to use a torch model.
First we define a model:
@@ -141,7 +141,7 @@ Do not reuse a layer or an activation multiple times in the forward (i.e. self.s
It is now possible to compile the `quantized_numpy_module`. Details on how to compile the model are available in the [torch compilation documentation](compiling_torch_model.md).
## Building your own QuantizedModule
Concrete Framework also offers the possibility to build your own models and use them in the FHE settings. The `QuantizedModule` is a very simple abstraction that allows to create any model using the available operators:
Concrete Numpy also offers the possibility to build your own models and use them in the FHE settings. The `QuantizedModule` is a very simple abstraction that allows to create any model using the available operators:
- QuantizedSigmoid, the quantized version of `nn.Sigmoid`
- QuantizedLinear, the quantized version of `nn.Linear`

View File

@@ -12,7 +12,7 @@ def f(x):
return np.sin(x)
```
This function fails to compile because **Concrete Framework** doesn't support floating point outputs. When you try to compile it (you might want to check [this](../basics/compiling_and_executing.md) to see how you can do that), an exception will be raised and the artifacts will be exported automatically.
This function fails to compile because **Concrete Numpy** doesn't support floating point outputs. When you try to compile it (you might want to check [this](../basics/compiling_and_executing.md) to see how you can do that), an exception will be raised and the artifacts will be exported automatically.
### environment.txt

View File

@@ -1,10 +1,10 @@
# Table Lookup
In this tutorial, we are going to go over the ways to perform direct table lookups in **Concrete Framework**. Please read [Compiling and Executing](../basics/compiling_and_executing.md) before reading further to see how you can compile the functions below.
In this tutorial, we are going to go over the ways to perform direct table lookups in **Concrete Numpy**. Please read [Compiling and Executing](../basics/compiling_and_executing.md) before reading further to see how you can compile the functions below.
## Direct table lookup
**Concrete Framework** provides a special class to allow direct table lookups. Here is how to use it:
**Concrete Numpy** provides a special class to allow direct table lookups. Here is how to use it:
```python
import concrete.numpy as hnp
@@ -78,7 +78,7 @@ Basically, we applied `squared` table to the first column and `cubed` to the sec
## Fused table lookup
Direct tables are tedious to prepare by hand. When possible, **Concrete Framework** fuses the floating point operations into table lookups automatically. There are some limitations on fusing operations, which you can learn more about on the next tutorial, [Working With Floating Points](./working_with_floating_points.md).
Direct tables are tedious to prepare by hand. When possible, **Concrete Numpy** fuses the floating point operations into table lookups automatically. There are some limitations on fusing operations, which you can learn more about on the next tutorial, [Working With Floating Points](./working_with_floating_points.md).
Here is an example function that results in fused table lookup:

View File

@@ -1,18 +1,18 @@
Name Version License
Pillow 8.4.0 Historical Permission Notice and Disclaimer (HPND)
cycler 0.11.0 BSD License
fonttools 4.28.5 MIT License
kiwisolver 1.3.2 BSD License
loguru 0.5.3 MIT License
matplotlib 3.5.1 Python Software Foundation License
networkx 2.6.3 BSD License
numpy 1.22.0 BSD License
packaging 21.3 Apache Software License; BSD License
pygraphviz 1.7 BSD License
pyparsing 3.0.6 MIT License
python-dateutil 2.8.2 Apache Software License; BSD License
setuptools-scm 6.3.2 MIT License
six 1.16.0 MIT License
tomli 1.2.3 MIT License
torch 1.10.1 BSD License
typing-extensions 4.0.1 Python Software Foundation License
Name Version License
Pillow 8.4.0 Historical Permission Notice and Disclaimer (HPND)
cycler 0.11.0 BSD License
fonttools 4.28.5 MIT License
kiwisolver 1.3.2 BSD License
loguru 0.5.3 MIT License
matplotlib 3.5.1 Python Software Foundation License
networkx 2.6.3 BSD License
numpy 1.22.0 BSD License
packaging 21.3 Apache Software License; BSD License
pygraphviz 1.7 BSD License
pyparsing 3.0.6 MIT License
python-dateutil 2.8.2 Apache Software License; BSD License
setuptools-scm 6.3.2 MIT License
six 1.16.0 MIT License
tomli 1.2.3 MIT License
torch 1.10.1 BSD License
typing-extensions 4.0.1 Python Software Foundation License

6
poetry.lock generated
View File

@@ -519,7 +519,7 @@ test = ["pytest (!=5.3.4)", "pytest-cov", "flaky", "ipyparallel"]
[[package]]
name = "ipython"
version = "7.30.1"
version = "7.31.0"
description = "IPython: Productive Interactive Computing"
category = "dev"
optional = false
@@ -2607,8 +2607,8 @@ ipykernel = [
{file = "ipykernel-6.6.1.tar.gz", hash = "sha256:91ff0058b45660aad4a68088041059c0d378cd53fc8aff60e5abc91bcc049353"},
]
ipython = [
{file = "ipython-7.30.1-py3-none-any.whl", hash = "sha256:fc60ef843e0863dd4e24ab2bb5698f071031332801ecf8d1aeb4fb622056545c"},
{file = "ipython-7.30.1.tar.gz", hash = "sha256:cb6aef731bf708a7727ab6cde8df87f0281b1427d41e65d62d4b68934fa54e97"},
{file = "ipython-7.31.0-py3-none-any.whl", hash = "sha256:4c4234cdcc6b8f87c5b5c7af9899aa696ac5cfcf0e9f6d0688018bbee5c73bce"},
{file = "ipython-7.31.0.tar.gz", hash = "sha256:346c74db7312c41fa566d3be45d2e759a528dcc2994fe48aac1a03a70cd668a3"},
]
ipython-genutils = [
{file = "ipython_genutils-0.2.0-py2.py3-none-any.whl", hash = "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8"},

View File

@@ -1,7 +1,7 @@
[tool.poetry]
name = "concrete-framework"
name = "concrete-numpy"
version = "0.2.0-rc5"
description = "Concrete Framework"
description = "Concrete Numpy"
authors = ["Zama <hello@zama.ai>"]
packages = [
{ include = "concrete" },

View File

@@ -6,7 +6,7 @@ FILE=
COMPILER_RELEASE_ENDPOINT_URL=
ENV_IMG_ENDPOINT_URL=
TOKEN=
ENV_DOCKERFILE=./docker/Dockerfile.concrete-framework-env
ENV_DOCKERFILE=./docker/Dockerfile.env
GITHUB_ENV_FILE=debug.txt
while [ -n "$1" ]

View File

@@ -5,7 +5,7 @@ set -e
BASE_IMG_ENDPOINT_URL=
ENV_IMG_ENDPOINT_URL=
TOKEN=
ENV_DOCKERFILE=./docker/Dockerfile.concrete-framework-env
ENV_DOCKERFILE=./docker/Dockerfile.env
GITHUB_ENV_FILE=debug.txt
while [ -n "$1" ]

View File

@@ -62,7 +62,7 @@ then
python -m pip install -U --force-reinstall setuptools
poetry install --no-dev --extras full
python -m pip install pip-licenses
pip-licenses | grep -v "pkg\-resources\|concrete-framework" | tee "${NEW_LICENSES_FILENAME}"
pip-licenses | grep -v "pkg\-resources\|concrete-numpy" | tee "${NEW_LICENSES_FILENAME}"
# Remove trailing whitespaces
if [ "$UNAME" == "Darwin" ]
@@ -99,7 +99,7 @@ then
source $TMP_VENV_PATH/tmp_venv/bin/activate
make setup_env
pip-licenses | grep -v "pkg\-resources\|concrete-framework" | tee "${NEW_LICENSES_FILENAME}"
pip-licenses | grep -v "pkg\-resources\|concrete-numpy" | tee "${NEW_LICENSES_FILENAME}"
# Remove trailing whitespaces
if [ "$UNAME" == "Darwin" ]

View File

@@ -506,7 +506,7 @@ def test_inpuset_eval_1_input(default_compilation_configuration):
assert output_node.outputs[0] == EncryptedScalar(UnsignedInteger(6))
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/772
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/772
# Remove once this issue is done
def test_inpuset_eval_1_input_refuse_tuple(default_compilation_configuration):
"""Test case for a function with a single parameter and passing the inputset with tuples."""

View File

@@ -55,7 +55,7 @@ def pytest_addoption(parser):
)
DEFAULT_KEYRING_PATH = Path.home().resolve() / ".cache/concrete-framework_pytest"
DEFAULT_KEYRING_PATH = Path.home().resolve() / ".cache/concrete-numpy_pytest"
def get_keyring_dir_from_session_or_default(
@@ -404,7 +404,7 @@ def check_is_good_execution_impl(
# >= if there are 8 bits signed integers
allow_relaxed_tests_passing = max_bit_width >= ACCEPTABLE_MAXIMAL_BITWIDTH_FROM_CONCRETE_LIB
# FIXME: https://github.com/zama-ai/concrete-framework-internal/issues/1255
# FIXME: https://github.com/zama-ai/concrete-numpy-internal/issues/1255
# Increased with compiler accuracy which dropped, make sure to remove once accuracy improves
nb_tries = 10
@@ -432,7 +432,7 @@ def check_is_good_execution_impl(
if verbose:
print(f"Good computation after {i} tries")
return
# FIXME: https://github.com/zama-ai/concrete-framework-internal/issues/1264
# FIXME: https://github.com/zama-ai/concrete-numpy-internal/issues/1264
# Remove the relaxed tests once accuracy is good again for 7 bits
if allow_relaxed_tests_passing and cells_were_properly_computed.all():
print(

View File

@@ -242,7 +242,7 @@ def mix_x_and_y_and_call_f_with_integer_inputs(func, x, y):
def mix_x_and_y_and_call_f_which_expects_small_inputs(func, x, y):
"""Create an upper function to test `func`, which expects small values to not use too much
precision"""
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/993
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/993
# Understand why it's failing with 0.77 for numpy.arctanh
a = numpy.abs(0.5 * numpy.sin(x))
z = numpy.abs(3 * func(a))
@@ -336,7 +336,7 @@ def subtest_compile_and_run_unary_ufunc_correctness(
default_compilation_configuration,
)
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/910
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/910
args = [
numpy.random.randint(low, high, size=tensor_shape, dtype=numpy.uint8)
if tensor_shape != ()
@@ -377,7 +377,7 @@ def subtest_compile_and_run_binary_ufunc_correctness(
default_compilation_configuration,
)
# TODO: https://github.com/zama-ai/concrete-framework-internal/issues/910
# TODO: https://github.com/zama-ai/concrete-numpy-internal/issues/910
args = [
numpy.random.randint(low, high, size=tensor_shape, dtype=numpy.uint8)
if tensor_shape != ()