Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ba240018
Unverified
Commit
ba240018
authored
Jul 17, 2020
by
Sam Shleifer
Committed by
GitHub
Jul 17, 2020
Browse files
[seq2seq] MAX_LEN env var for MT commands (#5837)
parent
529850ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
examples/seq2seq/README.md
examples/seq2seq/README.md
+2
-1
examples/seq2seq/train_mbart_cc25_enro.sh
examples/seq2seq/train_mbart_cc25_enro.sh
+1
-2
examples/seq2seq/train_mbart_cc25_enro_multigpu.sh
examples/seq2seq/train_mbart_cc25_enro_multigpu.sh
+18
-0
No files found.
examples/seq2seq/README.md
View file @
ba240018
...
@@ -78,7 +78,7 @@ The following command should work on a 16GB GPU:
...
@@ -78,7 +78,7 @@ The following command should work on a 16GB GPU:
--model_name_or_path
facebook/bart-large
--model_name_or_path
facebook/bart-large
```
```
*Note*
: The following tips mostly apply to summarization finetuning.
### Translation Finetuning
### Translation Finetuning
...
@@ -87,6 +87,7 @@ Then you can finetune mbart_cc25 on english-romanian with the following command.
...
@@ -87,6 +87,7 @@ Then you can finetune mbart_cc25 on english-romanian with the following command.
**Recommendation:**
Read and potentially modify the fairly opinionated defaults in
`train_mbart_cc25_enro.sh`
script before running it.
**Recommendation:**
Read and potentially modify the fairly opinionated defaults in
`train_mbart_cc25_enro.sh`
script before running it.
```
bash
```
bash
export
ENRO_DIR
=
${
PWD
}
/wmt_en_ro
# may need to be fixed depending on where you downloaded
export
ENRO_DIR
=
${
PWD
}
/wmt_en_ro
# may need to be fixed depending on where you downloaded
export
MAX_LEN
=
128
export
BS
=
4
export
BS
=
4
export
GAS
=
8
export
GAS
=
8
./train_mbart_cc25_enro.sh
--output_dir
cc25_v1_frozen/
./train_mbart_cc25_enro.sh
--output_dir
cc25_v1_frozen/
...
...
examples/seq2seq/train_mbart_cc25_enro.sh
View file @
ba240018
...
@@ -8,11 +8,10 @@ python finetune.py \
...
@@ -8,11 +8,10 @@ python finetune.py \
--do_train
\
--do_train
\
--do_predict
\
--do_predict
\
--val_check_interval
0.1
\
--val_check_interval
0.1
\
--n_val
500
\
--adam_eps
1e-06
\
--adam_eps
1e-06
\
--num_train_epochs
3
--src_lang
en_XX
--tgt_lang
ro_RO
\
--num_train_epochs
3
--src_lang
en_XX
--tgt_lang
ro_RO
\
--freeze_encoder
--freeze_embeds
--data_dir
$ENRO_DIR
\
--freeze_encoder
--freeze_embeds
--data_dir
$ENRO_DIR
\
--max_source_length
=
300
--max_target_length
300
--val_max_target_length
=
300
--test_max_target_length
300
\
--max_source_length
$MAX_LEN
--max_target_length
$MAX_LEN
--val_max_target_length
$MAX_LEN
--test_max_target_length
$MAX_LEN
\
--train_batch_size
=
$BS
--eval_batch_size
=
$BS
--gradient_accumulation_steps
=
$GAS
\
--train_batch_size
=
$BS
--eval_batch_size
=
$BS
--gradient_accumulation_steps
=
$GAS
\
--model_name_or_path
facebook/mbart-large-cc25
\
--model_name_or_path
facebook/mbart-large-cc25
\
--task
translation
\
--task
translation
\
...
...
examples/seq2seq/train_mbart_cc25_enro_multigpu.sh
0 → 100755
View file @
ba240018
#!/usr/bin/env bash
export
PYTHONPATH
=
"../"
:
"
${
PYTHONPATH
}
"
# Need to export N_GPUS=
python finetune.py
\
--learning_rate
=
3e-5
\
--fp16
\
--gpus
$N_GPUS
\
--do_train
\
--val_check_interval
0.25
\
--adam_eps
1e-06
\
--num_train_epochs
6
--src_lang
en_XX
--tgt_lang
ro_RO
\
--data_dir
$ENRO_DIR
\
--max_source_length
$MAX_LEN
--max_target_length
$MAX_LEN
--val_max_target_length
$MAX_LEN
--test_max_target_length
$MAX_LEN
\
--train_batch_size
=
$BS
--eval_batch_size
=
$BS
--gradient_accumulation_steps
=
$GAS
\
--tokenizer
facebook/mbart-large-cc25
\
--task
translation
\
--warmup_steps
500
--freeze_encoder
--freeze_embeds
\
$@
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment