Skip to content

Commit

Permalink
Fix dataloader
Browse files Browse the repository at this point in the history
  • Loading branch information
wulu473 committed Feb 23, 2024
1 parent 9d45849 commit 737340d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ def main(args: Arguments):

print(f"Loaded dataset: {data.features}")

if len(data) == 0:
dataset = TensorDataset(torch.tensor([]), torch.tensor([]))
else:
dataset = TensorDataset(torch.tensor(data["image"]), torch.tensor(data["label"]))

model = CNN.load(args.experiment_dir / args.model_rel_path / "model.pt")

data_loader = DataLoader(dataset, batch_size=args.batch_size, shuffle=False)
data_loader = DataLoader(
data.with_format("torch"),
batch_size=args.batch_size,
shuffle=False
)

device = "cpu" if args.use_cpu else "cuda"

Expand Down
4 changes: 4 additions & 0 deletions privacy_estimates/experiments/attacks/dpd/attack.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
""" Implements the white-box attack of the paper "Tight Auditing of Differentially Private Machine Learning"
[1] Nasr, Milad, Jamie Hayes, Thomas Steinke, Borja Balle, Florian Tramèr, Matthew Jagielski, Nicholas Carlini, and Andreas Terzis. "Tight Auditing of Differentially Private Machine Learning." arXiv preprint arXiv:2302.07956 (2023).
"""
import torch
import numpy as np
from torch.optim import Optimizer
Expand Down

0 comments on commit 737340d

Please sign in to comment.