Skip to content

Commit f7dfc7b

Browse files
authored
Rename examples/bert -> examples/bert_pretraining (#647)
1 parent 028966a commit f7dfc7b

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

examples/bert/README.md renamed to examples/bert_pretraining/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ python3 examples/tools/split_sentences.py \
2525
--input_files $OUTPUT_DIR/wiki_example_data.txt \
2626
--output_directory $OUTPUT_DIR/sentence-split-data
2727
# Preprocess input for pretraining.
28-
python3 examples/bert/bert_create_pretraining_data.py \
28+
python3 examples/bert_pretraining/bert_create_pretraining_data.py \
2929
--input_files $OUTPUT_DIR/sentence-split-data/ \
3030
--vocab_file $OUTPUT_DIR/bert_vocab_uncased.txt \
3131
--output_file $OUTPUT_DIR/pretraining-data/pretraining.tfrecord
3232
# Run pretraining for 100 train steps only.
33-
python3 examples/bert/bert_pretrain.py \
33+
python3 examples/bert_pretraining/bert_pretrain.py \
3434
--input_directory $OUTPUT_DIR/pretraining-data/ \
3535
--vocab_file $OUTPUT_DIR/bert_vocab_uncased.txt \
3636
--saved_model_output $OUTPUT_DIR/model/ \
@@ -156,7 +156,7 @@ with the following:
156156
```shell
157157
for file in path/to/sentence-split-data/*; do
158158
output="path/to/pretraining-data/$(basename -- "$file" .txt).tfrecord"
159-
python3 examples/bert/bert_create_pretraining_data.py \
159+
python3 examples/bert_pretraining/bert_create_pretraining_data.py \
160160
--input_files ${file} \
161161
--vocab_file bert_vocab_uncased.txt \
162162
--output_file ${output}
@@ -171,7 +171,7 @@ on an 8 core machine.
171171
NUM_JOBS=5
172172
for file in path/to/sentence-split-data/*; do
173173
output="path/to/pretraining-data/$(basename -- "$file" .txt).tfrecord"
174-
echo python3 examples/bert/bert_create_pretraining_data.py \
174+
echo python3 examples/bert_pretraining/bert_create_pretraining_data.py \
175175
--input_files ${file} \
176176
--vocab_file bert_vocab_uncased.txt \
177177
--output_file ${output}
@@ -192,7 +192,7 @@ directory. If you are willing to train from data stored on google cloud storage
192192
the URL of GCS bucket. For example, `--input_directory=gs://your-bucket-name/you-data-path`. You can also save models directly to GCS by the same approach.
193193

194194
```shell
195-
python3 examples/bert/bert_pretrain.py \
195+
python3 examples/bert_pretraining/bert_pretrain.py \
196196
--input_directory path/to/data/ \
197197
--vocab_file path/to/bert_vocab_uncased.txt \
198198
--model_size tiny \
File renamed without changes.

examples/bert/bert_config.py renamed to examples/bert_pretraining/bert_config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,3 @@
7777
# Percentage of training steps used for learning rate warmup.
7878
"warmup_percentage": 0.1,
7979
}
80-
81-
FINETUNING_CONFIG = {
82-
"batch_size": 32,
83-
"epochs": 3,
84-
"learning_rates": [5e-5, 4e-5, 3e-5, 2e-5],
85-
}

examples/bert/bert_create_pretraining_data.py renamed to examples/bert_pretraining/bert_create_pretraining_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from absl import app
4545
from absl import flags
4646

47-
from examples.bert.bert_config import PREPROCESSING_CONFIG
47+
from examples.bert_pretraining.bert_config import PREPROCESSING_CONFIG
4848
from examples.utils.scripting_utils import list_filenames_for_arg
4949

5050
# Tokenization will happen with tensorflow and can easily OOM a GPU.

examples/bert/bert_pretrain.py renamed to examples/bert_pretraining/bert_pretrain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
from tensorflow import keras
2323

2424
import keras_nlp
25-
from examples.bert.bert_config import MODEL_CONFIGS
26-
from examples.bert.bert_config import PREPROCESSING_CONFIG
27-
from examples.bert.bert_config import TRAINING_CONFIG
25+
from examples.bert_pretraining.bert_config import MODEL_CONFIGS
26+
from examples.bert_pretraining.bert_config import PREPROCESSING_CONFIG
27+
from examples.bert_pretraining.bert_config import TRAINING_CONFIG
2828

2929
FLAGS = flags.FLAGS
3030

0 commit comments

Comments
 (0)