pyv
pyvacy
pypi i pyvacy
pyv

pyvacy

Differentially Private Optimization for PyTorch 👁🙅‍♀️

by Chris Waites

0.0.32 (see all)
pypi i pyvacy
Readme

PyVacy: Privacy Algorithms for PyTorch

PyVacy provides custom PyTorch opimizers for conducting deep learning in a differentially private manner. Basically TensorFlow Privacy, but for PyTorch.

Getting Started

pip install pyvacy

Example Usage

import torch
from pyvacy import optim, analysis

model = torch.nn.Sequential(...)

optimizer = optim.DPSGD(
    l2_norm_clip=...,
    noise_multiplier=...,
    batch_size=...,
    lr=...,
    momentum=...,
)

epsilon = analysis.moments_accountant(
    N=...,
    batch_size=...
    noise_multiplier=...,
    epochs=...,
    delta=...,
)

for epoch in range(epochs):
    # do training as usual...

Tutorials

python tutorials/mnist.py

Training procedure achieves (3.0, 0.00001)-DP
[Epoch 1/60] [Batch 0/235] [Loss: 2.321049]
[Epoch 1/60] [Batch 10/235] [Loss: 0.952795]
[Epoch 1/60] [Batch 20/235] [Loss: 1.040896]
...

GitHub Stars

125

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

5

OPEN ISSUES

2

OPEN PRs

1
VersionTagPublished
0.0.32
3yrs ago
0.0.31
3yrs ago
0.0.3
3yrs ago
0.0.2
3yrs ago
No alternatives found
No tutorials found
Add a tutorial