@@ -0,0 +1,2032 @@
+# Copyright 2020 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     https://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0A%22%22%22Testing for predict_utils.py.%22%22%22%0A%0Aimport bert_example%0Aimport tensorflow as tf%0Aimport os%0Aimport subprocess%0Aimport shutil%0Aimport tagging%0Aimport tagging_converter%0Aimport unittest%0Afrom unittest import TestCase%0Aimport utils%0A%0Afrom predict_utils import construct_example%0A%0A%0Aclass PredictUtilsTest(TestCase):    %0A    def test_construct_example(self):%0A        vocab_file = %22gs://bert_traning_yechen/trained_bert_uncased/bert_POS/vocab.txt%22%0A        label_map_file = %22gs://publicly_available_models_yechen/best_hypertuned_POS/label_map.txt%22%0A        enable_masking = False%0A        do_lower_case = True%0A        embedding_type = %22POS%22%0A        label_map = utils.read_label_map(label_map_file)%0A        converter = tagging_converter.TaggingConverter(%0A            tagging_converter.get_phrase_vocabulary_from_label_map(label_map), True)%0A        id_2_tag = %7Btag_id: tagging.Tag(tag) for tag, tag_id in label_map.items()%7D%0A        builder = bert_example.BertExampleBuilder(label_map, vocab_file, 10, do_lower_case,%0A                                          converter, embedding_type, enable_masking)%0A%0A        inputs, example = construct_example(%22This is a test%22, builder)%0A        self.assertEqual(inputs, %7B'input_ids': %5B2, 12, 1016, 6, 9, 6, 9, 10, 12, 3%5D, %0A                          'input_mask': %5B1, 1, 1, 1, 1, 1, 1, 1, 1, 1%5D, %0A                          'segment_ids': %5B2, 16, 14, 14, 32, 14, 32, 5, 14, 41%5D%7D)%0A        %0A    %0Aif __name__ == '__main__':%0A    unittest.main()%0A%0A

Create predict_utils_test.py