Code Monkey home page Code Monkey logo

Comments (4)

cutukmirza avatar cutukmirza commented on June 1, 2024 3

Alright, thank you very much for your help!

from concrete-numpy.

umut-sahin avatar umut-sahin commented on June 1, 2024

Hello,

I tried to recreate the error you get but I couldn't. Here is what I did:

Created a new virtual env using:

$ python3.8 -m venv .venv

Activated it:

$ source .venv/bin/activate

Installed concrete-numpy:

$ pip install concrete-numpy

Here is the state of the environment:

$ pip freeze
concrete-compiler==0.6.0
concrete-numpy==0.5.0
cycler==0.11.0
fonttools==4.33.3
kiwisolver==1.4.3
loguru==0.5.3
matplotlib==3.5.2
networkx==2.8.4
numpy==1.23.0
packaging==21.3
Pillow==9.1.1
pyparsing==3.0.9
python-dateutil==2.8.2
PyYAML==6.0
six==1.16.0
torch==1.11.0
typing_extensions==4.2.0

Finally ran this code:

import concrete.numpy as hnp
import numpy as np

squared = hnp.LookupTable([i ** 2 for i in range(4)])
cubed = hnp.LookupTable([i ** 3 for i in range(4)])

table = hnp.MultiLookupTable([
    [squared, cubed],
    [squared, cubed],
    [squared, cubed],
])

def f(x):
    return table[x]

t_lookup_inputset = [
    np.array([[0, 0], [0, 1], [0, 2]], dtype=np.uint8),
    np.array([[1, 1], [1, 2], [1, 3]], dtype=np.uint8),
    np.array([[2, 1], [2, 2], [2, 3]], dtype=np.uint8),
]

compiler = hnp.NPFHECompiler(
    f, {"x": "encrypted"}
)
print('compiling the circuit')
table_circuit = compiler.compile_on_inputset(t_lookup_inputset)
print('compile done')

inp = np.array([[0, 1], [1, 1], [1, 2]], dtype=np.uint8)
print(table_circuit.encrypt_run_decrypt(inp))

This is the output I get:

compiling the circuit
compile done
[[0 1]
 [1 1]
 [1 8]]

Could you verify that it's working? And if it's not working could you share reproduction steps.

Thanks.

from concrete-numpy.

cutukmirza avatar cutukmirza commented on June 1, 2024

Hi Metu,

Thank you for your swift reply! I just checked again, and it seems to be working without issues. I am using jupyter notebooks, so maybe I had some artifacts left from the other things I have tried. A small additional question, how do I fix the

WARNING: You are currently using the software variant of concrete-csprng which does not have access to a hardware source of randomness. To ensure the security of your application, please arrange to provide a secret by using the `concrete_csprng::set_soft_rdseed_secret` function.

Since I am working in Python and this seems to be a Rust function?

Thank you!

Best,
Mirza

from concrete-numpy.

aquint-zama avatar aquint-zama commented on June 1, 2024

This warning could happen if you are a non-x86 architecture, say on Apple Silicon for example (that is my case). And in that case you cant use hardware acceleration and have slower performances. It is indeed in one of the Rust dependency of concrete-numpy.

More info on the issue here: https://community.zama.ai/t/support-for-hardware-source-of-randomness-in-docker-vm/44

from concrete-numpy.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.