Skip to content

A Context Aware Approach for Generating Natural Language Attacks.

Notifications You must be signed in to change notification settings

RishabhMaheshwary/contextattack

Repository files navigation

A context aware approach for generating natural language attack.

This repository contains source code for the research work described in our AAAI 2021 paper:

A context aware approach for generating natural language attack

Requirements

  • Pytorch >= 0.4
  • Tensorflow >= 1.0
  • Numpy
  • Python >= 3.6
  • Tensorflow 2.1.0
  • TensorflowHub

Dependencies

  • Download counter-fitted-vectors from here, unzip it and place the txt file in the main directory.
  • Download pretrained BERT for each dataset here, unzip it and place all the folders it in BERT/results/ directory.
  • Download top 50 synonym file from here, unzip it and place the txt file in the main directory.

How to Run:

  • Run the following command to get classification results.
bash bert.sh
  • Run the following command to get inference results.
python run_attack_nli.py

The results will be available in results directory.

Releases

No releases published

Packages

No packages published