pytorch / opacus

Training PyTorch models with differential privacy
https://opacus.ai
Apache License 2.0
1.68k stars 338 forks source link

Change z in PRV accountant to remove Userwarning for log(x<0) #574

Closed alexandresablayrolles closed 1 year ago

alexandresablayrolles commented 1 year ago

Change definition of z = np.log((np.exp(t) + q - 1) / q) to z = np.log(np.where(t > np.log(1 - q), (np.exp(t) + q - 1) / q, 1)) to avoid userwarning in PRV.

facebook-github-bot commented 1 year ago

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

alexandresablayrolles commented 1 year ago

@ffuuugor also, any reason we have 'rdp' as default accoutant in get_noise_multiplier and not 'prv'?

ffuuugor commented 1 year ago

@ffuuugor also, any reason we have 'rdp' as default accoutant in get_noise_multiplier and not 'prv'?

purely historical, I think we just didn't update all the default values when we added prv

facebook-github-bot commented 1 year ago

@ffuuugor merged this pull request in pytorch/opacus@ae44a786d3a104393e961292eee9af2028f20fa8.