Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Training PyTorch models with differential privacy
| Date | Stars |
|---|---|
| 2026-07-24 | 1943 |
| 2026-07-25 | 1943 |
| 2026-07-28 | 1943 |
| 2026-07-30 | 1943 |
| 2026-08-09 | 1947 |
| 2026-08-18 | 1951 |
| 2026-08-21 | 1951 |
| 2026-08-25 | 1952 |
| 2026-08-27 | 1953 |
| 2026-08-28 | 1953 |
| 2026-08-30 | 1953 |
| 2026-09-01 | 1953 |
| 2026-09-02 | 1953 |
| 2026-09-03 | 1953 |
| 2026-09-04 | 1954 |
| 2026-09-05 | 1954 |
| 2026-09-09 | 1956 |
| 2026-09-11 | 1956 |
| 2026-09-12 | 1957 |
| 2026-09-14 | 1958 |
| 2026-09-15 | 1959 |
| 2026-09-17 | 1959 |
| 2026-09-18 | 1960 |
| 2026-09-20 | 1960 |
Today
— stars today
This week
+3 stars this week
This month
+9 stars this month
Momentum
0.0
growth rate 0.15%/day
<p align="center"><img src="https://github.com/pytorch/opacus/blob/main/website/static/img/opacus_logo.svg" alt="Opacus" width="500"/></p>
<hr/>
[](https://pepy.tech/projects/opacus)
[](https://github.com/pytorch/opacus/actions/workflows/ci_cpu.yml)
[](https://coveralls.io/github/pytorch/opacus?branch=main)
[](CONTRIBUTING.md)
[](LICENSE)
[Opacus](https://opacus.ai) is a library that enables training PyTorch models
with differential privacy. It supports training with minimal code changes
required on the client, has little impact on training performance, and allows
the client to online track the privacy budget expended at any given moment.
## Target audience
This code release is aimed at two target audiences:
1. ML practitioners will find this to be a gentle introduction to training a
model with differential privacy as it requires minimal code changes.
2. Differential Privacy researchers will find this easy to experiment and tinker
with, allowing them to focus on what matters.
## Latest updates
2024-12-18: We updated this [tutorial](https://github.com/pytorch/opacus/blob/main/tutorials/building_text_classifier.ipynb) to show how [LoRA](https://arxiv.org/abs/2106.09685) and [peft](https://huggingface.co/docs/peft/en/index) library could be used in conjuncture with DP-SGD.
2024-08-20: We introduced [Fast Gradient Clipping](https://arxiv.org/abs/2009.03106) and Ghost Clipping(https://arxiv.org/abs/2110.05679) to Opacus, significantly reducing the memory requirements of DP-SGD. Please refer to our [blogpost](https://pytorch.org/blog/clipping-in-opacus/) for more information.
## Installation
The latest release of Opacus can be installed via `pip`:
```bash
pip install opacus
```
OR, alternatively, via `conda`:
```bash
conda install -c conda-forge opacus
```
You can also install directly from the source for the latest features (along
with its quirks and potentially occasional bugs):
```bash
git clone https://github.com/pytorch/opacus.git
cd opacus
pip install -e .
```
## Getting started
To train your model with differential privacy, all you need to do is to
instantiate a `PrivacyEngine` and pass your model, data_loader, and optimizer to
the engine's `make_private()` method to obtain their private counterparts.
```python
# define your components as usual
model = Net()
optimizer = SGD(model.parameters(), lr=0.05)
data_loader = torch.utils.data.DataLoader(dataset, batch_size=1024)
# enter PrivacyEngine
privacy_engine = PrivacyEngine()
model, optimizer, data_loader = privacy_engine.make_private(
module=model,
optimizer=optimizer,
data_loader=data_loader,
noise_multiplier=1.1,
max_grad_norm=1.0,
)
# Now it's business as usual
```
The
[MNIST example](https://github.com/pytorch/opacus/tree/main/examples/mnist.py)
shows an end-to-end run using Opacus. The
[examples](https://github.com/pytorch/opacus/tree/main/examples/) folder
contains more such examples.
## Learn more
### Interactive tutorials
We've built a series of IPython-based tutorials as a gentle introduction to
training models with privacy and using various Opacus features.
- [Building text classifier with Differential Privacy on BERT](https://github.com/pytorch/opacus/blob/main/tutorials/building_text_classifier.ipynb)
- [Building an Image Classifier with Differential Privacy](https://github.com/pytorch/opacus/blob/main/tutorials/building_image_classifier.ipynb)
- [Training a differentially private LSTM model for name classification](https://github.com/pytorch/opacus/blob/main/tutorials/building_lstm_name_classifier.ipynb)
- [Opacus Guide: Introduction to advancedExcerpt of 6,681 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:2ce3c4743c5be28b, topic:deep-learning, topic:neural-network, topic:pytorch