Skip to content

deps: bump Opacus to 1.6.0#278

Merged
mplatzer merged 2 commits into
mainfrom
cursor/opacus-1.6.0-upgrade-7c69
May 6, 2026
Merged

deps: bump Opacus to 1.6.0#278
mplatzer merged 2 commits into
mainfrom
cursor/opacus-1.6.0-upgrade-7c69

Conversation

@mplatzer
Copy link
Copy Markdown
Contributor

@mplatzer mplatzer commented May 5, 2026

Summary

This change raises the Opacus dependency from >=1.5.4 to >=1.6.0 and updates uv.lock so resolution picks Opacus 1.6.0.

CI fix (nested tensors + DP)

CI failed on run-tests-cpu-unit-sequential with:

test_tabular_sequential.py::TestTabularTrainingStrategy::test_training_strategy[differential_privacy1]
NotImplementedError: aten::new_empty on NestedTensorCPU

Opacus per-sample gradient computation does not support nested tensors for sequential CTXSEQ batches. When DP is enabled, the tabular BatchCollator now collates CTXSEQ as padded dense tensors (-1 padding, matching SequentialContextEmbedders), and SequentialContextEmbedders.forward only calls torch.nested.to_padded_tensor when the input is actually nested (so dense DP batches work). Non-DP sequential training keeps nested CTXSEQ collate.

Verification

  • pytest tests/end_to_end/test_tabular_sequential.py::TestTabularTrainingStrategy::test_training_strategy (both DP and non-DP parametrizations)
  • pytest tests/unit — 236 passed

Optional follow-ups

Evaluating wrap_model=False for language DP is handled in a separate stacked PR (#279).

Open in Web Open in Cursor 

Raise the Opacus floor and refresh uv.lock so installs resolve to 1.6.0,
which adds non-wrapping mode, FSDP/mixed-precision DP improvements, and
assorted accountant/clipping fixes while maintaining torch>=2.6 alignment.

Co-authored-by: Michi Platzer <michael.platzer@gmail.com>
Opacus 1.x per-sample gradient hooks hit NotImplementedError on NestedTensorCPU
(aten::new_empty). For DP training, collate CTXSEQ as padded dense tensors with -1
padding; SequentialContextEmbedders already masks -1 and maps to embedding index 0.

Non-DP sequential training keeps nested CTXSEQ collate for unchanged behavior.

Co-authored-by: Michi Platzer <michael.platzer@gmail.com>
@mplatzer mplatzer marked this pull request as ready for review May 6, 2026 06:23
@mplatzer mplatzer merged commit a83f155 into main May 6, 2026
7 checks passed
@mplatzer mplatzer deleted the cursor/opacus-1.6.0-upgrade-7c69 branch May 6, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants