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

How to set max_compositions #19

Closed
hlzhang109 opened this issue Jun 10, 2022 · 3 comments
Closed

How to set max_compositions #19

hlzhang109 opened this issue Jun 10, 2022 · 3 comments

Comments

@hlzhang109
Copy link

Hi Chen, do you know how to set the max_compositions/steps param? The default at

self.steps = 0 # Tracks privacy spending.

is 0 but would raise an error

private-transformers/private_transformers/privacy_utils/accounting/gdp_accounting.py:33: RuntimeWarning: invalid value encountered in double_scalars return norm.cdf(-eps / mu + mu / 2) - np.exp(eps) * norm.cdf(-eps / mu - mu / 2)
rv_accountant/accountant.py:55: RuntimeWarning: divide by zero encountered in double_scalars mesh_size = 2*eps_error / np.sqrt(2*max_compositions*np.log(2/eta0))
@hlzhang109 hlzhang109 changed the title How to set How to set max_compositions Jun 10, 2022
@lxuechen
Copy link
Owner

Great point. Ideally, we'd only call the privacy accounting function after we've done a gradient update, in which case we'd get strictly positive self.steps (note self.steps is updated in the step function).

My code runs a prelim. eval. before any parameter update just to check the initial performance model of the model. This produces a warning you'd get, since the privacy accounting code is also ran. This doesn't really affect the correctness however.

@lxuechen
Copy link
Owner

lxuechen commented Jun 10, 2022

By the way, self.steps is not the max composition steps, but rather the total number of updates already performed by the optimizer.

@hlzhang109
Copy link
Author

Thanks Chen for the explanation! I set the dataset size too small when debugging so self.steps didn't get updated as gradient_accumulation_steps was never reached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants