Open DSW2001 opened 1 month ago
这是opacus函数的具体用法,他应该是只能使用SGD进行修改
model = Net() optimizer = SGD(model.parameters(), lr=0.05) data_loader = torch.utils.data.DataLoader(dataset, batch_size=1024)
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, )
Reminder
System Info
0.9.0
Reproduction
opacus使用只要对训练函数使用privacy_engine.make_private函数包裹即可,请问对于sft我该去哪里修改?
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
Expected behavior
No response
Others
No response