You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve documentation of Github and Website (#723)
Summary:
Pull Request resolved: #723
Improve the documentation of Github and Opacus website, specifically:
1. Added a "Latest updates" section in Github `readme`.
2. Updated outdated documentation, and highlighted new features like Ghost clipping.
3. Fixed the API library from the website which did not include some newly added files (e.g., `fast_gradient_clipping_utils`).
Reviewed By: iden-kalemaj
Differential Revision: D68637848
fbshipit-source-id: d8a46d88f13e68e858787dc0ff983adcb4cac39c
Copy file name to clipboardexpand all lines: README.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,13 @@ This code release is aimed at two target audiences:
23
23
2. Differential Privacy researchers will find this easy to experiment and tinker
24
24
with, allowing them to focus on what matters.
25
25
26
+
27
+
## Latest updates
28
+
29
+
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.
30
+
31
+
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.
32
+
26
33
## Installation
27
34
28
35
The latest release of Opacus can be installed via `pip`:
@@ -76,23 +83,16 @@ shows an end-to-end run using Opacus. The
We've built a series of IPython-based tutorials as a gentle introduction to
91
91
training models with privacy and using various Opacus features.
92
92
93
+
-[Building text classifier with Differential Privacy on BERT](https://github.com/pytorch/opacus/blob/main/tutorials/building_text_classifier.ipynb)
93
94
-[Building an Image Classifier with Differential Privacy](https://github.com/pytorch/opacus/blob/main/tutorials/building_image_classifier.ipynb)
94
95
-[Training a differentially private LSTM model for name classification](https://github.com/pytorch/opacus/blob/main/tutorials/building_lstm_name_classifier.ipynb)
95
-
-[Building text classifier with Differential Privacy on BERT](https://github.com/pytorch/opacus/blob/main/tutorials/building_text_classifier.ipynb)
96
96
-[Opacus Guide: Introduction to advanced features](https://github.com/pytorch/opacus/blob/main/tutorials/intro_to_advanced_features.ipynb)
97
97
-[Opacus Guide: Grad samplers](https://github.com/pytorch/opacus/blob/main/tutorials/guide_to_grad_sampler.ipynb)
98
98
-[Opacus Guide: Module Validator and Fixer](https://github.com/pytorch/opacus/blob/main/tutorials/guide_to_module_validator.ipynb)
@@ -119,12 +119,12 @@ Consider citing the report if you use Opacus in your papers, as follows:
119
119
If you want to learn more about DP-SGD and related topics, check out our series
120
120
of blogposts and talks:
121
121
122
+
-[Enabling Fast Gradient Clipping and Ghost Clipping in Opacus](https://pytorch.org/blog/clipping-in-opacus/)
122
123
-[Differential Privacy Series Part 1 | DP-SGD Algorithm Explained](https://medium.com/pytorch/differential-privacy-series-part-1-dp-sgd-algorithm-explained-12512c3959a3)
123
124
-[Differential Privacy Series Part 2 | Efficient Per-Sample Gradient Computation in Opacus](https://medium.com/pytorch/differential-privacy-series-part-2-efficient-per-sample-gradient-computation-in-opacus-5bf4031d9e22)
124
125
-[PriCon 2020 Tutorial: Differentially Private Model Training with Opacus](https://www.youtube.com/watch?v=MWPwofiQMdE&list=PLUNOsx6Az_ZGKQd_p4StdZRFQkCBwnaY6&index=52)
125
126
-[Differential Privacy on PyTorch | PyTorch Developer Day 2020](https://www.youtube.com/watch?v=l6fbl2CBnq0)
126
127
-[Opacus v1.0 Highlights | PyTorch Developer Day 2021](https://www.youtube.com/watch?v=U1mszp8lzUI)
127
-
-[Enabling Fast Gradient Clipping and Ghost Clipping in Opacus](https://pytorch.org/blog/clipping-in-opacus/)
Copy file name to clipboardexpand all lines: docs/faq.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,8 @@ Yes! Opacus is open-source for public use, and it is licensed under the [Apache
13
13
14
14
## How can I report a bug or ask a question?
15
15
16
-
You can report bugs by submitting GitHub issues. To submit a GitHub issue, please [click here](https://github.com/pytorch/opacus/issues).
17
-
You can ask questions in our dedicated PyTorch [Discussion Forum](https://discuss.pytorch.org/c/opacus/29). We actively monitor questions in the PyTorch forums with the category `Opacus`.
16
+
You can report bugs or ask questions by submitting GitHub issues. To submit a GitHub issue, please [click here](https://github.com/pytorch/opacus/issues).
17
+
<!--You can ask questions in our dedicated PyTorch [Discussion Forum](https://discuss.pytorch.org/c/opacus/29). We actively monitor questions in the PyTorch forums with the category `Opacus`.-->
18
18
19
19
## I'd like to contribute to Opacus. How can I do that?
20
20
@@ -76,7 +76,7 @@ If these interventions don’t help (or the model starts to converge but its pri
76
76
77
77
## How to deal with out-of-memory errors?
78
78
79
-
Dealing with per-sample gradients will inevitably put more pressure on your memory: after all, if you want to train with batch size 64, you are looking to keep 64 copies of your parameter gradients. The first sanity check to do is to make sure that you don’t go out of memory with "standard" training (without DP). That should guarantee that you can train with batch size of 1 at least. Then, you can check your memory usage with e.g. `nvidia-smi` as usual, gradually increasing the batch size until you find your sweet spot. Note that this may mean that you still train with small batch size, which comes with its own training behavior (i.e. higher variance between batches). Training with larger batch sizes can be beneficial, and we built `virtual_step` to make this possible while still memory efficient (see *what is virtual batch size* in these FAQs).
79
+
Dealing with per-sample gradients will inevitably put more pressure on your memory: after all, if you want to train with batch size 64, you are looking to keep 64 copies of your parameter gradients. The first sanity check to do is to make sure that you don’t go out of memory with "standard" training (without DP). That should guarantee that you can train with batch size of 1 at least. Then, you can check your memory usage with e.g. `nvidia-smi` as usual, gradually increasing the batch size until you find your sweet spot. Note that this may mean that you still train with small batch size, which comes with its own training behavior (i.e. higher variance between batches). Training with larger batch sizes can be beneficial. To this end, we built [Fast Gradient Clipping](https://pytorch.org/blog/clipping-in-opacus/) and `virtual_step`(see *what is virtual batch size* in these FAQs) to make DP-SGD memory efficient.
80
80
81
81
## What does epsilon=1.1 really mean? How about delta?
Copy file name to clipboardexpand all lines: tutorials/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# Tutorials
2
-
This folder contains multiple tutorials to get you started on training differentially private models!
2
+
This folder contains multiple tutorials to get you started on training differentially private models! We recommend "building_text_classifier.ipynb" to experiment with latest Opacus features such as Fast Gradient Clipping, LoRA, and fine-tuning Hugging Face Transformers.
3
3
4
4
Note that you may not have all the required packages. You can install opacus's dev version, which will
5
5
bring in all the required packages in these tutorials:
Efficient Per-Sample Gradient Computation for More Layers in Opacus
74
+
Efficient Per-Sample Gradient Computation for More Layers in
75
+
Opacus
73
76
</a>
74
77
</li>
75
78
<li>
@@ -81,13 +84,18 @@ class TutorialHome extends React.Component {
81
84
</li>
82
85
</ol>
83
86
<h4>Videos*</h4>
84
-
<p>* Note that Opacus API has changed over time and some of the code samples and demos in the videos may not work. The concepts presented in the videos though are concrete and still valid.</p>
87
+
<p>
88
+
* Note that Opacus API has changed over time and some of the code
89
+
samples and demos in the videos may not work. The concepts
90
+
presented in the videos though are concrete and still valid.
0 commit comments