





"""simple docstring"""





import inspect
import unittest

from transformers import YolosConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
       import torch
       from torch import nn

       from transformers import YolosForObjectDetection, YolosModel
       from transformers.models.yolos.modeling_yolos import YOLOS_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
       from PIL import Image

       from transformers import AutoImageProcessor

class 		lowercase					:





      def __init__(       self      ,						lowercase      ,						lowercase=13      ,						lowercase=[30, 30]      ,						lowercase=2      ,						lowercase=3      ,						lowercase=True      ,						lowercase=True      ,						lowercase=32      ,						lowercase=5      ,						lowercase=4      ,						lowercase=37      ,						lowercase="gelu"      ,						lowercase=0.1      ,						lowercase=0.1      ,						lowercase=10      ,						lowercase=0.02      ,						lowercase=3      ,						lowercase=None      ,						lowercase=8      ,						lowercase=10      ,						)		->     Dict:
            lowerCAmelCase  						=       parent
            lowerCAmelCase  						=       batch_size
            lowerCAmelCase  						=       image_size
            lowerCAmelCase  						=       patch_size
            lowerCAmelCase  						=       num_channels
            lowerCAmelCase  						=       is_training
            lowerCAmelCase  						=       use_labels
            lowerCAmelCase  						=       hidden_size
            lowerCAmelCase  						=       num_hidden_layers
            lowerCAmelCase  						=       num_attention_heads
            lowerCAmelCase  						=       intermediate_size
            lowerCAmelCase  						=       hidden_act
            lowerCAmelCase  						=       hidden_dropout_prob
            lowerCAmelCase  						=       attention_probs_dropout_prob
            lowerCAmelCase  						=       type_sequence_label_size
            lowerCAmelCase  						=       initializer_range
            lowerCAmelCase  						=       num_labels
            lowerCAmelCase  						=       scope
            lowerCAmelCase  						=       n_targets
            lowerCAmelCase  						=       num_detection_tokens
            # we set the expected sequence length (which is used in several tests)
            # expected sequence length = num_patches + 1 (we add 1 for the [CLS] token) + num_detection_tokens
            lowerCAmelCase  						=       (image_size[1] // patch_size) * (image_size[0] // patch_size)
            lowerCAmelCase  						=       num_patches + 1 + self.num_detection_tokens





      def     _snake_case			(       self )		->     Optional[int]:
            lowerCAmelCase  						=       floats_tensor([self.batch_size, self.num_channels, self.image_size[0], self.image_size[1]] )

            lowerCAmelCase  						=       None
            if self.use_labels:
                  # labels is a list of Dict (each Dict being the labels for a given example in the batch)
                  lowerCAmelCase  						=       []
                  for i in range(self.batch_size ):
                        lowerCAmelCase  						=       {}
                        lowerCAmelCase  						=       torch.randint(
                            high=self.num_labels      ,						size=(self.n_targets,)      ,						device=lowercase )
                        lowerCAmelCase  						=       torch.rand(self.n_targets      ,						4      ,						device=lowercase )
                        labels.append(lowercase )

            lowerCAmelCase  						=       self.get_config()

            return config, pixel_values, labels





      def     _snake_case			(       self )		->     List[Any]:
            return YolosConfig(
                image_size=self.image_size      ,						patch_size=self.patch_size      ,						num_channels=self.num_channels      ,						hidden_size=self.hidden_size      ,						num_hidden_layers=self.num_hidden_layers      ,						num_attention_heads=self.num_attention_heads      ,						intermediate_size=self.intermediate_size      ,						hidden_act=self.hidden_act      ,						hidden_dropout_prob=self.hidden_dropout_prob      ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob      ,						is_decoder=lowercase      ,						initializer_range=self.initializer_range      ,						num_detection_tokens=self.num_detection_tokens      ,						num_labels=self.num_labels      ,						)





      def     _snake_case			(       self      ,						lowercase      ,						lowercase      ,						lowercase )		->     Any:
            lowerCAmelCase  						=       YolosModel(config=lowercase )
            model.to(lowercase )
            model.eval()
            lowerCAmelCase  						=       model(lowercase )
            self.parent.assertEqual(
                result.last_hidden_state.shape      ,						(self.batch_size, self.expected_seq_len, self.hidden_size) )





      def     _snake_case			(       self      ,						lowercase      ,						lowercase      ,						lowercase )		->     Tuple:
            lowerCAmelCase  						=       YolosForObjectDetection(lowercase )
            model.to(lowercase )
            model.eval()

            lowerCAmelCase  						=       model(pixel_values=lowercase )
            lowerCAmelCase  						=       model(lowercase )

            self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.num_detection_tokens, self.num_labels + 1) )
            self.parent.assertEqual(result.pred_boxes.shape      ,						(self.batch_size, self.num_detection_tokens, 4) )

            lowerCAmelCase  						=       model(pixel_values=lowercase      ,						labels=lowercase )

            self.parent.assertEqual(result.loss.shape      ,						() )
            self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.num_detection_tokens, self.num_labels + 1) )
            self.parent.assertEqual(result.pred_boxes.shape      ,						(self.batch_size, self.num_detection_tokens, 4) )





      def     _snake_case			(       self )		->     List[str]:
            lowerCAmelCase  						=       self.prepare_config_and_inputs()
            lowerCAmelCase						,		lowerCAmelCase						,		lowerCAmelCase  						=       config_and_inputs
            lowerCAmelCase  						=       {"""pixel_values""": pixel_values}
            return config, inputs_dict







@require_torch
class 		lowercase					(					_UpperCAmelCase     ,  _UpperCAmelCase     ,  unittest.TestCase					):
      _SCREAMING_SNAKE_CASE					=      (YolosModel, YolosForObjectDetection) if is_torch_available() else ()
      _SCREAMING_SNAKE_CASE					=      (
          {'feature-extraction': YolosModel, 'object-detection': YolosForObjectDetection} if is_torch_available() else {}
      )

      _SCREAMING_SNAKE_CASE					=      False
      _SCREAMING_SNAKE_CASE					=      False
      _SCREAMING_SNAKE_CASE					=      False
      _SCREAMING_SNAKE_CASE					=      False





      def     _snake_case			(       self      ,						lowercase      ,						lowercase      ,						lowercase=False )		->     Union[str, Any]:
            lowerCAmelCase  						=       super()._prepare_for_class(lowercase      ,						lowercase      ,						return_labels=lowercase )

            if return_labels:
                  if model_class.__name__ == "YolosForObjectDetection":
                        lowerCAmelCase  						=       []
                        for i in range(self.model_tester.batch_size ):
                              lowerCAmelCase  						=       {}
                              lowerCAmelCase  						=       torch.ones(
                                  size=(self.model_tester.n_targets,)      ,						device=lowercase      ,						dtype=torch.long )
                              lowerCAmelCase  						=       torch.ones(
                                  self.model_tester.n_targets      ,						4      ,						device=lowercase      ,						dtype=torch.float )
                              labels.append(lowercase )
                        lowerCAmelCase  						=       labels

            return inputs_dict





      def     _snake_case			(       self )		->     Union[str, Any]:
            lowerCAmelCase  						=       YolosModelTester(self )
            lowerCAmelCase  						=       ConfigTester(self      ,						config_class=lowercase      ,						has_text_modality=lowercase      ,						hidden_size=37 )





      def     _snake_case			(       self )		->     str:
            self.config_tester.run_common_tests()





      def     _snake_case			(       self )		->     Optional[Any]:
            # YOLOS does not use inputs_embeds
            pass





      def     _snake_case			(       self )		->     Optional[int]:
            lowerCAmelCase						,		lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs_for_common()

            for model_class in self.all_model_classes:
                  lowerCAmelCase  						=       model_class(lowercase )
                  self.assertIsInstance(model.get_input_embeddings()      ,						(nn.Module) )
                  lowerCAmelCase  						=       model.get_output_embeddings()
                  self.assertTrue(x is None or isinstance(lowercase      ,						nn.Linear ) )





      def     _snake_case			(       self )		->     List[Any]:
            lowerCAmelCase						,		lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs_for_common()

            for model_class in self.all_model_classes:
                  lowerCAmelCase  						=       model_class(lowercase )
                  lowerCAmelCase  						=       inspect.signature(model.forward )
                  # signature.parameters is an OrderedDict => so arg_names order is deterministic
                  lowerCAmelCase  						=       [*signature.parameters.keys()]

                  lowerCAmelCase  						=       ["""pixel_values"""]
                  self.assertListEqual(arg_names[:1]      ,						lowercase )





      def     _snake_case			(       self )		->     Union[str, Any]:
            lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_model(*lowercase )





      def     _snake_case			(       self )		->     Any:
            lowerCAmelCase						,		lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs_for_common()
            lowerCAmelCase  						=       True

            # in YOLOS, the seq_len is different
            lowerCAmelCase  						=       self.model_tester.expected_seq_len
            for model_class in self.all_model_classes:
                  lowerCAmelCase  						=       True
                  lowerCAmelCase  						=       False
                  lowerCAmelCase  						=       True
                  lowerCAmelCase  						=       model_class(lowercase )
                  model.to(lowercase )
                  model.eval()
                  with torch.no_grad():
                        lowerCAmelCase  						=       model(**self._prepare_for_class(lowercase      ,						lowercase ) )
                  lowerCAmelCase  						=       outputs.attentions
                  self.assertEqual(len(lowercase )      ,						self.model_tester.num_hidden_layers )

                  # check that output_attentions also work using config
                  del inputs_dict["output_attentions"]
                  lowerCAmelCase  						=       True
                  lowerCAmelCase  						=       model_class(lowercase )
                  model.to(lowercase )
                  model.eval()
                  with torch.no_grad():
                        lowerCAmelCase  						=       model(**self._prepare_for_class(lowercase      ,						lowercase ) )
                  lowerCAmelCase  						=       outputs.attentions
                  self.assertEqual(len(lowercase )      ,						self.model_tester.num_hidden_layers )

                  self.assertListEqual(
                      list(attentions[0].shape[-3:] )      ,						[self.model_tester.num_attention_heads, seq_len, seq_len]      ,						)
                  lowerCAmelCase  						=       len(lowercase )

                  # Check attention is always last and order is fine
                  lowerCAmelCase  						=       True
                  lowerCAmelCase  						=       True
                  lowerCAmelCase  						=       model_class(lowercase )
                  model.to(lowercase )
                  model.eval()
                  with torch.no_grad():
                        lowerCAmelCase  						=       model(**self._prepare_for_class(lowercase      ,						lowercase ) )

                  lowerCAmelCase  						=       1
                  self.assertEqual(out_len + added_hidden_states      ,						len(lowercase ) )

                  lowerCAmelCase  						=       outputs.attentions

                  self.assertEqual(len(lowercase )      ,						self.model_tester.num_hidden_layers )
                  self.assertListEqual(
                      list(self_attentions[0].shape[-3:] )      ,						[self.model_tester.num_attention_heads, seq_len, seq_len]      ,						)





      def     _snake_case			(       self )		->     Optional[Any]:
            def check_hidden_states_output(lowercase      ,						lowercase      ,						lowercase ):
                  lowerCAmelCase  						=       model_class(lowercase )
                  model.to(lowercase )
                  model.eval()

                  with torch.no_grad():
                        lowerCAmelCase  						=       model(**self._prepare_for_class(lowercase      ,						lowercase ) )

                  lowerCAmelCase  						=       outputs.hidden_states

                  lowerCAmelCase  						=       getattr(
                      self.model_tester      ,						"""expected_num_hidden_layers"""      ,						self.model_tester.num_hidden_layers + 1 )
                  self.assertEqual(len(lowercase )      ,						lowercase )

                  # YOLOS has a different seq_length
                  lowerCAmelCase  						=       self.model_tester.expected_seq_len

                  self.assertListEqual(
                      list(hidden_states[0].shape[-2:] )      ,						[seq_length, self.model_tester.hidden_size]      ,						)

            lowerCAmelCase						,		lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs_for_common()

            for model_class in self.all_model_classes:
                  lowerCAmelCase  						=       True
                  check_hidden_states_output(lowercase      ,						lowercase      ,						lowercase )

                  # check that output_hidden_states also work using config
                  del inputs_dict["output_hidden_states"]
                  lowerCAmelCase  						=       True

                  check_hidden_states_output(lowercase      ,						lowercase      ,						lowercase )





      def     _snake_case			(       self )		->     Union[str, Any]:
            lowerCAmelCase  						=       self.model_tester.prepare_config_and_inputs()
            self.model_tester.create_and_check_for_object_detection(*lowercase )





      @slow
      def     _snake_case			(       self )		->     Dict:
            for model_name in YOLOS_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                  lowerCAmelCase  						=       YolosModel.from_pretrained(lowercase )
                  self.assertIsNotNone(lowercase )







def 			UpperCAmelCase__							(  ):







      '''simple docstring'''




      lowerCAmelCase  						=       Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""			)
      return image






@require_torch
@require_vision
class 		lowercase					(					unittest.TestCase					):





      @cached_property
      def     _snake_case			(       self )		->     List[str]:
            return AutoImageProcessor.from_pretrained("""hustvl/yolos-small""" ) if is_vision_available() else None





      @slow
      def     _snake_case			(       self )		->     List[str]:
            lowerCAmelCase  						=       YolosForObjectDetection.from_pretrained("""hustvl/yolos-small""" ).to(lowercase )

            lowerCAmelCase  						=       self.default_image_processor
            lowerCAmelCase  						=       prepare_img()
            lowerCAmelCase  						=       image_processor(images=lowercase      ,						return_tensors="""pt""" ).to(lowercase )

            # forward pass
            with torch.no_grad():
                  lowerCAmelCase  						=       model(inputs.pixel_values )

            # verify outputs
            lowerCAmelCase  						=       torch.Size((1, 100, 92) )
            self.assertEqual(outputs.logits.shape      ,						lowercase )

            lowerCAmelCase  						=       torch.tensor(
                [[-24.0_248, -10.3_024, -14.8_290], [-42.0_392, -16.8_200, -27.4_334], [-27.2_743, -11.8_154, -18.7_148]]      ,						device=lowercase      ,						)
            lowerCAmelCase  						=       torch.tensor(
                [[0.2_559, 0.5_455, 0.4_706], [0.2_989, 0.7_279, 0.1_875], [0.7_732, 0.4_017, 0.4_462]]      ,						device=lowercase )
            self.assertTrue(torch.allclose(outputs.logits[0, :3, :3]      ,						lowercase      ,						atol=1e-4 ) )
            self.assertTrue(torch.allclose(outputs.pred_boxes[0, :3, :3]      ,						lowercase      ,						atol=1e-4 ) )

            # verify postprocessing
            lowerCAmelCase  						=       image_processor.post_process_object_detection(
                lowercase      ,						threshold=0.3      ,						target_sizes=[image.size[::-1]] )[0]
            lowerCAmelCase  						=       torch.tensor([0.9_994, 0.9_790, 0.9_964, 0.9_972, 0.9_861] ).to(lowercase )
            lowerCAmelCase  						=       [75, 75, 17, 63, 17]
            lowerCAmelCase  						=       torch.tensor([335.0_609, 79.3_848, 375.4_216, 187.2_495] ).to(lowercase )

            self.assertEqual(len(results["""scores"""] )      ,						5 )
            self.assertTrue(torch.allclose(results["""scores"""]      ,						lowercase      ,						atol=1e-4 ) )
            self.assertSequenceEqual(results["""labels"""].tolist()      ,						lowercase )
            self.assertTrue(torch.allclose(results["""boxes"""][0, :]      ,						lowercase ) )













"""simple docstring"""





import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


SCREAMING_SNAKE_CASE__					=   "▁"

SCREAMING_SNAKE_CASE__					=   {"vocab_file": "spiece.model"}

SCREAMING_SNAKE_CASE__					=   {
    "vocab_file": {"google/pegasus-xsum": "https://huggingface.co/google/pegasus-xsum/resolve/main/spiece.model"}
}

SCREAMING_SNAKE_CASE__					=   {
    "google/pegasus-xsum": 512,
}


SCREAMING_SNAKE_CASE__					=   logging.get_logger(__name__)

class 		lowercase					(					_UpperCAmelCase					):
      _SCREAMING_SNAKE_CASE					=      VOCAB_FILES_NAMES

      _SCREAMING_SNAKE_CASE					=      VOCAB_FILES_NAMES
      _SCREAMING_SNAKE_CASE					=      PRETRAINED_VOCAB_FILES_MAP
      _SCREAMING_SNAKE_CASE					=      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      _SCREAMING_SNAKE_CASE					=      ['input_ids', 'attention_mask']





      def __init__(       self      ,						lowercase      ,						lowercase="<pad>"      ,						lowercase="</s>"      ,						lowercase="<unk>"      ,						lowercase="<mask_2>"      ,						lowercase="<mask_1>"      ,						lowercase=None      ,						lowercase=103      ,						lowercase = None      ,						**lowercase      ,						)		->     None:
            lowerCAmelCase  						=       offset
            if additional_special_tokens is not None:
                  if not isinstance(lowercase      ,						lowercase ):
                        raise TypeError(
                            f'additional_special_tokens should be of type {type(lowercase )}, but is'
                            f' {type(lowercase )}' )

                  lowerCAmelCase  						=       (
                      ([mask_token_sent] + additional_special_tokens)
                      if mask_token_sent not in additional_special_tokens and mask_token_sent is not None
                      else additional_special_tokens
                  )
                  # fill additional tokens with ..., <unk_token_102> in case not all additional tokens are already taken
                  additional_special_tokens_extended += [
                      f'<unk_{i}>' for i in range(len(lowercase )      ,						self.offset - 1 )
                  ]

                  if len(set(lowercase ) ) != len(lowercase ):
                        raise ValueError(
                            """Please make sure that the provided additional_special_tokens do not contain an incorrectly"""
                            f' shifted list of <unk_x> tokens. Found {additional_special_tokens_extended}.' )
                  lowerCAmelCase  						=       additional_special_tokens_extended
            else:
                  lowerCAmelCase  						=       [mask_token_sent] if mask_token_sent is not None else []
                  additional_special_tokens += [f'<unk_{i}>' for i in range(2      ,						self.offset )]

            lowerCAmelCase  						=       {} if sp_model_kwargs is None else sp_model_kwargs

            super().__init__(
                eos_token=lowercase      ,						unk_token=lowercase      ,						mask_token=lowercase      ,						pad_token=lowercase      ,						mask_token_sent=lowercase      ,						offset=lowercase      ,						additional_special_tokens=lowercase      ,						sp_model_kwargs=self.sp_model_kwargs      ,						**lowercase      ,						)
            lowerCAmelCase  						=       mask_token_sent
            lowerCAmelCase  						=       vocab_file
            lowerCAmelCase  						=       spm.SentencePieceProcessor(**self.sp_model_kwargs )
            self.sp_model.Load(lowercase )

            # add special tokens to encoder dict
            lowerCAmelCase  						=       {
                0: self.pad_token,
                1: self.eos_token,
            }

            if self.mask_token_sent is not None:
                  self.encoder.update(
                      {
                          2: self.mask_token_sent,
                          3: self.mask_token,
                      } )

            if self.offset > 0:
                  # entries 2-104 are only used for pretraining and called <mask_1>, <mask_2>, unk_2, ...unk_102
                  # mask_token_sent is already added to list -> so start at 1
                  self.encoder.update({i + 3: additional_special_tokens[i] for i in range(1      ,						self.offset - 1 )} )

            lowerCAmelCase  						=       {v: k for k, v in self.encoder.items()}





      @property
      def     _snake_case			(       self )		->     int:
            return len(self.sp_model ) + self.offset





      def     _snake_case			(       self )		->     Dict[str, int]:
            lowerCAmelCase  						=       {self.convert_ids_to_tokens(lowercase ): i for i in range(self.vocab_size )}
            vocab.update(self.added_tokens_encoder )
            return vocab





      def __getstate__(       self )		->     Optional[int]:
            lowerCAmelCase  						=       self.__dict__.copy()
            lowerCAmelCase  						=       None
            return state





      def __setstate__(       self      ,						lowercase )		->     List[Any]:
            lowerCAmelCase  						=       d

            # for backward compatibility
            if not hasattr(self      ,						"""sp_model_kwargs""" ):
                  lowerCAmelCase  						=       {}

            lowerCAmelCase  						=       spm.SentencePieceProcessor(**self.sp_model_kwargs )
            self.sp_model.Load(self.vocab_file )





      def     _snake_case			(       self      ,						lowercase )		->     List[str]:
            return self.sp_model.encode(lowercase      ,						out_type=lowercase )





      def     _snake_case			(       self      ,						lowercase )		->     int:
            if token in self.decoder:
                  return self.decoder[token]
            elif token in self.added_tokens_decoder:
                  return self.added_tokens_decoder[token]
            lowerCAmelCase  						=       self.sp_model.piece_to_id(lowercase )
            return sp_id + self.offset





      def     _snake_case			(       self      ,						lowercase )		->     str:
            if index in self.encoder:
                  return self.encoder[index]
            elif index in self.added_tokens_encoder:
                  return self.added_tokens_encoder[index]
            else:
                  lowerCAmelCase  						=       self.sp_model.IdToPiece(index - self.offset )
            return token





      def     _snake_case			(       self      ,						lowercase )		->     Optional[int]:
            lowerCAmelCase  						=       []
            lowerCAmelCase  						=       """"""
            for token in tokens:
                  # make sure that special tokens are not decoded using sentencepiece model
                  if token in self.all_special_tokens:
                        out_string += self.sp_model.decode(lowercase ) + token
                        lowerCAmelCase  						=       []
                  else:
                        current_sub_tokens.append(lowercase )
            out_string += self.sp_model.decode(lowercase )
            return out_string.strip()





      def     _snake_case			(       self      ,						lowercase=False )		->     Tuple:
            return 1





      def     _snake_case			(       self      ,						lowercase )		->     Tuple:
            lowerCAmelCase  						=       set(self.all_special_ids )  # call it once instead of inside list comp
            all_special_ids.remove(self.unk_token_id )  # <unk> is only sometimes special

            return [1 if x in all_special_ids else 0 for x in seq]





      def     _snake_case			(       self      ,						lowercase      ,						lowercase = None      ,						lowercase = False )		->     List[int]:
            if already_has_special_tokens:
                  return self._special_token_mask(lowercase )
            elif token_ids_a is None:
                  return self._special_token_mask(lowercase ) + [1]
            else:
                  return self._special_token_mask(token_ids_a + token_ids_a ) + [1]





      def     _snake_case			(       self      ,						lowercase      ,						lowercase=None )		->     List[int]:
            if token_ids_a is None:
                  return token_ids_a + [self.eos_token_id]
            # We don't expect to process pairs, but leave the pair logic for API consistency
            return token_ids_a + token_ids_a + [self.eos_token_id]





      def     _snake_case			(       self      ,						lowercase      ,						lowercase = None )		->     Tuple[str]:
            if not os.path.isdir(lowercase ):
                  logger.error(f'Vocabulary path ({save_directory}) should be a directory' )
                  return
            lowerCAmelCase  						=       os.path.join(
                lowercase      ,						(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""] )

            if os.path.abspath(self.vocab_file ) != os.path.abspath(lowercase ) and os.path.isfile(self.vocab_file ):
                  copyfile(self.vocab_file      ,						lowercase )
            elif not os.path.isfile(self.vocab_file ):
                  with open(lowercase      ,						"""wb""" ) as fi:
                        lowerCAmelCase  						=       self.sp_model.serialized_model_proto()
                        fi.write(lowercase )

            return (out_vocab_file,)






