Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mvacher opened this issue Aug 21, 2023 · 11 comments
Open

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

mvacher opened this issue Aug 21, 2023 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@mvacher
Copy link

mvacher commented Aug 21, 2023

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

@mvacher mvacher added the bug Something isn't working label Aug 21, 2023
@RomanBredehoft
Copy link
Collaborator

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 !

@fd0r fd0r self-assigned this Aug 23, 2023
@bcm-at-zama
Copy link
Collaborator

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

@bcm-at-zama
Copy link
Collaborator

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
Copy link
Collaborator

fd0r commented Nov 16, 2023

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
Copy link
Collaborator

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
Copy link
Collaborator

(I don't see the screenshots)

@bcm-at-zama
Copy link
Collaborator

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
Copy link
Collaborator

fd0r commented Nov 16, 2023

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

@fd0r
Copy link
Collaborator

fd0r commented Nov 17, 2023

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
Copy link
Collaborator

RomanBredehoft commented Nov 17, 2023

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
Copy link

berhankarabay commented Nov 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants