Update Readme to Run Multiple Choice Script from Example Directory (#39323)
* Update Readme to run in current place * Update Readme files to execute PyTorch examples from their respective folders
This commit is contained in:
@@ -65,7 +65,7 @@ examples/pytorch/token-classification/run_ner.py \
|
|||||||
|
|
||||||
Most example scripts should have the first two command line arguments and some have the third one. You can quickly check if a given example supports any of these by passing a `-h` option, e.g.:
|
Most example scripts should have the first two command line arguments and some have the third one. You can quickly check if a given example supports any of these by passing a `-h` option, e.g.:
|
||||||
```bash
|
```bash
|
||||||
examples/pytorch/token-classification/run_ner.py -h
|
token-classification/run_ner.py -h
|
||||||
```
|
```
|
||||||
|
|
||||||
## Resuming training
|
## Resuming training
|
||||||
@@ -110,7 +110,7 @@ classification MNLI task using the `run_glue` script, with 8 GPUs:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
torchrun \
|
torchrun \
|
||||||
--nproc_per_node 8 pytorch/text-classification/run_glue.py \
|
--nproc_per_node 8 text-classification/run_glue.py \
|
||||||
--model_name_or_path google-bert/bert-large-uncased-whole-word-masking \
|
--model_name_or_path google-bert/bert-large-uncased-whole-word-masking \
|
||||||
--task_name mnli \
|
--task_name mnli \
|
||||||
--do_train \
|
--do_train \
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ loaded using the pre-trained weights.
|
|||||||
Finally, we can run the example script to train the model:
|
Finally, we can run the example script to train the model:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/contrastive-image-text/run_clip.py \
|
python run_clip.py \
|
||||||
--output_dir ./clip-roberta-finetuned \
|
--output_dir ./clip-roberta-finetuned \
|
||||||
--model_name_or_path ./clip-roberta \
|
--model_name_or_path ./clip-roberta \
|
||||||
--data_dir $PWD/data \
|
--data_dir $PWD/data \
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ limitations under the License.
|
|||||||
`run_swag` allows you to fine-tune any model from our [hub](https://huggingface.co/models) (as long as its architecture as a `ForMultipleChoice` version in the library) on the SWAG dataset or your own csv/jsonlines files as long as they are structured the same way. To make it works on another dataset, you will need to tweak the `preprocess_function` inside the script.
|
`run_swag` allows you to fine-tune any model from our [hub](https://huggingface.co/models) (as long as its architecture as a `ForMultipleChoice` version in the library) on the SWAG dataset or your own csv/jsonlines files as long as they are structured the same way. To make it works on another dataset, you will need to tweak the `preprocess_function` inside the script.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/multiple-choice/run_swag.py \
|
python run_swag.py \
|
||||||
--model_name_or_path FacebookAI/roberta-base \
|
--model_name_or_path FacebookAI/roberta-base \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ and you also will find examples of these below.
|
|||||||
|
|
||||||
Here is an example on a summarization task:
|
Here is an example on a summarization task:
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/summarization/run_summarization.py \
|
python run_summarization.py \
|
||||||
--model_name_or_path google-t5/t5-small \
|
--model_name_or_path google-t5/t5-small \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
@@ -64,7 +64,7 @@ And here is how you would use it on your own files, after adjusting the values f
|
|||||||
`--train_file`, `--validation_file`, `--text_column` and `--summary_column` to match your setup:
|
`--train_file`, `--validation_file`, `--text_column` and `--summary_column` to match your setup:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/summarization/run_summarization.py \
|
python run_summarization.py \
|
||||||
--model_name_or_path google-t5/t5-small \
|
--model_name_or_path google-t5/t5-small \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ and you also will find examples of these below.
|
|||||||
Here is an example of a translation fine-tuning with a MarianMT model:
|
Here is an example of a translation fine-tuning with a MarianMT model:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/translation/run_translation.py \
|
python run_translation.py \
|
||||||
--model_name_or_path Helsinki-NLP/opus-mt-en-ro \
|
--model_name_or_path Helsinki-NLP/opus-mt-en-ro \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
@@ -62,7 +62,7 @@ MBart and some T5 models require special handling.
|
|||||||
T5 models `google-t5/t5-small`, `google-t5/t5-base`, `google-t5/t5-large`, `google-t5/t5-3b` and `google-t5/t5-11b` must use an additional argument: `--source_prefix "translate {source_lang} to {target_lang}"`. For example:
|
T5 models `google-t5/t5-small`, `google-t5/t5-base`, `google-t5/t5-large`, `google-t5/t5-3b` and `google-t5/t5-11b` must use an additional argument: `--source_prefix "translate {source_lang} to {target_lang}"`. For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/translation/run_translation.py \
|
python run_translation.py \
|
||||||
--model_name_or_path google-t5/t5-small \
|
--model_name_or_path google-t5/t5-small \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
@@ -85,7 +85,7 @@ For the aforementioned group of T5 models it's important to remember that if you
|
|||||||
MBart models require a different format for `--source_lang` and `--target_lang` values, e.g. instead of `en` it expects `en_XX`, for `ro` it expects `ro_RO`. The full MBart specification for language codes can be found [here](https://huggingface.co/facebook/mbart-large-cc25). For example:
|
MBart models require a different format for `--source_lang` and `--target_lang` values, e.g. instead of `en` it expects `en_XX`, for `ro` it expects `ro_RO`. The full MBart specification for language codes can be found [here](https://huggingface.co/facebook/mbart-large-cc25). For example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/translation/run_translation.py \
|
python run_translation.py \
|
||||||
--model_name_or_path facebook/mbart-large-en-ro \
|
--model_name_or_path facebook/mbart-large-en-ro \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
@@ -104,7 +104,7 @@ And here is how you would use the translation finetuning on your own files, afte
|
|||||||
values for the arguments `--train_file`, `--validation_file` to match your setup:
|
values for the arguments `--train_file`, `--validation_file` to match your setup:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/translation/run_translation.py \
|
python run_translation.py \
|
||||||
--model_name_or_path google-t5/t5-small \
|
--model_name_or_path google-t5/t5-small \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
@@ -133,7 +133,7 @@ Here the languages are Romanian (`ro`) and English (`en`).
|
|||||||
If you want to use a pre-processed dataset that leads to high BLEU scores, but for the `en-de` language pair, you can use `--dataset_name stas/wmt14-en-de-pre-processed`, as following:
|
If you want to use a pre-processed dataset that leads to high BLEU scores, but for the `en-de` language pair, you can use `--dataset_name stas/wmt14-en-de-pre-processed`, as following:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python examples/pytorch/translation/run_translation.py \
|
python run_translation.py \
|
||||||
--model_name_or_path google-t5/t5-small \
|
--model_name_or_path google-t5/t5-small \
|
||||||
--do_train \
|
--do_train \
|
||||||
--do_eval \
|
--do_eval \
|
||||||
|
|||||||
Reference in New Issue
Block a user