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:
@@ -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
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!textattack peek-dataset --dataset-from-datasets snli"
|
||||
"!textattack peek-dataset --dataset-from-huggingface snli"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
),
|
||||
(
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user