Skip to content

Commit

Permalink
docs(frontend): fix punctuation
Browse files Browse the repository at this point in the history
Co-authored-by: yuxizama <[email protected]>
  • Loading branch information
youben11 and yuxizama committed Dec 18, 2024
1 parent 813874a commit 0b93351
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions frontends/concrete-python/examples/tfhers-ml/README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
# TFHE-rs Interoperability Example
# TFHE-rs interoperability example

This is a similar example to the [first TFHE-rs example](../tfhers/), except that it uses tensors and run a linear ML model. It also uses quantization.

## Make tmpdir

We want to setup a temporary working directory first
We want to setup a temporary working directory first:

```sh
export TDIR=`mktemp -d`
```

## KeyGen

First we need to build the TFHE-rs utility in [this directory](../../tests/tfhers-utils/) by running
First we need to build the TFHE-rs utility in [this directory](../../tests/tfhers-utils/) by running the following:

```sh
cd ../../tests/tfhers-utils/
make build
cd -
```

Then we can generate keys in two different ways. You only need to run one of the following methods
Then we can generate keys in two different ways. You only need to run one of the following methods.

#### Generate the Secret Key in Concrete

We start by doing keygen in Concrete
We start by doing keygen in Concrete:

```sh
python example.py keygen -o $TDIR/concrete_sk -k $TDIR/concrete_keyset
```

Then we do a partial keygen in TFHE-rs
Then we do a partial keygen in TFHE-rs:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils keygen --lwe-sk $TDIR/concrete_sk --output-lwe-sk $TDIR/tfhers_sk -c $TDIR/tfhers_client_key -s $TDIR/tfhers_server_key
```

#### Generate the Secret Key in TFHE-rs

We start by doing keygen in TFHE-rs
We start by doing keygen in TFHE-rs:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils keygen --output-lwe-sk $TDIR/tfhers_sk -c $TDIR/tfhers_client_key -s $TDIR/tfhers_server_key
```

Then we do a partial keygen in Concrete.
Then we do a partial keygen in Concrete:

```sh
python example.py keygen -s $TDIR/tfhers_sk -o $TDIR/concrete_sk -k $TDIR/concrete_keyset
```

## Quantize values

We need to quantize floating point inputs using a pre-built quantizer for our ML model
We need to quantize floating point inputs using a pre-built quantizer for our ML model:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils quantize --value=5.1,3.5,1.4,0.2,4.9,3,1.4,0.2,4.7,3.2,1.3,0.2,4.6,3.1,1.5,0.2,5,3.6,1.4,0.2 --config ./input_quantizer.json -o $TDIR/quantized_values
Expand Down Expand Up @@ -87,15 +87,15 @@ python -c "print(','.join(map(lambda x: str(x << 10), [$(cat $TDIR/result_plaint

## Dequantize values

We need to dequantize integer outputs using a pre-built quantizer for our ML model
We need to dequantize integer outputs using a pre-built quantizer for our ML model:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils dequantize --value=$(cat $TDIR/rescaled_plaintext) --shape=5,3 --config ./output_quantizer.json
```

## Compute error

We compare the output to the expected result
We compare the output to the expected result:

```sh
python compute_error.py --plaintext-file "$TDIR/rescaled_plaintext" --quantized-predictions-file "test_values.json"
Expand Down
16 changes: 8 additions & 8 deletions frontends/concrete-python/examples/tfhers/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
# TFHE-rs Interoperability Example
# TFHE-rs interoperability example

This is the full execution for the example explained in the [TFHE-rs Interoperability Guide](../../../../docs/guides/tfhers) (use case 1). You can find the TFHE-rs code [here](../../tests/tfhers-utils/src/main.rs), while the Python code is under this direcotry [here](example.py). Both are CLI tools, so that we can execute the example step by step. You can refer to the code at every step to see how it's implemented.

## Make tmpdir

We want to setup a temporary working directory first
We want to setup a temporary working directory first:

```sh
export TDIR=`mktemp -d`
```

## KeyGen

First we need to build the TFHE-rs utility in [this directory](../../tests/tfhers-utils/) by running
First we need to build the TFHE-rs utility in [this directory](../../tests/tfhers-utils/) by running the following:

```sh
cd ../../tests/tfhers-utils/
make build
cd -
```

Then we can generate keys in two different ways. You only need to run one of the following methods
Then we can generate keys in two different ways. You only need to run one of the following methods.

#### Generate the Secret Key in Concrete

We start by doing keygen in Concrete
We start by doing keygen in Concrete:

```sh
python example.py keygen -o $TDIR/concrete_sk -k $TDIR/concrete_keyset
```

Then we do a partial keygen in TFHE-rs
Then we do a partial keygen in TFHE-rs:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils keygen --lwe-sk $TDIR/concrete_sk --output-lwe-sk $TDIR/tfhers_sk -c $TDIR/tfhers_client_key -s $TDIR/tfhers_server_key
```

#### Generate the Secret Key in TFHE-rs

We start by doing keygen in TFHE-rs
We start by doing keygen in TFHE-rs:

```sh
../../tests/tfhers-utils/target/release/tfhers_utils keygen --output-lwe-sk $TDIR/tfhers_sk -c $TDIR/tfhers_client_key -s $TDIR/tfhers_server_key
```

Then we do a partial keygen in Concrete.
Then we do a partial keygen in Concrete:

```sh
python example.py keygen -s $TDIR/tfhers_sk -o $TDIR/concrete_sk -k $TDIR/concrete_keyset
Expand Down

0 comments on commit 0b93351

Please sign in to comment.