tensorflow / privacy

Library for training machine learning models with privacy for training data
Apache License 2.0
1.92k stars 447 forks source link

No module named 'tensorflow_privacy.privacy.privacy_tests #168

Closed tkangxun closed 2 years ago

tkangxun commented 3 years ago

The codelabs in the membership inference attack can't work. I am unable to access the privacy_tests packages from tensorflow_privacy.privacy. From the notebook the error is as follows:

Collecting git+https://github.com/tensorflow/privacy Cloning https://github.com/tensorflow/privacy to /tmp/pip-req-build-3wtrapn Running command git clone -q https://github.com/tensorflow/privacy /tmp/pip-req-build-3wtrapn Requirement already satisfied (use --upgrade to upgrade): tensorflow-privacy==0.6.0 from git+https://github.com/tensorflow/privacy in /usr/local/lib/python3.7/dist-packages Requirement already satisfied: scipy>=0.17 in /usr/local/lib/python3.7/dist-packages (from tensorflow-privacy==0.6.0) (1.4.1) Requirement already satisfied: tensorflow-estimator>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow-privacy==0.6.0) (2.5.0) Requirement already satisfied: mpmath in /usr/local/lib/python3.7/dist-packages (from tensorflow-privacy==0.6.0) (1.2.1) Requirement already satisfied: dm-tree~=0.1.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow-privacy==0.6.0) (0.1.6) Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.7/dist-packages (from scipy>=0.17->tensorflow-privacy==0.6.0) (1.19.5) Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.7/dist-packages (from dm-tree~=0.1.1->tensorflow-privacy==0.6.0) (1.15.0) Building wheels for collected packages: tensorflow-privacy Building wheel for tensorflow-privacy (setup.py) ... done Created wheel for tensorflow-privacy: filename=tensorflow_privacy-0.6.0-cp37-none-any.whl size=162478 sha256=a7d02a1b9a7f93da94c276e26933123b5d10fa39c752d53ff78c38d377d07270 Stored in directory: /tmp/pip-ephem-wheel-cache-juyfm3g4/wheels/8a/e4/14/41d16468ac11ec804bd21cfb75fc2e24f96b9e4c5af778f576 Successfully built tensorflow-privacy

ModuleNotFoundError Traceback (most recent call last)

in () 1 get_ipython().system('pip3 install git+https://github.com/tensorflow/privacy') 2 ----> 3 from tensorflow_privacy.privacy.privacy_tests.membership_inference_attack import membership_inference_attack as mia ModuleNotFoundError: No module named 'tensorflow_privacy.privacy.privacy_tests' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. ---------------------------------------------------------------------------
CdavM commented 2 years ago

Hello, sorry for the late reply. I hope this was fixed by adding the init.py file, can you see if it works now and re-open if needed?

Thank you!!