facebookresearch / text-adversarial-attack

Repo for arXiv preprint "Gradient-based Adversarial Attacks against Text Transformers"
Other
96 stars 11 forks source link

Load DPBEDIA dataset error: "TypeError: unsupported operand type(s) for -: 'str' and 'int'" #4

Closed MackBlackburn closed 2 years ago

MackBlackburn commented 2 years ago

After downloading the DBPEDIA dataset from kaggle I tried to follow the steps but this error shows up after running text_classification.py:

/text-adversarial-attack/src/utils.py", line 28, in <lambda>
    examples["label"] = list(map(lambda x: x - 1, examples["label"]))
TypeError: unsupported operand type(s) for -: 'str' and 'int'
rohan-ajwani commented 2 years ago

Hi, I faced the same issue. Were you able to resolve it by any chance?

malghanim commented 2 years ago

I am not sure but probably the authors used a different version than the one used in Kaggle. I used this one located in the following link and it worked just fine. https://s3.amazonaws.com/fast-ai-nlp/dbpedia_csv.tgz

Hope that helps.

cg563 commented 2 years ago

I am not sure but probably the authors used a different version than the one used in Kaggle. I used this one located in the following link and it worked just fine. https://s3.amazonaws.com/fast-ai-nlp/dbpedia_csv.tgz

Hope that helps.

+1. Please use the dataset from that link instead of Kaggle.