owkin / FLamby

Cross-silo Federated Learning playground in Python. Discover 7 real-world federated datasets to test your new FL strategies and try to beat the leaderboard.
https://owkin.github.io/FLamby/
MIT License
201 stars 23 forks source link

RuntimeError: Discrete mean differs significantly from continuous mean. #301

Open Jieun316 opened 8 months ago

Jieun316 commented 8 months ago

When I run dp_example/create_fed_heart_disease_dp_results.py, I got this error: File "/home/dbswldms316/FLamby/flamby/strategies/fed_avg.py", line 103, in __init__ self.models_list = [ File "/home/dbswldms316/FLamby/flamby/strategies/fed_avg.py", line 104, in <listcomp> _Model( File "/home/dbswldms316/FLamby/flamby/strategies/utils.py", line 158, in __init__ ) = privacy_engine.make_private_with_epsilon( File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/privacy_engine.py", line 517, in make_private_with_epsilon noise_multiplier=get_noise_multiplier( File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/utils.py", line 70, in get_noise_multiplier eps = accountant.get_epsilon(delta=target_delta, **kwargs) File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 97, in get_epsilon dprv = self._get_dprv(eps_error=eps_error, delta_error=delta_error) File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 125, in _get_dprv dprvs = [discretize(tprv, domain) for tprv in tprvs] File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/prv.py", line 125, in <listcomp> dprvs = [discretize(tprv, domain) for tprv in tprvs] File "/home/dbswldms316/anaconda3/lib/python3.9/site-packages/opacus/accountants/analysis/prv/prvs.py", line 173, in discretize raise RuntimeError("Discrete mean differs significantly from continuous mean.") RuntimeError: Discrete mean differs significantly from continuous mean.

I don't know why :(

jeandut commented 7 months ago

Hi @Jieun316 ! I don't know why it happened to you now but I ran into this error myself in another project (https://github.com/pytorch/opacus/issues/604) and I think either using a smaller epsilon or a more up to date version of opacus should do the trick. I'll try to see if I can reproduce the error.