Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Follow the steps below to start contributing:
4. Set up the environment in dev mode after following steps in [Quick Start](../README.md#-quickstart). This installs other packages such as `ruff`, `precommit` etc.

```bash
pip install .[dev]
pip install ".[dev]"
```

5. Develop the features in your fork/branch.
Expand Down
2 changes: 1 addition & 1 deletion src/evals/metrics/mia/min_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def compute_batch_values(self, batch):

def compute_score(self, sample_stats):
"""Score single sample using min-k negative log probs scores attack."""
lp = sample_stats.cpu().numpy()
lp = sample_stats.float().cpu().numpy()
if lp.size == 0:
return 0

Expand Down
6 changes: 3 additions & 3 deletions src/evals/metrics/mia/min_k_plus_plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def compute_score(self, sample_stats):

# Handle numerical stability
sigma = torch.clamp(sigma, min=1e-6)
scores = (target_prob.cpu().numpy() - mu.cpu().numpy()) / torch.sqrt(
sigma
).cpu().numpy()
scores = (
target_prob.float().cpu().numpy() - mu.float().cpu().numpy()
) / torch.sqrt(sigma).cpu().numpy()

# Take bottom k% as the attack score
num_k = max(1, int(len(scores) * self.k))
Expand Down