fjxmlzn / DoppelGANger

[IMC 2020 (Best Paper Finalist)] Using GANs for Sharing Networked Time Series Data: Challenges, Initial Promise, and Open Questions
http://arxiv.org/abs/1909.13403
BSD 3-Clause Clear License
296 stars 75 forks source link

DP_Training #23

Closed fxctydfty closed 3 years ago

fxctydfty commented 3 years ago

Hey, I am trying to train the WWT dataset using "example_dp_training". I encountered below issue although I installed Tensorflow Differential-Privacy library from here [https://github.com/tensorflow/privacy]. Thanks in advance for your help.

Error Log: WARNING:tensorflow:From C:\Downloads\DoppelGANger-master\example_dp_training\gan_task.py:84: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From C:\Downloads\DoppelGANger-master\example_dp_training\gan_task.py:85: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2021-06-14 22:34:56.219546: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 (50000, 550, 1) (50000, 14) (50000, 550) (50000, 550, 3) 2 Traceback (most recent call last): File "C:\Anaconda3\envs\dopple_working\Scripts\start_gpu_task-script.py", line 33, in sys.exit(load_entry_point('GPUTaskScheduler', 'console_scripts', 'start_gpu_task')()) File "c:\downloads\gputaskscheduler-master\gpu_task_scheduler\start_gpu_task.py", line 23, in main worker.main() File "C:\Downloads\DoppelGANger-master\example_dp_training\gan_task.py", line 121, in main dp_l2_norm_clip=self._config["dp_l2_norm_clip"]) File "..\gan\doppelganger.py", line 191, in init raise RuntimeError('tensorflow_privacy should be installed for' RuntimeError: tensorflow_privacy should be installed for DP training

fjxmlzn commented 3 years ago

Could you please show the output of pip list?

fxctydfty commented 3 years ago

I run the below command and got the error: %run binary_class_head.py AttributeError: module 'tensorflow_estimator.python.estimator.api._v1.estimator' has no attribute 'BinaryClassHead'

fxctydfty commented 3 years ago

Package Version Location


absl-py 0.12.0 argon2-cffi 20.1.0 astor 0.8.1 async-generator 1.10 attrs 21.2.0 backcall 0.2.0 bleach 3.3.0 cached-property 1.5.2 certifi 2021.5.30 cffi 1.14.5 colorama 0.4.4 coverage 5.5 cycler 0.10.0 Cython 0.29.23 decorator 5.0.9 defusedxml 0.7.1 dill 0.3.3 dm-tree 0.1.6 entrypoints 0.3 gast 0.2.2 google-pasta 0.1.6 GPUTaskScheduler 0.1.0 c:\downloads\gputaskscheduler-master grpcio 1.36.1 h5py 3.2.1 importlib-metadata 3.10.0 ipykernel 5.3.4 ipython 7.22.0 ipython-genutils 0.2.0 jedi 0.17.0 Jinja2 3.0.0 jsonschema 3.2.0 jupyter-client 6.1.12 jupyter-core 4.7.1 jupyterlab-pygments 0.1.2 Keras-Applications 1.0.8 Keras-Preprocessing 1.1.2 kiwisolver 1.3.1 Markdown 3.3.4 MarkupSafe 2.0.1 matplotlib 3.4.2 mistune 0.8.4 mkl-fft 1.3.0 mkl-random 1.1.1 mkl-service 2.3.0 mpmath 1.2.1 multiprocess 0.70.11.1 nbclient 0.5.3 nbconvert 6.0.7 nbformat 5.1.3 nest-asyncio 1.5.1 notebook 6.4.0 numpy 1.19.2 packaging 20.9 pandas 1.2.4 pandocfilters 1.4.3 parso 0.8.2 pathos 0.2.7 patsy 0.5.1 pickleshare 0.7.5 Pillow 8.2.0 pip 21.1.2 pox 0.2.9 ppft 1.6.6.3 prometheus-client 0.11.0 prompt-toolkit 3.0.17 protobuf 3.14.0 pycparser 2.20 Pygments 2.9.0 pyparsing 2.4.7 pyreadline 2.1 pyrsistent 0.17.3 python-dateutil 2.8.1 pytz 2021.1 pywin32 227 pywinpty 0.5.7 pyzmq 20.0.0 scipy 1.6.2 Send2Trash 1.5.0 setuptools 52.0.0.post20210125 six 1.15.0 statsmodels 0.12.2 tensorboard 1.14.0 tensorflow 1.14.0 tensorflow-estimator 2.5.0 tensorflow-privacy 0.6.0 c:\downloads\doppelganger-master\privacy termcolor 1.1.0 terminado 0.9.4 testpath 0.4.4 torch 1.3.1 tornado 6.1 tqdm 4.61.0 traitlets 5.0.5 typing-extensions 3.7.4.3 wcwidth 0.2.5 webencodings 0.5.1 Werkzeug 1.0.1 wheel 0.36.2 wincertstore 0.2 wrapt 1.12.1 zipp 3.4.1

fjxmlzn commented 3 years ago

I think binary_class_head.py you ran is code inside TensorFlow privacy. So I guess it might be a compatibility problem between TF/TF-privacy/TF-estimator?

Is there any error when you do from tensorflow_privacy.privacy.optimizers import dp_optimizer and from tensorflow_privacy.privacy.analysis.compute_dp_sgd_privacy_lib import compute_dp_sgd_privacy directly in Python command line?

fxctydfty commented 3 years ago

The same error: AttributeError: module 'tensorflow_estimator.python.estimator.api._v1.estimator' has no attribute 'BinaryClassHead' But if I run 2nd time (both of them), the error is gone.

fxctydfty commented 3 years ago

Hey Now, its running. I changed the code in doppleganger.py. At last the epoch starts. I will let you know if it finished the training successfully.

fjxmlzn commented 3 years ago

In that case, it should be some issues with TensorFlow Privacy, instead of DoppelGANger, since these two lines are just simply loading TF Privacy. Comparing the libraries you installed to the requirements of TF Privacy, I don't see any problems. And I didn't experience this error before. Maybe it will be more helpful to ask about this error to TF Privacy's authors on TF Privacy's issue page?

fxctydfty commented 3 years ago

I am trying to reproduce the Figure-16 from the paper. Could you please let me know the hyperparameters you used for the figure. Thanks in advance.

fjxmlzn commented 3 years ago

Hey Now, its running. I changed the code in doppleganger.py. At last the epoch starts. I will let you know if it finished the training successfully.

Oh I see. What did you change, by loading the libraries twice? Though I am still curious about what caused this error.

fxctydfty commented 3 years ago

Yes.

fxctydfty commented 3 years ago

Hey Now, its running. I changed the code in doppleganger.py. At last the epoch starts. I will let you know if it finished the training successfully.

Oh I see. What did you change, by loading the libraries twice? Though I am still curious about what caused this error.

I will open an issue on TF Privacy's page to know more about the error.

fjxmlzn commented 3 years ago

I am trying to reproduce the Figure-16 from the paper. Could you please let me know the hyperparameters you used for the figure. Thanks in advance.

By exactly the default configuration in https://github.com/fjxmlzn/DoppelGANger/blob/master/example_dp_training/config.py (so you don't need to change anything). The data for drawing the figure is from the last iteration.

fxctydfty commented 3 years ago

Hey, Thanks for your continuous support. dp_training is working fine. In the paper Section 6.2: Differential Privacy you mentioned that the result showed in the figure 16 is based on epoch 19th. To reproduce the same figure-16 I should run for 20th epoch, right? image This figure is drawn from 14th epoch and epsilon 0.55. Thanks again for your help.

fjxmlzn commented 3 years ago

The code is for reproducing the latest arxiv version: https://arxiv.org/pdf/1909.13403.pdf. We lost the DP code that we used for IMC version, so we have re-implemented it and updated the results on arxiv. (Their results look similar and the takeaways are totally the same, but we just wanted to make sure it is reproducible so we updated it.)

fxctydfty commented 3 years ago

Thanks for your help.