Пример #1
0
 def test_mobilebert_model(self, spec, trainable):
     # Only test squad1.1 since it takes too long time for this.
     version = '1.1'
     model_spec = ms.get(spec)
     model_spec.trainable = trainable
     model_spec.predict_batch_size = 1
     train_data, validation_data = _get_data(model_spec, version)
     model = question_answer.create(train_data,
                                    model_spec=model_spec,
                                    epochs=1,
                                    batch_size=1)
     self._test_f1_score(model, validation_data, 0.0)
     self._test_export_to_tflite(model, validation_data, atol=1e-02)
Пример #2
0
 def test_bert_model(self):
     # Only test squad1.1 since it takes too long time for this.
     version = '1.1'
     model_spec = ms.BertQAModelSpec(trainable=False, predict_batch_size=1)
     train_data, validation_data = _get_data(model_spec, version)
     model = question_answer.create(train_data,
                                    model_spec=model_spec,
                                    epochs=1,
                                    batch_size=1)
     self._test_f1_score(model, validation_data, 0.0)
     self._test_export_vocab(model)
     self._test_export_to_tflite(model, validation_data)
     self._test_export_to_saved_model(model)
 def test_mobilebert_model(self, spec):
     self.skipTest('TODO(b/164095081): Fix breakage and re-enable')
     # Only test squad1.1 since it takes too long time for this.
     version = '1.1'
     model_spec = ms.get(spec)
     model_spec.trainable = False
     model_spec.predict_batch_size = 1
     train_data, validation_data = _get_data(model_spec, version)
     model = question_answer.create(train_data,
                                    model_spec=model_spec,
                                    epochs=1,
                                    batch_size=1)
     self._test_f1_score(model, validation_data, 0.0)
     self._test_export_to_tflite(model, validation_data, atol=1e-02)