29d45e889b7695333d45171fc3b7e70d4629d067,official/nlp/tasks/sentence_prediction.py,SentencePredictionTask,build_model,#SentencePredictionTask#,84
Before Change
return models.BertClassifier(
network=encoder_network,
num_classes=self.task_config.model.num_classes,
initializer=tf.keras.initializers.TruncatedNormal(
stddev=self.task_config.model.encoder.initializer_range),
use_encoder_pooler=self.task_config.model.use_encoder_pooler)
def build_losses(self, labels, model_outputs, aux_losses=None) -> tf.Tensor:
After Change
encoder_network = utils.get_encoder_from_hub(self._hub_module)
else:
encoder_network = encoders.build_encoder(self.task_config.model.encoder)
encoder_cfg = self.task_config.model.encoder.get()
// Currently, we only support bert-style sentence prediction finetuning.
return models.BertClassifier(
network=encoder_network,
num_classes=self.task_config.model.num_classes,
initializer=tf.keras.initializers.TruncatedNormal(
stddev=encoder_cfg.initializer_range),
use_encoder_pooler=self.task_config.model.use_encoder_pooler)
def build_losses(self, labels, model_outputs, aux_losses=None) -> tf.Tensor:
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 10
Instances
Project Name: tensorflow/models
Commit Name: 29d45e889b7695333d45171fc3b7e70d4629d067
Time: 2020-08-05
Author: hongkuny@google.com
File Name: official/nlp/tasks/sentence_prediction.py
Class Name: SentencePredictionTask
Method Name: build_model
Project Name: tensorflow/models
Commit Name: 48e49875e3c13b140f67c39da67645bd1c1c392d
Time: 2020-08-05
Author: hongkuny@google.com
File Name: official/nlp/tasks/sentence_prediction.py
Class Name: SentencePredictionTask
Method Name: build_model
Project Name: tensorflow/models
Commit Name: 48e49875e3c13b140f67c39da67645bd1c1c392d
Time: 2020-08-05
Author: hongkuny@google.com
File Name: official/nlp/tasks/question_answering.py
Class Name: QuestionAnsweringTask
Method Name: build_model
Project Name: tensorflow/models
Commit Name: 29d45e889b7695333d45171fc3b7e70d4629d067
Time: 2020-08-05
Author: hongkuny@google.com
File Name: official/nlp/tasks/question_answering.py
Class Name: QuestionAnsweringTask
Method Name: build_model