
'''simple docstring'''
import inspect
import unittest

import numpy as np

from tests.test_modeling_common import floats_tensor
from transformers import MaskaFormerConfig, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import cached_property

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


if is_torch_available():
  import torch

  from transformers import MaskaFormerForUniversalSegmentation, MaskaFormerModel

  if is_vision_available():
    from transformers import MaskaFormerImageProcessor

if is_vision_available():
  from PIL import Image






class    UpperCAmelCase_				:





 def __init__(    self ,       lowercase_ ,       lowercase_=2 ,       lowercase_=True ,       lowercase_=False ,       lowercase_=10 ,       lowercase_=3 ,       lowercase_=32 * 8 ,       lowercase_=32 * 8 ,       lowercase_=4 ,       lowercase_=64 ,       ):
     snake_case_ :    List[Any]     			=						parent
     snake_case_ :    Optional[int]     			=						batch_size
     snake_case_ :    Optional[int]     			=						is_training
     snake_case_ :    str     			=						use_auxiliary_loss
     snake_case_ :    int     			=						num_queries
     snake_case_ :    Dict     			=						num_channels
     snake_case_ :    str     			=						min_size
     snake_case_ :    Optional[int]     			=						max_size
     snake_case_ :    Any     			=						num_labels
     snake_case_ :    Any     			=						hidden_dim
     snake_case_ :    List[Any]     			=						hidden_dim





 def        snake_case__		(    self):
     snake_case_ :    str     			=						floats_tensor([self.batch_size, self.num_channels, self.min_size, self.max_size]).to(
         UpperCAmelCase__)

     snake_case_ :    str     			=						torch.ones([self.batch_size, self.min_size, self.max_size] ,       device=UpperCAmelCase__)

     snake_case_ :    List[str]     			=						(
         torch.rand([self.batch_size, self.num_labels, self.min_size, self.max_size] ,       device=UpperCAmelCase__) > 0.5
     ).float()
     snake_case_ :    Any     			=						(torch.rand((self.batch_size, self.num_labels) ,       device=UpperCAmelCase__) > 0.5).long()

     snake_case_ :    Tuple     			=						self.get_config()
     return config, pixel_values, pixel_mask, mask_labels, class_labels





 def        snake_case__		(    self):
     snake_case_ :    str     			=						MaskaFormerConfig(
         hidden_size=self.hidden_dim ,       )
     snake_case_ :    List[str]     			=						self.num_queries
     snake_case_ :    Tuple     			=						self.num_labels

     snake_case_ :    Tuple     			=						[1, 1, 1, 1]
     snake_case_ :    Tuple     			=						self.num_channels

     snake_case_ :    Any     			=						64
     snake_case_ :    List[Any]     			=						1_28
     snake_case_ :    Union[str, Any]     			=						self.hidden_dim
     snake_case_ :    str     			=						self.hidden_dim
     snake_case_ :    Dict     			=						self.hidden_dim
     return config





 def        snake_case__		(    self):
     snake_case_ :    int     			=						self.prepare_config_and_inputs()
     snake_case_ :    List[str]     			=						{'''pixel_values''': pixel_values, '''pixel_mask''': pixel_mask}
     return config, inputs_dict





 def        snake_case__		(    self ,       lowercase_ ,       lowercase_):
     snake_case_ :    str     			=						output.encoder_hidden_states
     snake_case_ :    Optional[Any]     			=						output.pixel_decoder_hidden_states
     snake_case_ :    List[Any]     			=						output.transformer_decoder_hidden_states

     self.parent.assertTrue(len(UpperCAmelCase__) ,       len(config.backbone_config.depths))
     self.parent.assertTrue(len(UpperCAmelCase__) ,       len(config.backbone_config.depths))
     self.parent.assertTrue(len(UpperCAmelCase__) ,       config.decoder_layers)





 def        snake_case__		(    self ,       lowercase_ ,       lowercase_ ,       lowercase_ ,       lowercase_=False):
     with torch.no_grad():
         snake_case_ :    int     			=						MaskaFormerModel(config=UpperCAmelCase__)
         model.to(UpperCAmelCase__)
         model.eval()

         snake_case_ :    List[Any]     			=						model(pixel_values=UpperCAmelCase__ ,       pixel_mask=UpperCAmelCase__)
         snake_case_ :    Dict     			=						model(UpperCAmelCase__ ,       output_hidden_states=UpperCAmelCase__)

     self.parent.assertEqual(
         output.transformer_decoder_last_hidden_state.shape ,       (self.batch_size, self.num_queries, self.hidden_dim) ,       )
     # let's ensure the other two hidden state exists
     self.parent.assertTrue(output.pixel_decoder_last_hidden_state is not None)
     self.parent.assertTrue(output.encoder_last_hidden_state is not None)

     if output_hidden_states:
         self.check_output_hidden_state(UpperCAmelCase__ ,       UpperCAmelCase__)





 def        snake_case__		(    self ,       lowercase_ ,       lowercase_ ,       lowercase_ ,       lowercase_ ,       lowercase_):
     snake_case_ :    int     			=						MaskaFormerForUniversalSegmentation(config=UpperCAmelCase__)
     model.to(UpperCAmelCase__)
     model.eval()

     def comm_check_on_output(lowercase_):
         # let's still check that all the required stuff is there
         self.parent.assertTrue(result.transformer_decoder_last_hidden_state is not None)
         self.parent.assertTrue(result.pixel_decoder_last_hidden_state is not None)
         self.parent.assertTrue(result.encoder_last_hidden_state is not None)
         # okay, now we need to check the logits shape
         # due to the encoder compression, masks have a //4 spatial size
         self.parent.assertEqual(
             result.masks_queries_logits.shape ,       (self.batch_size, self.num_queries, self.min_size // 4, self.max_size // 4) ,       )
         # + 1 for null class
         self.parent.assertEqual(
             result.class_queries_logits.shape ,       (self.batch_size, self.num_queries, self.num_labels + 1))

     with torch.no_grad():
         snake_case_ :    Optional[Any]     			=						model(pixel_values=UpperCAmelCase__ ,       pixel_mask=UpperCAmelCase__)
         snake_case_ :    List[Any]     			=						model(UpperCAmelCase__)

         comm_check_on_output(UpperCAmelCase__)

         snake_case_ :    str     			=						model(
             pixel_values=UpperCAmelCase__ ,       pixel_mask=UpperCAmelCase__ ,       mask_labels=UpperCAmelCase__ ,       class_labels=UpperCAmelCase__)

     comm_check_on_output(UpperCAmelCase__)

     self.parent.assertTrue(result.loss is not None)
     self.parent.assertEqual(result.loss.shape ,       torch.Size([1]))






@require_torch
class    UpperCAmelCase_				(	lowercase__    ,						lowercase__    ,						unittest.TestCase					):
 UpperCAmelCase_		    =						(MaskaFormerModel, MaskaFormerForUniversalSegmentation) if is_torch_available() else ()
 UpperCAmelCase_		    =						{"""feature-extraction""": MaskaFormerModel} if is_torch_available() else {}

 UpperCAmelCase_		    =						False
 UpperCAmelCase_		    =						False
 UpperCAmelCase_		    =						False
 UpperCAmelCase_		    =						False





 def        snake_case__		(    self):
     snake_case_ :    List[str]     			=						MaskaFormerModelTester(self)
     snake_case_ :    Optional[Any]     			=						ConfigTester(self ,       config_class=UpperCAmelCase__ ,       has_text_modality=UpperCAmelCase__)





 def        snake_case__		(    self):
     self.config_tester.run_common_tests()





 def        snake_case__		(    self):
     snake_case_ :    Optional[Any]     			=						self.model_tester.prepare_config_and_inputs_for_common()
     self.model_tester.create_and_check_maskaformer_model(UpperCAmelCase__ ,       **UpperCAmelCase__ ,       output_hidden_states=UpperCAmelCase__)





 def        snake_case__		(    self):
     snake_case_ :    List[str]     			=						self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_maskaformer_instance_segmentation_head_model(*UpperCAmelCase__)





 @unittest.skip(reason="Mask2Former does not use inputs_embeds")
 def        snake_case__		(    self):
     pass





 @unittest.skip(reason="Mask2Former does not have a get_input_embeddings method")
 def        snake_case__		(    self):
     pass





 @unittest.skip(reason="Mask2Former is not a generative model")
 def        snake_case__		(    self):
     pass





 @unittest.skip(reason="Mask2Former does not use token embeddings")
 def        snake_case__		(    self):
     pass





 @require_torch_multi_gpu
 @unittest.skip(
     reason="Mask2Former has some layers using `add_module` which doesn\'t work well with `nn.DataParallel`")
 def        snake_case__		(    self):
     pass





 @unittest.skip("Will be fixed soon by reducing the size of the model used for common tests.")
 def        snake_case__		(    self):
     pass





 def        snake_case__		(    self):
     snake_case_ :    Any     			=						self.model_tester.prepare_config_and_inputs_for_common()

     for model_class in self.all_model_classes:
         snake_case_ :    Tuple     			=						model_class(UpperCAmelCase__)
         snake_case_ :    int     			=						inspect.signature(model.forward)
         # signature.parameters is an OrderedDict => so arg_names order is deterministic
         snake_case_ :    List[str]     			=						[*signature.parameters.keys()]

         snake_case_ :    Tuple     			=						['''pixel_values''']
         self.assertListEqual(arg_names[:1] ,       UpperCAmelCase__)





 @slow
 def        snake_case__		(    self):
     for model_name in ["facebook/mask2former-swin-small-coco-instance"]:
         snake_case_ :    Dict     			=						MaskaFormerModel.from_pretrained(UpperCAmelCase__)
         self.assertIsNotNone(UpperCAmelCase__)





 def        snake_case__		(    self):
     snake_case_ :    int     			=						(self.model_tester.min_size,) * 2
     snake_case_ :    int     			=						{
         '''pixel_values''': torch.randn((2, 3, *size) ,       device=UpperCAmelCase__),
         '''mask_labels''': torch.randn((2, 10, *size) ,       device=UpperCAmelCase__),
         '''class_labels''': torch.zeros(2 ,       10 ,       device=UpperCAmelCase__).long(),
     }
     snake_case_ :    Tuple     			=						self.model_tester.get_config()

     snake_case_ :    List[Any]     			=						MaskaFormerForUniversalSegmentation(UpperCAmelCase__).to(UpperCAmelCase__)
     snake_case_ :    List[str]     			=						model(**UpperCAmelCase__)
     self.assertTrue(outputs.loss is not None)





 def        snake_case__		(    self):
     snake_case_ :    Optional[Any]     			=						self.model_tester.prepare_config_and_inputs_for_common()
     self.model_tester.create_and_check_maskaformer_model(UpperCAmelCase__ ,       **UpperCAmelCase__ ,       output_hidden_states=UpperCAmelCase__)





 def        snake_case__		(    self):
     snake_case_ :    int     			=						self.model_tester.prepare_config_and_inputs_for_common()

     for model_class in self.all_model_classes:
         snake_case_ :    Dict     			=						model_class(UpperCAmelCase__).to(UpperCAmelCase__)
         snake_case_ :    Any     			=						model(**UpperCAmelCase__ ,       output_attentions=UpperCAmelCase__)
         self.assertTrue(outputs.attentions is not None)





 def        snake_case__		(    self):
     if not self.model_tester.is_training:
         return

     snake_case_ :    Optional[Any]     			=						self.all_model_classes[1]
     snake_case_ :    Dict     			=						self.model_tester.prepare_config_and_inputs()

     snake_case_ :    str     			=						model_class(UpperCAmelCase__)
     model.to(UpperCAmelCase__)
     model.train()

     snake_case_ :    Union[str, Any]     			=						model(UpperCAmelCase__ ,       mask_labels=UpperCAmelCase__ ,       class_labels=UpperCAmelCase__).loss
     loss.backward()





 def        snake_case__		(    self):
     snake_case_ :    Union[str, Any]     			=						self.all_model_classes[1]
     snake_case_ :    Dict     			=						self.model_tester.prepare_config_and_inputs()
     snake_case_ :    str     			=						True
     snake_case_ :    Tuple     			=						True

     snake_case_ :    Union[str, Any]     			=						model_class(UpperCAmelCase__).to(UpperCAmelCase__)
     model.train()

     snake_case_ :    int     			=						model(UpperCAmelCase__ ,       mask_labels=UpperCAmelCase__ ,       class_labels=UpperCAmelCase__)

     snake_case_ :    Optional[Any]     			=						outputs.encoder_hidden_states[0]
     encoder_hidden_states.retain_grad()

     snake_case_ :    int     			=						outputs.pixel_decoder_hidden_states[0]
     pixel_decoder_hidden_states.retain_grad()

     snake_case_ :    Optional[Any]     			=						outputs.transformer_decoder_hidden_states[0]
     transformer_decoder_hidden_states.retain_grad()

     snake_case_ :    Dict     			=						outputs.attentions[0]
     attentions.retain_grad()

     outputs.loss.backward(retain_graph=UpperCAmelCase__)

     self.assertIsNotNone(encoder_hidden_states.grad)
     self.assertIsNotNone(pixel_decoder_hidden_states.grad)
     self.assertIsNotNone(transformer_decoder_hidden_states.grad)
     self.assertIsNotNone(attentions.grad)


a_											=						1E-4

def 						UpperCamelCase_     (	):
    """simple docstring"""






    snake_case_ :    List[Any]     			=						Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"       )
    return image






@require_vision
@slow
class    UpperCAmelCase_				(	unittest.TestCase					):





 @cached_property
 def        snake_case__		(    self):
     return "facebook/mask2former-swin-small-coco-instance"





 @cached_property
 def        snake_case__		(    self):
     return MaskaFormerImageProcessor.from_pretrained(self.model_checkpoints) if is_vision_available() else None





 def        snake_case__		(    self):
     snake_case_ :    int     			=						MaskaFormerModel.from_pretrained(self.model_checkpoints).to(UpperCAmelCase__)
     snake_case_ :    Dict     			=						self.default_image_processor
     snake_case_ :    Optional[int]     			=						prepare_img()
     snake_case_ :    Any     			=						image_processor(UpperCAmelCase__ ,       return_tensors="pt").to(UpperCAmelCase__)
     snake_case_ :    Optional[Any]     			=						inputs['''pixel_values'''].shape
     # check size is divisible by 32
     self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0)
     # check size
     self.assertEqual(UpperCAmelCase__ ,       (1, 3, 3_84, 3_84))

     with torch.no_grad():
         snake_case_ :    Union[str, Any]     			=						model(**UpperCAmelCase__)

     snake_case_ :    List[Any]     			=						torch.tensor(
         [[-0.2_790, -1.0_717, -1.1_668], [-0.5_128, -0.3_128, -0.4_987], [-0.5_832, 0.1_971, -0.0_197]]).to(UpperCAmelCase__)
     self.assertTrue(
         torch.allclose(
             outputs.encoder_last_hidden_state[0, 0, :3, :3] ,       UpperCAmelCase__ ,       atol=UpperCAmelCase__))

     snake_case_ :    Optional[int]     			=						torch.tensor(
         [[0.8_973, 1.1_847, 1.1_776], [1.1_934, 1.5_040, 1.5_128], [1.1_153, 1.4_486, 1.4_951]]).to(UpperCAmelCase__)
     self.assertTrue(
         torch.allclose(
             outputs.pixel_decoder_last_hidden_state[0, 0, :3, :3] ,       UpperCAmelCase__ ,       atol=UpperCAmelCase__))

     snake_case_ :    int     			=						torch.tensor(
         [[2.1_152, 1.7_000, -0.8_603], [1.5_808, 1.8_004, -0.9_353], [1.6_043, 1.7_495, -0.5_999]]).to(UpperCAmelCase__)
     self.assertTrue(
         torch.allclose(
             outputs.transformer_decoder_last_hidden_state[0, :3, :3] ,       UpperCAmelCase__ ,       atol=UpperCAmelCase__))





 def        snake_case__		(    self):
     snake_case_ :    Optional[Any]     			=						MaskaFormerForUniversalSegmentation.from_pretrained(self.model_checkpoints).to(UpperCAmelCase__).eval()
     snake_case_ :    str     			=						self.default_image_processor
     snake_case_ :    str     			=						prepare_img()
     snake_case_ :    Tuple     			=						image_processor(UpperCAmelCase__ ,       return_tensors="pt").to(UpperCAmelCase__)
     snake_case_ :    List[str]     			=						inputs['''pixel_values'''].shape
     # check size is divisible by 32
     self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0)
     # check size
     self.assertEqual(UpperCAmelCase__ ,       (1, 3, 3_84, 3_84))

     with torch.no_grad():
         snake_case_ :    Optional[Any]     			=						model(**UpperCAmelCase__)
     # masks_queries_logits
     snake_case_ :    List[Any]     			=						outputs.masks_queries_logits
     self.assertEqual(
         masks_queries_logits.shape ,       (1, model.config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4))
     snake_case_ :    List[Any]     			=						[
         [-8.7_839, -9.0_056, -8.8_121],
         [-7.4_104, -7.0_313, -6.5_401],
         [-6.6_105, -6.3_427, -6.4_675],
     ]
     snake_case_ :    Union[str, Any]     			=						torch.tensor(UpperCAmelCase__).to(UpperCAmelCase__)
     self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3] ,       UpperCAmelCase__ ,       atol=UpperCAmelCase__))
     # class_queries_logits
     snake_case_ :    Dict     			=						outputs.class_queries_logits
     self.assertEqual(class_queries_logits.shape ,       (1, model.config.num_queries, model.config.num_labels + 1))
     snake_case_ :    Optional[Any]     			=						torch.tensor(
         [
             [1.8_324, -8.0_835, -4.1_922],
             [0.8_450, -9.0_050, -3.6_053],
             [0.3_045, -7.7_293, -3.0_275],
         ]).to(UpperCAmelCase__)
     self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3] ,       UpperCAmelCase__ ,       atol=UpperCAmelCase__))





 def        snake_case__		(    self):
     snake_case_ :    List[str]     			=						MaskaFormerForUniversalSegmentation.from_pretrained(self.model_checkpoints).to(UpperCAmelCase__).eval()
     snake_case_ :    int     			=						self.default_image_processor

     snake_case_ :    Tuple     			=						image_processor(
         [np.zeros((3, 8_00, 13_33)), np.zeros((3, 8_00, 13_33))] ,       segmentation_maps=[np.zeros((3_84, 3_84)).astype(np.floataa), np.zeros((3_84, 3_84)).astype(np.floataa)] ,       return_tensors="pt" ,       )

     snake_case_ :    Tuple     			=						inputs['''pixel_values'''].to(UpperCAmelCase__)
     snake_case_ :    Dict     			=						[el.to(UpperCAmelCase__) for el in inputs['''mask_labels''']]
     snake_case_ :    Union[str, Any]     			=						[el.to(UpperCAmelCase__) for el in inputs['''class_labels''']]

     with torch.no_grad():
         snake_case_ :    List[str]     			=						model(**UpperCAmelCase__)

     self.assertTrue(outputs.loss is not None)






'''simple docstring'''
import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
  from .tokenization_pegasus import PegasusTokenizer
else:
  a_											=						None


a_											=						logging.get_logger(__name__)


a_											=						"▁"

a_											=						{"vocab_file": "spiece.model", "tokenizer_file": "tokenizer.json"}

a_											=						{
    "vocab_file": {"google/pegasus-xsum": "https://huggingface.co/google/pegasus-xsum/resolve/main/spiece.model"},
    "tokenizer_file": {
        "google/pegasus-xsum": "https://huggingface.co/google/pegasus-xsum/resolve/main/tokenizer.json"
    },
}

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






class    UpperCAmelCase_				(	snake_case__					):
 UpperCAmelCase_		    =						VOCAB_FILES_NAMES
 UpperCAmelCase_		    =						PRETRAINED_VOCAB_FILES_MAP
 UpperCAmelCase_		    =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 UpperCAmelCase_		    =						PegasusTokenizer
 UpperCAmelCase_		    =						["""input_ids""", """attention_mask"""]





 def __init__(    self ,       lowercase_=None ,       lowercase_=None ,       lowercase_="<pad>" ,       lowercase_="</s>" ,       lowercase_="<unk>" ,       lowercase_="<mask_2>" ,       lowercase_="<mask_1>" ,       lowercase_=None ,       lowercase_=1_03 ,       **lowercase_ ,       ):
     snake_case_ :    List[Any]     			=						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_)}')

         snake_case_ :    Tuple     			=						(
             ([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}.')
         snake_case_ :    Optional[Any]     			=						additional_special_tokens_extended
     else:
         snake_case_ :    Tuple     			=						[mask_token_sent] if mask_token_sent is not None else []
         additional_special_tokens += [F'<unk_{i}>' for i in range(2 ,       self.offset)]

     super().__init__(
         lowercase_ ,       tokenizer_file=lowercase_ ,       pad_token=lowercase_ ,       eos_token=lowercase_ ,       unk_token=lowercase_ ,       mask_token=lowercase_ ,       mask_token_sent=lowercase_ ,       offset=lowercase_ ,       additional_special_tokens=lowercase_ ,       **lowercase_ ,       )
     snake_case_ :    int     			=						vocab_file
     snake_case_ :    str     			=						False if not self.vocab_file else True





 def        snake_case__		(    self ,       lowercase_):
     snake_case_ :    Union[str, Any]     			=						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

     if all_special_ids != set(range(len(self.additional_special_tokens) + 3)):
         raise ValueError(
             "There should be 3 special tokens: mask_token, pad_token, and eos_token +"
             F' {len(self.additional_special_tokens)} additional_special_tokens, but got {all_special_ids}')

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





 def        snake_case__		(    self ,       lowercase_ ,       lowercase_ = None ,       lowercase_ = False):
     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):
     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):
     if not self.can_save_slow_tokenizer:
         raise ValueError(
             "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
             "tokenizer.")

     if not os.path.isdir(lowercase_):
         logger.error(F'Vocabulary path ({save_directory}) should be a directory')
         return
     snake_case_ :    Dict     			=						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_):
         copyfile(self.vocab_file ,       lowercase_)

     return (out_vocab_file,)




