pytorch/opacus

AttributeError: The following layers do not have gradients

Camelliavin opened this issue · 4 comments

Recently, I have been trying an example of opacus, and the code is here.
when I'm running

python src/federated_main_s2.py --epochs=1 --num_users=1 --frac=1. --local_ep=100 --local_bs=50 --virtual_batch_size=50 --optimizer='sgd' --lr=0.001 --momentum=0.9 --dataset='dr' --dr_from_np=1 --withDP=1 --max_grad_norm=2. --noise_multiplier=1. --delta=1e-4

An error occurred:
image

By the way, the opacus version I am using is v0.13.0. And when I change the version of opacus, it will have other errors. I have tried v0.15.0 and v1.0.0, and the following errors will occur:
1683802352123

It seems like it's an issue with opacus. Can someone solve it? I would be very grateful if this mistake could be resolved.

!pip install opacus==0.14.0
I hope it may work for you. If you see the documents in the link provided in your comment, the exact compatible version is stated somewhere in it.

I assume you have solved this issue. Feel free to re-open it if it is needed.

I have a similar issue, I am using version 0.15.0 and I have yet to solve it. Do you know what what it might be? My intuition is saying I messed up on the backward pass but I am not very sure.

!pip install opacus==0.14.0 I hope it may work for you. If you see the documents in the link provided in your comment, the exact compatible version is stated somewhere in it.

How would this help? can you explain what to do if that solution did not work?