Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
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: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ The other classes of attacks can be launched in a similar fashion. See the `exam
2. Git clone this repository.
3. Run `poetry install`.

If you'd like to use a Jupyter Notebook environment, run `poetry shell` followed by `jupyter notebook`.

Feel free to join our #privacyraven channel in [Empire Hacking](https://empireslacking.herokuapp.com/) if you need help using or extending PrivacyRaven.
The official pip release will arrive soon.

Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Overview:

+ `example_mnist_cpu.py`
+ `example_mnist_gpu.py`
+ `example_mnist_cpu.py`: Applies a model extraction attack with the copycat synthesizer to an example MNIST model using a CPU
+ `example_mnist_gpu.py`: Applies a model extraction attack with the copycat synthesizer to an example MNIST model using a GPU
7 changes: 5 additions & 2 deletions examples/extract_mnist_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import privacyraven as pr

from privacyraven.utils.data import get_emnist_data
from privacyraven.extraction.core import ModelExtractionAttack
from privacyraven.utils.query import get_target
Expand All @@ -19,13 +20,13 @@

def query_mnist(input_data):
# PrivacyRaven provides built-in query functions
return get_target(model, input_data)
return get_target(model, input_data, (1, 28, 28, 1))


# Obtain seed (or public) data to be used in extraction
emnist_train, emnist_test = get_emnist_data()

# Run a Model Extraction Attack
# Run a model extraction attack
attack = ModelExtractionAttack(
query_mnist,
100,
Expand All @@ -38,3 +39,5 @@ def query_mnist(input_data):
emnist_train,
emnist_test,
)

# Use emnist_train.data and emnist_test.data for unlabeled data
Loading