alecthomas / voluptuous

CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
https://pypi.org/project/voluptuous
BSD 3-Clause "New" or "Revised" License
1.81k stars 219 forks source link

ValueError: Unsupported dataset schema #449

Closed marwanomar1 closed 2 years ago

marwanomar1 commented 2 years ago

I am running adversarial training on NLP models and I am getting an error " ValueError: Unsupported dataset schema ". When I run the following code: import textattack import transformers from textattack.datasets import HuggingFaceDataset

model = transformers.AutoModelForSequenceClassification.from_pretrained("bert-base-uncased") tokenizer = transformers.AutoTokenizer.from_pretrained("bert-base-uncased") model_wrapper = textattack.models.wrappers.HuggingFaceModelWrapper(model, tokenizer)

We only use DeepWordBugGao2018 to demonstration purposes.

attack = textattack.attack_recipes.DeepWordBugGao2018.build(model_wrapper) train_dataset = HuggingFaceDataset('squad', split='train') eval_dataset = HuggingFaceDataset('squad', split='validation')

Train for 3 epochs with 1 initial clean epochs, 1000 adversarial examples per epoch, learning rate of 5e-5, and effective batch size of 32 (8x4).

training_args = textattack.TrainingArgs( num_epochs=3, num_clean_epochs=1, num_train_adv_examples=1000, learning_rate=5e-5, per_device_train_batch_size=8, gradient_accumulation_steps=4, log_to_tb=True, )

trainer = textattack.Trainer( model_wrapper, "classification", attack,

eval_dataset,
training_args

) trainer.train() @jxmorris12

jxmorris12 commented 2 years ago

Hi @marwanomar1 - you posted this on the wrong project, it's supposed to be on https://github.com/QData/TextAttack/issues/

spacegaier commented 2 years ago

See previous comment. OP now created an issue in the correct repo https://github.com/QData/TextAttack/issues/529.