Skip to main content

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]
...

Metadata

Release files for pyvacy 0.0.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyvacy 0.0.32
File Size Uploaded
pyvacy-0.0.32.tar.gz 10.3 kB Details

Release files / pyvacy-0.0.32.tar.gz

Download URL pyvacy-0.0.32.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
50e5242b720cc5ae075041107702231c3447716c39e0b364ee5490300cd87949
BLAKE2b-256 checksum
How to use checksums
ae1d8dd9852f225d471c4f7248cfd8c01f943c0f968299dd010245b28743ea54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

Release history Release notifications | RSS feed

This release

0.0.32 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page