Skip to content

Commit

Permalink
Revert "remove huggingface estimator activation hack"
Browse files Browse the repository at this point in the history
This reverts commit 4db7626.

Signed-off-by: Farhan Ahmed <[email protected]>
  • Loading branch information
f4str committed Dec 8, 2023
1 parent b9f5a4d commit d345786
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion art/estimators/classification/hugging_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ def get_activations( # type: ignore
def get_feature(name):
# the hook signature
def hook(model, input, output): # pylint: disable=W0622,W0613
self._features[name] = output
# TODO: this is using the input, rather than the output, to circumvent the fact
# TODO: that flatten is not a layer in pytorch, and the activation defence expects
# TODO: a flattened input. A better option is to refactor the activation defence
# TODO: to not crash if non 2D inputs are provided.
self._features[name] = input

return hook

Expand Down

0 comments on commit d345786

Please sign in to comment.