Commit da2465fd authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 416070060
parent 30b6976e
task:
hub_module_url: ''
model:
num_classes: 3
init_checkpoint: ''
train_data:
drop_remainder: true
global_batch_size: 32
is_training: true
seq_length: 128
shuffle_buffer_size: 100
tfds_name: 'glue/mnli'
tfds_split: 'train'
text_fields: ['premise', 'hypothesis']
vocab_file: ''
lower_case: true
validation_data:
drop_remainder: false
global_batch_size: 32
is_training: false
seq_length: 128
tfds_name: 'glue/mnli'
tfds_split: 'validation_matched'
text_fields: ['premise', 'hypothesis']
vocab_file: ''
lower_case: true
trainer:
checkpoint_interval: 3000
max_to_keep: 5
optimizer_config:
learning_rate:
polynomial:
cycle: false
decay_steps: 36813
end_learning_rate: 0.0
initial_learning_rate: 3.0e-05
power: 1.0
type: polynomial
optimizer:
type: adamw
warmup:
polynomial:
power: 1
warmup_steps: 3681
type: polynomial
steps_per_loop: 1000
summary_interval: 1000
train_steps: 36813
validation_interval: 6135
validation_steps: 307
...@@ -64,6 +64,48 @@ def bert_sentence_prediction() -> cfg.ExperimentConfig: ...@@ -64,6 +64,48 @@ def bert_sentence_prediction() -> cfg.ExperimentConfig:
return config return config
@exp_factory.register_config_factory('bert/sentence_prediction_text')
def bert_sentence_prediction_text() -> cfg.ExperimentConfig:
r"""BERT sentence prediction with raw text data.
Example: use tf.text and tfds as input with glue_mnli_text.yaml
"""
config = cfg.ExperimentConfig(
task=sentence_prediction.SentencePredictionConfig(
train_data=sentence_prediction_dataloader
.SentencePredictionTextDataConfig(),
validation_data=sentence_prediction_dataloader
.SentencePredictionTextDataConfig(
is_training=False, drop_remainder=False)),
trainer=cfg.TrainerConfig(
optimizer_config=optimization.OptimizationConfig({
'optimizer': {
'type': 'adamw',
'adamw': {
'weight_decay_rate':
0.01,
'exclude_from_weight_decay':
['LayerNorm', 'layer_norm', 'bias'],
}
},
'learning_rate': {
'type': 'polynomial',
'polynomial': {
'initial_learning_rate': 3e-5,
'end_learning_rate': 0.0,
}
},
'warmup': {
'type': 'polynomial'
}
})),
restrictions=[
'task.train_data.is_training != None',
'task.validation_data.is_training != None'
])
return config
@exp_factory.register_config_factory('bert/squad') @exp_factory.register_config_factory('bert/squad')
def bert_squad() -> cfg.ExperimentConfig: def bert_squad() -> cfg.ExperimentConfig:
"""BERT Squad V1/V2.""" """BERT Squad V1/V2."""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment