
import inspect
import unittest
import warnings
from math import ceil, floor

from transformers import LevitConfig
from transformers.file_utils import cached_property, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

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


if is_torch_available():
   import torch

   from transformers import (
       MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
       MODEL_MAPPING,
       LevitForImageClassification,
       LevitForImageClassificationWithTeacher,
       LevitModel,
   )
   from transformers.models.levit.modeling_levit import LEVIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
   from PIL import Image

   from transformers import LevitImageProcessor






class     UpperCAmelCase						(		A_					):



   def 							_SCREAMING_SNAKE_CASE  (self						:   str					)						->      List[str]:


          '''simple docstring'''


          snake_case			:  int     							= self.config_class(**self.inputs_dict					)
          self.parent.assertTrue(hasattr(snake_case__       ,		"hidden_sizes"					)					)
          self.parent.assertTrue(hasattr(snake_case__       ,		"num_attention_heads"					)					)






class     UpperCAmelCase						:



   def __init__(self						:   str       ,		snake_case__						:   Optional[int]       ,		snake_case__						:   Union[str, Any]=13       ,		snake_case__						:   str=64       ,		snake_case__						:   Optional[int]=3       ,		snake_case__						:   List[str]=3       ,		snake_case__						:   List[str]=2       ,		snake_case__						:   Union[str, Any]=1       ,		snake_case__						:   Tuple=16       ,		snake_case__						:   Any=[1_28, 2_56, 3_84]       ,		snake_case__						:   List[Any]=[4, 6, 8]       ,		snake_case__						:   str=[2, 3, 4]       ,		snake_case__						:   str=[16, 16, 16]       ,		snake_case__						:   List[Any]=0       ,		snake_case__						:   Any=[2, 2, 2]       ,		snake_case__						:   str=[2, 2, 2]       ,		snake_case__						:   Any=0.02       ,		snake_case__						:   Any=True       ,		snake_case__						:   Any=True       ,		snake_case__						:   str=2       ,		)						->      Optional[int]:


          '''simple docstring'''


          snake_case			:  List[Any]     							= parent
          snake_case			:  Optional[int]     							= batch_size
          snake_case			:  Optional[Any]     							= image_size
          snake_case			:  Union[str, Any]     							= num_channels
          snake_case			:  Optional[int]     							= kernel_size
          snake_case			:  str     							= stride
          snake_case			:  List[Any]     							= padding
          snake_case			:  List[Any]     							= hidden_sizes
          snake_case			:  Dict     							= num_attention_heads
          snake_case			:  List[Any]     							= depths
          snake_case			:  Dict     							= key_dim
          snake_case			:  int     							= drop_path_rate
          snake_case			:  Any     							= patch_size
          snake_case			:  Tuple     							= attention_ratio
          snake_case			:  Optional[int]     							= mlp_ratio
          snake_case			:  Optional[Any]     							= initializer_range
          snake_case			:  List[str]     							= [
              ["Subsample", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
              ["Subsample", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
          ]
          snake_case			:  int     							= is_training
          snake_case			:  Any     							= use_labels
          snake_case			:  int     							= num_labels
          snake_case			:  str     							= initializer_range



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[int]					)						->      Union[str, Any]:


          '''simple docstring'''


          snake_case			:  List[Any]     							= floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]					)

          snake_case			:  Union[str, Any]     							= None
          if self.use_labels:
                 snake_case			:  List[str]     							= ids_tensor([self.batch_size]       ,		self.num_labels					)

          snake_case			:  Any     							= self.get_config()
          return config, pixel_values, labels



   def 							_SCREAMING_SNAKE_CASE  (self						:   Tuple					)						->      List[Any]:


          '''simple docstring'''


          return LevitConfig(
              image_size=self.image_size       ,		num_channels=self.num_channels       ,		kernel_size=self.kernel_size       ,		stride=self.stride       ,		padding=self.padding       ,		patch_size=self.patch_size       ,		hidden_sizes=self.hidden_sizes       ,		num_attention_heads=self.num_attention_heads       ,		depths=self.depths       ,		key_dim=self.key_dim       ,		drop_path_rate=self.drop_path_rate       ,		mlp_ratio=self.mlp_ratio       ,		attention_ratio=self.attention_ratio       ,		initializer_range=self.initializer_range       ,		down_ops=self.down_ops       ,		)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Any       ,		snake_case__						:   List[str]       ,		snake_case__						:   List[str]       ,		snake_case__						:   List[Any]					)						->      Optional[int]:


          '''simple docstring'''


          snake_case			:  Optional[int]     							= LevitModel(config=snake_case__					)
          model.to(snake_case__					)
          model.eval()
          snake_case			:  Optional[int]     							= model(snake_case__					)
          snake_case			:  Optional[Any]     							= (self.image_size, self.image_size)
          snake_case							,   snake_case			:  Optional[int]     							= image_size[0], image_size[1]
          for _ in range(4					):
                 snake_case			:  List[Any]     							= floor(((height + 2 * self.padding - self.kernel_size) / self.stride) + 1					)
                 snake_case			:  Any     							= floor(((width + 2 * self.padding - self.kernel_size) / self.stride) + 1					)
          self.parent.assertEqual(
              result.last_hidden_state.shape       ,		(self.batch_size, ceil(height / 4					) * ceil(width / 4					), self.hidden_sizes[-1])       ,		)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Dict       ,		snake_case__						:   int       ,		snake_case__						:   Optional[Any]       ,		snake_case__						:   Optional[Any]					)						->      Optional[int]:


          '''simple docstring'''


          snake_case			:  Optional[Any]     							= self.num_labels
          snake_case			:  str     							= LevitForImageClassification(snake_case__					)
          model.to(snake_case__					)
          model.eval()
          snake_case			:  Optional[Any]     							= model(snake_case__       ,		labels=snake_case__					)
          self.parent.assertEqual(result.logits.shape       ,		(self.batch_size, self.num_labels)					)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      str:


          '''simple docstring'''


          snake_case			:  Optional[int]     							= self.prepare_config_and_inputs()
          snake_case							,   snake_case							,   snake_case			:  Any     							= config_and_inputs
          snake_case			:  int     							= {"pixel_values": pixel_values}
          return config, inputs_dict






@require_torch
class     UpperCAmelCase						(		A_			,A_			,unittest.TestCase					):
   A__   :						List[Any]			=	(
       (LevitModel, LevitForImageClassification, LevitForImageClassificationWithTeacher)
       if is_torch_available()
       else ()
   )
   A__   :						List[str]			=	(
       {
           "feature-extraction": LevitModel,
           "image-classification": (LevitForImageClassification, LevitForImageClassificationWithTeacher),
       }
       if is_torch_available()
       else {}
   )

   A__   :						Any			=	False
   A__   :						List[Any]			=	False
   A__   :						Optional[Any]			=	False
   A__   :						Any			=	False
   A__   :						str			=	False



   def 							_SCREAMING_SNAKE_CASE  (self						:   int					)						->      Union[str, Any]:


          '''simple docstring'''


          snake_case			:  Union[str, Any]     							= LevitModelTester(self					)
          snake_case			:  List[Any]     							= ConfigTester(self       ,		config_class=snake_case__       ,		has_text_modality=snake_case__       ,		hidden_size=37					)



   def 							_SCREAMING_SNAKE_CASE  (self						:   List[str]					)						->      Union[str, Any]:


          '''simple docstring'''


          self.create_and_test_config_common_properties()
          self.config_tester.create_and_test_config_to_json_string()
          self.config_tester.create_and_test_config_to_json_file()
          self.config_tester.create_and_test_config_from_and_save_pretrained()
          self.config_tester.create_and_test_config_with_num_labels()
          self.config_tester.check_config_can_be_init_without_params()
          self.config_tester.check_config_arguments_init()



   def 							_SCREAMING_SNAKE_CASE  (self						:   int					)						->      Dict:


          '''simple docstring'''


          return



   @unittest.skip(reason="Levit does not use inputs_embeds"					)
   def 							_SCREAMING_SNAKE_CASE  (self						:   str					)						->      Union[str, Any]:


          '''simple docstring'''


          pass



   @unittest.skip(reason="Levit does not support input and output embeddings"					)
   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      Dict:


          '''simple docstring'''


          pass



   @unittest.skip(reason="Levit does not output attentions"					)
   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      Union[str, Any]:


          '''simple docstring'''


          pass



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[int]					)						->      Optional[Any]:


          '''simple docstring'''


          snake_case							,   snake_case			:  List[Any]     							= self.model_tester.prepare_config_and_inputs_for_common()

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

                 snake_case			:  str     							= ["pixel_values"]
                 self.assertListEqual(arg_names[:1]       ,		snake_case__					)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Any					)						->      Optional[Any]:


          '''simple docstring'''


          def check_hidden_states_output(snake_case__						:   Dict       ,		snake_case__						:   Tuple       ,		snake_case__						:   Optional[int]					):
                 snake_case			:  Dict     							= model_class(snake_case__					)
                 model.to(snake_case__					)
                 model.eval()

                 with torch.no_grad():
                        snake_case			:  List[Any]     							= model(**self._prepare_for_class(snake_case__       ,		snake_case__					)					)

                 snake_case			:  int     							= outputs.hidden_states

                 snake_case			:  Any     							= len(self.model_tester.depths					) + 1
                 self.assertEqual(len(snake_case__					)       ,		snake_case__					)

                 snake_case			:  List[str]     							= (self.model_tester.image_size, self.model_tester.image_size)
                 snake_case							,   snake_case			:  str     							= image_size[0], image_size[1]
                 for _ in range(4					):
                        snake_case			:  int     							= floor(
                            (
                                (height + 2 * self.model_tester.padding - self.model_tester.kernel_size)
                                / self.model_tester.stride
                            )
                            + 1					)
                        snake_case			:  List[Any]     							= floor(
                            (
                                (width + 2 * self.model_tester.padding - self.model_tester.kernel_size)
                                / self.model_tester.stride
                            )
                            + 1					)
                 # verify the first hidden states (first block)
                 self.assertListEqual(
                     list(hidden_states[0].shape[-2:]					)       ,		[
                         height * width,
                         self.model_tester.hidden_sizes[0],
                     ]       ,		)

          snake_case							,   snake_case			:  List[str]     							= self.model_tester.prepare_config_and_inputs_for_common()

          for model_class in self.all_model_classes:
                 snake_case			:  List[Any]     							= True
                 check_hidden_states_output(snake_case__       ,		snake_case__       ,		snake_case__					)

                 # check that output_hidden_states also work using config
                 del inputs_dict["output_hidden_states"]
                 snake_case			:  List[Any]     							= True

                 check_hidden_states_output(snake_case__       ,		snake_case__       ,		snake_case__					)



   @unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."					)
   def 							_SCREAMING_SNAKE_CASE  (self						:   Any					)						->      str:


          '''simple docstring'''


          pass



   def 							_SCREAMING_SNAKE_CASE  (self						:   str       ,		snake_case__						:   Tuple       ,		snake_case__						:   Dict       ,		snake_case__						:   int=False					)						->      Any:


          '''simple docstring'''


          snake_case			:  Optional[Any]     							= super()._prepare_for_class(snake_case__       ,		snake_case__       ,		return_labels=snake_case__					)

          if return_labels:
                 if model_class.__name__ == "LevitForImageClassificationWithTeacher":
                        del inputs_dict["labels"]

          return inputs_dict



   def 							_SCREAMING_SNAKE_CASE  (self						:   List[Any]					)						->      Optional[int]:


          '''simple docstring'''


          snake_case			:  List[str]     							= self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_model(*snake_case__					)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Union[str, Any]					)						->      int:


          '''simple docstring'''


          snake_case			:  Union[str, Any]     							= self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_image_classification(*snake_case__					)



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      List[str]:


          '''simple docstring'''


          if not self.model_tester.is_training:
                 return

          snake_case							,   snake_case			:  List[Any]     							= self.model_tester.prepare_config_and_inputs_for_common()
          snake_case			:  List[str]     							= True

          for model_class in self.all_model_classes:
                 # LevitForImageClassificationWithTeacher supports inference-only
                 if (
                     model_class in get_values(snake_case__					)
                     or model_class.__name__ == "LevitForImageClassificationWithTeacher"
                 ):
                        continue
                 snake_case			:  str     							= model_class(snake_case__					)
                 model.to(snake_case__					)
                 model.train()
                 snake_case			:  Union[str, Any]     							= self._prepare_for_class(snake_case__       ,		snake_case__       ,		return_labels=snake_case__					)
                 snake_case			:  List[str]     							= model(**snake_case__					).loss
                 loss.backward()



   def 							_SCREAMING_SNAKE_CASE  (self						:   int					)						->      Optional[Any]:


          '''simple docstring'''


          snake_case							,   snake_case			:  Optional[int]     							= self.model_tester.prepare_config_and_inputs_for_common()
          if not self.model_tester.is_training:
                 return

          snake_case			:  Union[str, Any]     							= False
          snake_case			:  List[Any]     							= True

          for model_class in self.all_model_classes:
                 if model_class in get_values(snake_case__					) or not model_class.supports_gradient_checkpointing:
                        continue
                 # LevitForImageClassificationWithTeacher supports inference-only
                 if model_class.__name__ == "LevitForImageClassificationWithTeacher":
                        continue
                 snake_case			:  Tuple     							= model_class(snake_case__					)
                 model.gradient_checkpointing_enable()
                 model.to(snake_case__					)
                 model.train()
                 snake_case			:  str     							= self._prepare_for_class(snake_case__       ,		snake_case__       ,		return_labels=snake_case__					)
                 snake_case			:  str     							= model(**snake_case__					).loss
                 loss.backward()



   def 							_SCREAMING_SNAKE_CASE  (self						:   int					)						->      Optional[Any]:


          '''simple docstring'''


          snake_case							,   snake_case			:  List[Any]     							= self.model_tester.prepare_config_and_inputs_for_common()

          snake_case			:  List[str]     							= [
              {"title": "multi_label_classification", "num_labels": 2, "dtype": torch.float},
              {"title": "single_label_classification", "num_labels": 1, "dtype": torch.long},
              {"title": "regression", "num_labels": 1, "dtype": torch.float},
          ]

          for model_class in self.all_model_classes:
                 if (
                     model_class
                     not in [
                         *get_values(snake_case__					),
                     ]
                     or model_class.__name__ == "LevitForImageClassificationWithTeacher"
                 ):
                        continue

                 for problem_type in problem_types:
                        with self.subTest(msg=f"""Testing {model_class} with {problem_type['title']}"""					):
                               snake_case			:  str     							= problem_type["title"]
                               snake_case			:  Tuple     							= problem_type["num_labels"]

                               snake_case			:  str     							= model_class(snake_case__					)
                               model.to(snake_case__					)
                               model.train()

                               snake_case			:  Any     							= self._prepare_for_class(snake_case__       ,		snake_case__       ,		return_labels=snake_case__					)

                               if problem_type["num_labels"] > 1:
                                      snake_case			:  int     							= inputs["labels"].unsqueeze(1					).repeat(1       ,		problem_type["num_labels"]					)

                               snake_case			:  str     							= inputs["labels"].to(problem_type["dtype"]					)

                               # This tests that we do not trigger the warning form PyTorch "Using a target size that is different
                               # to the input size. This will likely lead to incorrect results due to broadcasting. Please ensure
                               # they have the same size." which is a symptom something in wrong for the regression problem.
                               # See https://github.com/huggingface/transformers/issues/11780
                               with warnings.catch_warnings(record=snake_case__					) as warning_list:
                                      snake_case			:  str     							= model(**snake_case__					).loss
                               for w in warning_list:
                                      if "Using a target size that is different to the input size" in str(w.message					):
                                             raise ValueError(
                                                 f"""Something is going wrong in the regression problem: intercepted {w.message}"""					)

                               loss.backward()



   @slow
   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      str:


          '''simple docstring'''


          for model_name in LEVIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                 snake_case			:  List[Any]     							= LevitModel.from_pretrained(snake_case__					)
                 self.assertIsNotNone(snake_case__					)



def      UpperCamelCase   (       ):
       snake_case			:  List[str]     							= Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"       )
       return image






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



   @cached_property
   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      Optional[int]:


          '''simple docstring'''


          return LevitImageProcessor.from_pretrained(LEVIT_PRETRAINED_MODEL_ARCHIVE_LIST[0]					)



   @slow
   def 							_SCREAMING_SNAKE_CASE  (self						:   List[str]					)						->      str:


          '''simple docstring'''


          snake_case			:  str     							= LevitForImageClassificationWithTeacher.from_pretrained(LEVIT_PRETRAINED_MODEL_ARCHIVE_LIST[0]					).to(
              snake_case__					)

          snake_case			:  Optional[int]     							= self.default_image_processor
          snake_case			:  Optional[int]     							= prepare_img()
          snake_case			:  List[Any]     							= image_processor(images=snake_case__       ,		return_tensors="pt"					).to(snake_case__					)

          # forward pass
          with torch.no_grad():
                 snake_case			:  Dict     							= model(**snake_case__					)

          # verify the logits
          snake_case			:  str     							= torch.Size((1, 10_00)					)
          self.assertEqual(outputs.logits.shape       ,		snake_case__					)

          snake_case			:  int     							= torch.tensor([1.0448, -0.3745, -1.8317]					).to(snake_case__					)

          self.assertTrue(torch.allclose(outputs.logits[0, :3]       ,		snake_case__       ,		atol=1e-4					)					)







import os
from argparse import ArgumentParser, Namespace

from ..data import SingleSentenceClassificationProcessor as Processor
from ..pipelines import TextClassificationPipeline
from ..utils import is_tf_available, is_torch_available, logging
from . import BaseTransformersCLICommand


if not is_tf_available() and not is_torch_available():
   raise RuntimeError("""At least one of PyTorch or TensorFlow 2.0+ should be installed to use CLI training""")

# TF training parameters
__lowerCamelCase				=			False
__lowerCamelCase				=			False


def      UpperCamelCase   (       __lowerCamelCase	:					Namespace       ):
       return TrainCommand(__lowerCamelCase       )






class     UpperCAmelCase						(		A_					):



   @staticmethod
   def 							_SCREAMING_SNAKE_CASE  (snake_case__						:   ArgumentParser					)						->      int:


          '''simple docstring'''


          snake_case			:  Any     							= parser.add_parser("train"       ,		help="CLI tool to train a model on a task."					)

          train_parser.add_argument(
              "--train_data"       ,		type=snake_case__       ,		required=snake_case__       ,		help="path to train (and optionally evaluation) dataset as a csv with tab separated labels and sentences."       ,		)
          train_parser.add_argument(
              "--column_label"       ,		type=snake_case__       ,		default=0       ,		help="Column of the dataset csv file with example labels."					)
          train_parser.add_argument(
              "--column_text"       ,		type=snake_case__       ,		default=1       ,		help="Column of the dataset csv file with example texts."					)
          train_parser.add_argument(
              "--column_id"       ,		type=snake_case__       ,		default=2       ,		help="Column of the dataset csv file with example ids."					)
          train_parser.add_argument(
              "--skip_first_row"       ,		action="store_true"       ,		help="Skip the first row of the csv file (headers)."					)

          train_parser.add_argument("--validation_data"       ,		type=snake_case__       ,		default=""       ,		help="path to validation dataset."					)
          train_parser.add_argument(
              "--validation_split"       ,		type=snake_case__       ,		default=0.1       ,		help="if validation dataset is not provided, fraction of train dataset to use as validation dataset."       ,		)

          train_parser.add_argument("--output"       ,		type=snake_case__       ,		default="./"       ,		help="path to saved the trained model."					)

          train_parser.add_argument(
              "--task"       ,		type=snake_case__       ,		default="text_classification"       ,		help="Task to train the model on."					)
          train_parser.add_argument(
              "--model"       ,		type=snake_case__       ,		default="bert-base-uncased"       ,		help="Model's name or path to stored model."					)
          train_parser.add_argument("--train_batch_size"       ,		type=snake_case__       ,		default=32       ,		help="Batch size for training."					)
          train_parser.add_argument("--valid_batch_size"       ,		type=snake_case__       ,		default=64       ,		help="Batch size for validation."					)
          train_parser.add_argument("--learning_rate"       ,		type=snake_case__       ,		default=3e-5       ,		help="Learning rate."					)
          train_parser.add_argument("--adam_epsilon"       ,		type=snake_case__       ,		default=1e-08       ,		help="Epsilon for Adam optimizer."					)
          train_parser.set_defaults(func=snake_case__					)



   def __init__(self						:   List[Any]       ,		snake_case__						:   Namespace					)						->      Tuple:


          '''simple docstring'''


          snake_case			:  Any     							= logging.get_logger("transformers-cli/training"					)

          snake_case			:  List[Any]     							= "tf" if is_tf_available() else "torch"

          os.makedirs(args.output       ,		exist_ok=snake_case__					)
          snake_case			:  Any     							= args.output

          snake_case			:  List[Any]     							= args.column_label
          snake_case			:  Tuple     							= args.column_text
          snake_case			:  str     							= args.column_id

          self.logger.info(f"""Loading {args.task} pipeline for {args.model}"""					)
          if args.task == "text_classification":
                 snake_case			:  Optional[int]     							= TextClassificationPipeline.from_pretrained(args.model					)
          elif args.task == "token_classification":
                 raise NotImplementedError
          elif args.task == "question_answering":
                 raise NotImplementedError

          self.logger.info(f"""Loading dataset from {args.train_data}"""					)
          snake_case			:  Tuple     							= Processor.create_from_csv(
              args.train_data       ,		column_label=args.column_label       ,		column_text=args.column_text       ,		column_id=args.column_id       ,		skip_first_row=args.skip_first_row       ,		)
          snake_case			:  Optional[Any]     							= None
          if args.validation_data:
                 self.logger.info(f"""Loading validation dataset from {args.validation_data}"""					)
                 snake_case			:  Dict     							= Processor.create_from_csv(
                     args.validation_data       ,		column_label=args.column_label       ,		column_text=args.column_text       ,		column_id=args.column_id       ,		skip_first_row=args.skip_first_row       ,		)

          snake_case			:  Union[str, Any]     							= args.validation_split
          snake_case			:  Optional[Any]     							= args.train_batch_size
          snake_case			:  List[str]     							= args.valid_batch_size
          snake_case			:  List[Any]     							= args.learning_rate
          snake_case			:  List[Any]     							= args.adam_epsilon



   def 							_SCREAMING_SNAKE_CASE  (self						:   int					)						->      List[str]:


          '''simple docstring'''


          if self.framework == "tf":
                 return self.run_tf()
          return self.run_torch()



   def 							_SCREAMING_SNAKE_CASE  (self						:   Tuple					)						->      Optional[Any]:


          '''simple docstring'''


          raise NotImplementedError



   def 							_SCREAMING_SNAKE_CASE  (self						:   Optional[Any]					)						->      Tuple:


          '''simple docstring'''


          self.pipeline.fit(
              self.train_dataset       ,		validation_data=self.valid_dataset       ,		validation_split=self.validation_split       ,		learning_rate=self.learning_rate       ,		adam_epsilon=self.adam_epsilon       ,		train_batch_size=self.train_batch_size       ,		valid_batch_size=self.valid_batch_size       ,		)

          # Save trained pipeline
          self.pipeline.save_pretrained(self.output					)





