forked from meta-pytorch/opacus
-
Notifications
You must be signed in to change notification settings - Fork 0
Make poisson samples to skip empty batches completely #7
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
Draft
evgri243
wants to merge
16
commits into
jbr-main
Choose a base branch
from
evgri243/skip-empty-batches
base: jbr-main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sistent batch structure Mark tests incompatible with new empty batch handling as skipped
- Increased tolerance for gradient comparison test from `1e-7` to `2e-7` in `conv2d_test.py`. - Added GRU validator imports in `validators/__init__.py`. - Disabled downloading of pretrained weights in PrivacyEngine test.
- Introduced `PrivacyEngineHookBased` for enhancing compatibility with transformer models by avoiding GradSampleModule wrapping. - Added `HookController` to manage privacy hooks without modifying model wrapping. - Provided a detailed example (`hook_based_example.py`) showcasing usage with transformer models. - Implemented comprehensive unit tests to validate the new hook-based approach and features.
- Enhanced unittest coverage with a new test suite `privacy_engine_hook_based_comprehensive_test.py`, including deterministic runs, noise scheduling, per-layer clipping, checkpoint loading, and model compatibility validation. - Improved an existing test to clarify behavior treating mock DDP models differently from real DDP by updating comments and assertions.
- Introduced `privacy_engine_hook_based_adaptive_clipping_test.py` to extend unittest coverage. - Verified compatibility of adaptive clipping with AdaClipDPOptimizer and ghost clipping modes. - Added tests for parameter validation, clipbound updates, unclipped gradient tracking, convergence behavior, and fixed vs adaptive clipping comparisons.
…ed `PrivacyEngine`. - Deleted `FINAL_TEST_STRATEGY.md` and `IMPLEMENTATION_SUMMARY.md` as they are no longer needed. - Cleaned up outdated testing and implementation documentation.
- Replaced `HookController` with `GradSampleController` for managing hooks in the model. - Updated `PrivacyEngineHookBased` to `PrivacyEngineGradSampleController`. - Refactored examples, tests, and documentation to reflect the transition. - Added `wrap_model_in_controller` and `get_gsc_class` utility functions for enhancing API usability. - Improved per-sample gradient computation with a new `GradSampleController` implementation, retaining compatibility with complex models.
- Introduced `PrivacyEngineGradSampleController` along with corresponding imports in `opacus/__init__.py`. - Expanded documentation in `README.md` to cover usage, limitations, and comparisons of GradSampleController for per-sample gradient computation.
d86676f to
60a6130
Compare
evgri243
added a commit
that referenced
this pull request
Oct 22, 2025
- Implemented TP-aware gradient norm computation using `implicit_replication`. - Extended gradient samplers (e.g., Linear, Embedding, InstanceNorm) to handle mixed DTensor/Tensor operations. - Updated `PrivacyEngineGradSampleController` for TP support. - Added LLaMA examples demonstrating TP and privacy integration.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.