zama-ai / concrete-ml

Concrete ML: Privacy Preserving ML framework using Fully Homomorphic Encryption (FHE), built on top of Concrete, with bindings to traditional ML frameworks.
Other
910 stars 135 forks source link

Docker image is not working on Apple M1/M2 chips #160

Open mvacher opened 1 year ago

mvacher commented 1 year ago

Summary

The version provided through the docker image is not working on Apple M1 and M2 chips

Description

minimal POC to trigger the bug

On a M1 or M2 machine: ``` # Install docker pull zamafhe/concrete-ml:latest # Run the with: docker run --rm -it -p 8888:8888 -v ~/host_folder:/data zamafhe/concrete-ml ``` Python code: ( example from the readme) ``` from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from concrete.ml.sklearn import LogisticRegression # Lets create a synthetic data-set x, y = make_classification(n_samples=100, class_sep=2, n_features=30, random_state=42) # Split the data-set into a train and test set X_train, X_test, y_train, y_test = train_test_split( x, y, test_size=0.2, random_state=42 ) # Now we train in the clear and quantize the weights model = LogisticRegression(n_bits=8) model.fit(X_train, y_train) # We then compile on a representative set model.compile(X_train) # --> This line kills the kernel and restart the notebook ```

RomanBredehoft commented 1 year ago

We indeed don't handle docker with M1 / M2 chips currently but we'll try our best to patch it soon (I'm on M2 as well 😉). Thanks for the issue ! In the mean time, please use the native installation as Concrete-ML properly works with Apple Silicon !

bcm-at-zama commented 11 months ago

Hello @mvacher. We're having a look, sorry for the delay. Were you able to use Concrete with native packages?

bcm-at-zama commented 10 months ago

Hello @berhankarabay . Did you try to install natively, ie with

pip install -U pip wheel setuptools
pip install concrete-ml

ideally in a virtual env?

fd0r commented 10 months ago

Hello @berhankarabay , are you using a M1 system or intel based system? Also what snippet of code gave you this error? The code from the KDNuggets blog is deprecated as we changed the API when updating from 0.x to 1.x I would recommend you take a look at either https://docs.zama.ai/concrete-ml or the use-case examples that we have in the repository for more up-to-date examples. Also which version of python are you using in your conda env? I would recommend trying out with python 3.9 Best regards

bcm-at-zama commented 10 months ago

Yes, you might want to start with the very small example which is given in https://github.com/zama-ai/concrete-ml#a-simple-concrete-ml-example-with-scikit-learn to test your config

bcm-at-zama commented 10 months ago

(I don't see the screenshots)

bcm-at-zama commented 10 months ago

Sorry we don't see attachments, maybe it doesn't work by email? Maybe just copy-paste the text of the stdio, if you can't make it work

fd0r commented 10 months ago

Alright so 3.8 should work okay. Could you please replace execute_in_fhe=True by fhe="execute" ?

fd0r commented 10 months ago

Which version do you have installed on your system? Could you please make sure that you are using the latest version 1.3.0 of Concrete ML.

RomanBredehoft commented 10 months ago

Hello @berhankarabay , Running pip install concrete-ml==1.3.0 in your terminal should update Concrete ML properly !

Also, we recommend you to use virtual environments (ex: https://docs.python.org/3/library/venv.html) if you haven't done so already, it will prevent you having further dependency conflicts in your projects !

berhankarabay commented 10 months ago

Hello again,

I solved the issue, it turns out that my python architecture was incorrect. I fixed it to executable arm64 and installed 1.3.0. The simple example given in your website works now, thank you.