OpenBackdoor
OpenBackdoor copied to clipboard
errors regarding the POR attack
Here is the code I'm trying to run (a slight modification version of the demo provided):
import openbackdoor as ob
from openbackdoor import load_dataset
victim = ob.PLMVictim(model="bert", path="bert-base-uncased")
attacker = ob.attackers.PORAttacker()
poison_dataset = load_dataset(name="sst-2")
victim = attacker.attack(victim, poison_dataset)
target_dataset = load_dataset(name="sst-2")
attacker.eval(victim, target_dataset)
1. Signature of method 'PORPoisoner.call()' does not match signature of base method in class 'Poisoner'
Line 67 in openbackdoor/attackers/poisoners/por_poisoner.py
: def __call__(self, model, data: Dict, mode: str)
However,
Line 57 in openbackdoor/attackers/poisoners/poisoner.py
, def __call__(self, data: Dict, mode: str)
This will lead to TypeError: __call__() takes 3 positional arguments but 4 were given
when using the PORPoisoner
After modifying the signature, I got the following errors:
2. AttributeError: 'PLMVictim' object has no attribute 'save'
This is at line 36, in openbackdoor/attackers/por_attacker.py
.
3. TypeError: 'NoneType' object is not subscriptable
line 37, openbackdoor/attackers/por_attacker.py
I'm not sure if these are bugs or I'm not using the PORAttacker in the designed way. Could the authors of this repo provide a minimal working example for the PORAttacker?