Skip to content

Commit

Permalink
Fix YAML referencing to allow better CLI overrides (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi-mosaic authored Feb 10, 2023
1 parent f4e6c6c commit 7cb0211
Show file tree
Hide file tree
Showing 30 changed files with 395 additions and 395 deletions.
16 changes: 8 additions & 8 deletions examples/bert/tests/smoketest_config_classification.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tokenizer_name: &tokenizer_name prajjwal1/bert-tiny
max_seq_len: &max_seq_len 32
tokenizer_name: prajjwal1/bert-tiny
max_seq_len: 32

# Run Name
run_name: test
Expand All @@ -8,22 +8,22 @@ run_name: test
model:
name: mosaic_bert
num_labels: 2
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Dataloaders
train_loader:
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 4

eval_loader:
split: validation
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: false
drop_last: false
num_workers: 4
Expand Down
4 changes: 2 additions & 2 deletions examples/bert/tests/smoketest_config_glue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ default_seed: 1111
precision: fp32

# Tokenizer for dataset creation
tokenizer_name: &tokenizer_name bert-base-uncased
tokenizer_name: bert-base-uncased

# Base model config
model:
name:
pretrained_model_name: prajjwal1/bert-tiny
tokenizer_name: *tokenizer_name
tokenizer_name: ${tokenizer_name}


# Loading
Expand Down
22 changes: 11 additions & 11 deletions examples/bert/tests/smoketest_config_main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tokenizer_name: &tokenizer_name prajjwal1/bert-tiny
max_seq_len: &max_seq_len 32
mlm_probability: &mlm_probability 0.15
tokenizer_name: prajjwal1/bert-tiny
max_seq_len: 32
mlm_probability: 0.15

# Run Name
run_name: test
Expand All @@ -9,8 +9,8 @@ run_name: test
model:
name:
use_pretrained: false
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Dataloaders
train_loader:
Expand All @@ -19,12 +19,12 @@ train_loader:
remote:
local:
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
group_method: truncate
predownload: 1000
shuffle: true
mlm_probability: *mlm_probability
mlm_probability: ${mlm_probability}
num_canonical_nodes: 8
drop_last: true
num_workers: 4
Expand All @@ -35,12 +35,12 @@ eval_loader:
remote:
local:
split: val
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
group_method: truncate
predownload: 1000
shuffle: false
mlm_probability: *mlm_probability
mlm_probability: ${mlm_probability}
num_canonical_nodes: 8
drop_last: false
num_workers: 4
Expand Down
6 changes: 3 additions & 3 deletions examples/bert/yamls/finetuning/glue/hf-bert-base-uncased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ default_seed: 19
precision: bf16

# Tokenizer for dataset creation
tokenizer_name: &tokenizer_name bert-base-uncased
tokenizer_name: bert-base-uncased

# Base model config
model:
name: hf_bert
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Loading
starting_checkpoint_load_path: # Fill this in with the composer checkpoint from the end of pre-training a HF BERT
Expand Down
6 changes: 3 additions & 3 deletions examples/bert/yamls/finetuning/glue/mcloud_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ parameters:
precision: bf16

# Tokenizer for dataset creation
tokenizer_name: &tokenizer_name bert-base-uncased
tokenizer_name: bert-base-uncased

# Base model config
model:
name: mosaic_bert
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Loading
# (fill this in with the composer checkpoint from the end of pre-training a Mosaic BERT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ default_seed: 19
precision: bf16

# Tokenizer for dataset creation
tokenizer_name: &tokenizer_name bert-base-uncased
tokenizer_name: bert-base-uncased

# Base model config
model:
name: mosaic_bert
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Loading
# (fill this in with the composer checkpoint from the end of pre-training a Mosaic BERT)
Expand Down
16 changes: 8 additions & 8 deletions examples/bert/yamls/finetuning/hf-bert-base-uncased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# Run Name
run_name: finetune-hf-bert

tokenizer_name: &tokenizer_name bert-base-uncased
max_seq_len: &max_seq_len 128
tokenizer_name: bert-base-uncased
max_seq_len: 128

load_path: # (Optionally) provide a composer checkpoint to use for the starting weights

Expand All @@ -20,22 +20,22 @@ model:
name: hf_bert
num_labels: 2 # <-- Make sure to update these after you modify the starter script!
use_pretrained: true
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Dataloaders (make sure to update these after you modify the starter script!)
train_loader:
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8

eval_loader:
split: validation
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8
Expand Down
16 changes: 8 additions & 8 deletions examples/bert/yamls/finetuning/mcloud_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ parameters:
# Run Name
run_name: *run_name

tokenizer_name: &tokenizer_name bert-base-uncased
max_seq_len: &max_seq_len 128
tokenizer_name: bert-base-uncased
max_seq_len: 128

load_path: # (Optionally, but recommended) provide a composer checkpoint to use for the starting weights

# Model
model:
name: mosaic_bert
num_labels: 2 # <-- Make sure to update these after you modify the starter script!
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Dataloaders (make sure to update these after you modify the starter script!)
train_loader:
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8

eval_loader:
split: validation
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8
Expand Down
16 changes: 8 additions & 8 deletions examples/bert/yamls/finetuning/mosaic-bert-base-uncased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
# Run Name
run_name: finetune-mosaic-bert

tokenizer_name: &tokenizer_name bert-base-uncased
max_seq_len: &max_seq_len 128
tokenizer_name: bert-base-uncased
max_seq_len: 128

load_path: # (Optionally) provide a composer checkpoint to use for the starting weights

# Model
model:
name: mosaic_bert
num_labels: 2 # <-- Make sure to update these after you modify the starter script!
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}

# Dataloaders (make sure to update these after you modify the starter script!)
train_loader:
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8

eval_loader:
split: validation
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
shuffle: true
drop_last: true
num_workers: 8
Expand Down
32 changes: 16 additions & 16 deletions examples/bert/yamls/main/hf-bert-base-uncased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

# Follow the instructions in the README to set up ./my-copy-c4
# Or point data paths to your remote C4 dataset
data_local: &data_local ./my-copy-c4
data_remote: &data_remote null
data_local: ./my-copy-c4
data_remote: null

max_seq_len: &max_seq_len 128
tokenizer_name: &tokenizer_name bert-base-uncased
mlm_probability: &mlm_probability 0.15
max_seq_len: 128
tokenizer_name: bert-base-uncased
mlm_probability: 0.15

# Run Name
run_name: hf-bert-base-uncased
Expand All @@ -17,8 +17,8 @@ run_name: hf-bert-base-uncased
model:
name: hf_bert
use_pretrained: false # Train the model from scratch. Set to true to start from the HF off-the-shelf weights.
pretrained_model_name: *tokenizer_name
tokenizer_name: *tokenizer_name
pretrained_model_name: ${tokenizer_name}
tokenizer_name: ${tokenizer_name}
# This implementation generally uses the default architecture values for from the Hugging Face BertConfig object
# These values can be changed here when pretraining from scratch. Note that these should only be used
# if used_pretained: false, otherwise the model will not be loaded properly
Expand All @@ -32,25 +32,25 @@ model:
train_loader:
name: text
dataset:
local: *data_local
remote: *data_remote
local: ${data_local}
remote: ${data_remote}
split: train
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
group_method: truncate
shuffle: true
mlm_probability: *mlm_probability
mlm_probability: ${mlm_probability}
drop_last: true
num_workers: 8

eval_loader:
name: text
dataset:
local: *data_local
remote: *data_remote
local: ${data_local}
remote: ${data_remote}
split: val
tokenizer_name: *tokenizer_name
max_seq_len: *max_seq_len
tokenizer_name: ${tokenizer_name}
max_seq_len: ${max_seq_len}
group_method: truncate
shuffle: false
mlm_probability: 0.15 # We always evaluate at 15% masking for consistent comparison
Expand Down
Loading

0 comments on commit 7cb0211

Please sign in to comment.