MCPcopy Create free account
hub / github.com/tensorflow/models / _get_classifier_model

Function _get_classifier_model

official/legacy/bert/run_classifier.py:137–153  ·  view source on GitHub ↗

Gets a classifier model.

()

Source from the content-addressed store, hash-verified

135 is_regression = num_classes == 1
136
137 def _get_classifier_model():
138 """Gets a classifier model."""
139 classifier_model, core_model = (
140 bert_models.classifier_model(
141 bert_config,
142 num_classes,
143 max_seq_length,
144 hub_module_url=FLAGS.hub_module_url,
145 hub_module_trainable=FLAGS.hub_module_trainable))
146 optimizer = optimization.create_optimizer(initial_lr,
147 steps_per_epoch * epochs,
148 warmup_steps, FLAGS.end_lr,
149 FLAGS.optimizer_type)
150 classifier_model.optimizer = performance.configure_optimizer(
151 optimizer,
152 use_float16=common_flags.use_float16())
153 return classifier_model, core_model
154
155 # tf_keras.losses objects accept optional sample_weight arguments (eg. coming
156 # from the dataset) to compute weighted loss, as used for the regression

Callers

nothing calls this directly

Calls 1

create_optimizerMethod · 0.45

Tested by

no test coverage detected