TextAttack icon indicating copy to clipboard operation
TextAttack copied to clipboard

PWWSRen2019 attack run much time

Open Jiang010 opened this issue 4 years ago • 5 comments

I run PSOZang2020 attack in my keras model. But it had run over 1 hours, and I not get any result.

PWWSRen2019 attack code: image

CustomKerasModelWrapper Class : image

my keras architecture of model : image

Jiang010 avatar Oct 05 '22 15:10 Jiang010

Hi @Jiang010 -- thanks for trying TextAttack! PWWS is notoriously extremely slow because it uses an evolutionary algorithm that uses many random samples by default. Do you need to use PWWS? Otherwise I recommend something greedy like TextFooler or TextBugger or maybe DeepWordBug. (Granted, I have no idea what your usecase is-- I'm just talking about runtime here.)

Also, are you using a GPU?

jxmorris12 avatar Oct 05 '22 15:10 jxmorris12

sorry, @jxmorris12 I typing wrong. I have had edited my issue content. My problem is PSOZang2020 attack slowly run. PWWS attack is work for me. PWWS can get good attack result and normally run. In my project, I need as best as use all attack of TextAttack. Currently , only the PWWS can perform normally. BAEGarg2019 not also work.

I am very sure that environment can use GPU. But GPU seem not work well. my environment: ---tensorflow 2.6 ---pytorch 1.12.1 ---NVIDIA GPU 3060

image

image

Jiang010 avatar Oct 05 '22 16:10 Jiang010

Ah yes, well I was getting the two mixed up too. PSO is extremely slow. I don't think BAE should be that slow. You could try doing some benchmarking to figure out exactly what's slowing the attack down.

jxmorris12 avatar Oct 05 '22 18:10 jxmorris12

Hi @jxmorris12 , I might had found my problem. My input data of model are much large (1,4406). So, it make the attack run extremely slow. Thank you for answer my question.

Jiang010 avatar Oct 06 '22 12:10 Jiang010

thank you!!

jxmorris12 avatar Oct 06 '22 17:10 jxmorris12