1
0
mirror of https://github.com/QData/TextAttack.git synced 2021-10-13 00:05:06 +03:00

change --dataset-from-datasets to --dataset-from-huggingface

This commit is contained in:
Jin Yong Yoo
2020-09-30 00:32:24 -04:00
parent 5da0f427da
commit 88024e1f49
7 changed files with 9 additions and 9 deletions

View File

@@ -227,7 +227,7 @@ textattack train --model bert-base-uncased --dataset glue^cola --batch-size 32 -
### `textattack peek-dataset`
To take a closer look at a dataset, use `textattack peek-dataset`. TextAttack will print some cursory statistics about the inputs and outputs from the dataset. For example, `textattack peek-dataset --dataset-from-datasets snli` will show information about the SNLI dataset from the NLP package.
To take a closer look at a dataset, use `textattack peek-dataset`. TextAttack will print some cursory statistics about the inputs and outputs from the dataset. For example, `textattack peek-dataset --dataset-from-huggingface snli` will show information about the SNLI dataset from the NLP package.
### `textattack list`
@@ -268,11 +268,11 @@ and datasets from the [`datasets` package](https://github.com/huggingface/datase
and attacking a pre-trained model and dataset:
```bash
textattack attack --model-from-huggingface distilbert-base-uncased-finetuned-sst-2-english --dataset-from-datasets glue^sst2 --recipe deepwordbug --num-examples 10
textattack attack --model-from-huggingface distilbert-base-uncased-finetuned-sst-2-english --dataset-from-huggingface glue^sst2 --recipe deepwordbug --num-examples 10
```
You can explore other pre-trained models using the `--model-from-huggingface` argument, or other datasets by changing
`--dataset-from-datasets`.
`--dataset-from-huggingface`.
#### Loading a model or dataset from a file

View File

@@ -65,7 +65,7 @@
}
],
"source": [
"!textattack peek-dataset --dataset-from-datasets snli"
"!textattack peek-dataset --dataset-from-huggingface snli"
]
},
{

View File

@@ -131,6 +131,6 @@ whatever dataset you're working with. Whether you're loading a dataset of your
own from a file, or one from NLP, you can use `textattack peek-dataset` to
see some basic information about the dataset.
For example, use `textattack peek-dataset --dataset-from-datasets glue^mrpc` to see
For example, use `textattack peek-dataset --dataset-from-huggingface glue^mrpc` to see
information about the MRPC dataset (from the GLUE set of datasets). This will
print statistics like the number of labels, average number of words, etc.

View File

@@ -1,4 +1,4 @@
#!/bin/bash
# Shows how to attack a DistilBERT model fine-tuned on SST2 dataset *from the
# huggingface model repository& using the DeepWordBug recipe and 10 examples.
textattack attack --model-from-huggingface distilbert-base-uncased-finetuned-sst-2-english --dataset-from-datasets glue^sst2 --recipe deepwordbug --num-examples 10
textattack attack --model-from-huggingface distilbert-base-uncased-finetuned-sst-2-english --dataset-from-huggingface glue^sst2 --recipe deepwordbug --num-examples 10

View File

@@ -43,7 +43,7 @@ attack_test_params = [
(
"textattack attack --model-from-huggingface "
"distilbert-base-uncased-finetuned-sst-2-english "
"--dataset-from-datasets glue^sst2^train --recipe deepwordbug --num-examples 3 "
"--dataset-from-huggingface glue^sst2^train --recipe deepwordbug --num-examples 3 "
"--shuffle=False"
),
"tests/sample_outputs/run_attack_transformers_datasets.txt",

View File

@@ -4,7 +4,7 @@ import pytest
eval_test_params = [
(
"eval_model_hub_rt",
"textattack eval --model-from-huggingface textattack/distilbert-base-uncased-rotten-tomatoes --dataset-from-datasets rotten_tomatoes --num-examples 4",
"textattack eval --model-from-huggingface textattack/distilbert-base-uncased-rotten-tomatoes --dataset-from-huggingface rotten_tomatoes --num-examples 4",
"tests/sample_outputs/eval_model_hub_rt.txt",
),
(

View File

@@ -64,7 +64,7 @@ def add_dataset_args(parser):
"""
dataset_group = parser.add_mutually_exclusive_group()
dataset_group.add_argument(
"--dataset-from-datasets",
"--dataset-from-huggingface",
type=str,
required=False,
default=None,