diff --git a/docs/attacks/index.html b/docs/attacks/index.html index 5021964..fa9f341 100644 --- a/docs/attacks/index.html +++ b/docs/attacks/index.html @@ -45,7 +45,7 @@
mimir.attacks.loss
Straight-forward LOSS attack
Straight-forward LOSS attack, as described in https://ieeexplore.ieee.org/abstract/document/8429311
mimir.attacks.min_k
mimir.attacks.loss
Straight-forward LOSS attack
+Straight-forward LOSS attack, as described in https://ieeexplore.ieee.org/abstract/document/8429311
"""
- Straight-forward LOSS attack
+ Straight-forward LOSS attack, as described in https://ieeexplore.ieee.org/abstract/document/8429311
"""
+import torch as ch
from mimir.attacks.blackbox_attacks import Attack
@@ -37,7 +38,11 @@ Module mimir.attacks.loss
def __init__(self, config, model):
super().__init__(config, model, ref_model=None)
+ @ch.no_grad()
def _attack(self, document, probs, tokens=None, **kwargs):
+ """
+ LOSS-score. Use log-likelihood from model.
+ """
return self.model.get_ll(document, probs=probs, tokens=tokens)
mimir.attacks.min_k
mimir.attacks.min_k
mimir.attacks.neighborhood
mimir.attacks.neighborhood
mimir.attacks.neighborhood
+def create_fill_dictionary(self, data)
+
def create_fill_dictionary(self, data):
+ neigh_config = self.config.neighborhood_config
+ if "t5" in neigh_config.model and neigh_config.random_fills:
+ if not self.config.pretokenized:
+ # TODO: maybe can be done if detokenized, but currently not supported
+ self.ref_model.create_fill_dictionary(data)
+
+def get_mask_model(self)
+
def get_mask_model(self):
+ return self.ref_model
+
def get_neighbors(self, documents, **kwargs)
NeighborhoodAttack
mimir.attacks.reference