


import unittest

import numpy as np
import torch

from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad

class 							lowercase  (						unittest.TestCase			):







     def 							lowercase__       (						self :						Optional[int]      ):
           SCREAMING_SNAKE_CASE__       :  List[str]						     =		10







     def 							lowercase__       (						self :						List[str]      ):
           SCREAMING_SNAKE_CASE__       :  Any						     =		[1, 2, 3, 4]
           SCREAMING_SNAKE_CASE__       :  Any						     =		[1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
           self.assertEqual(truncate_or_pad(_lowercase   ,   self.block_size   ,   0      )   ,   _lowercase      )







     def 							lowercase__       (						self :						str      ):
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
           SCREAMING_SNAKE_CASE__       :  str						     =		[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
           self.assertEqual(truncate_or_pad(_lowercase   ,   self.block_size   ,   0      )   ,   _lowercase      )







     def 							lowercase__       (						self :						Optional[int]      ):
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
           self.assertEqual(truncate_or_pad(_lowercase   ,   self.block_size   ,   0      )   ,   _lowercase      )







     def 							lowercase__       (						self :						Dict      ):
           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		'''It was the year of Our Lord one thousand seven hundred and
        seventy-five.\n\nSpiritual revelations were conceded to England at that
        favoured period, as at this.'''
           SCREAMING_SNAKE_CASE__     ,       SCREAMING_SNAKE_CASE__       :  List[Any]						     =		process_story(_lowercase      )
           self.assertEqual(_lowercase   ,   []      )







     def 							lowercase__       (						self :						str      ):
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		''''''
           SCREAMING_SNAKE_CASE__     ,       SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		process_story(_lowercase      )
           self.assertEqual(_lowercase   ,   []      )
           self.assertEqual(_lowercase   ,   []      )







     def 							lowercase__       (						self :						Optional[Any]      ):
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		(
               '''It was the year of Our Lord one thousand seven hundred and '''
               '''seventy-five\n\nSpiritual revelations were conceded to England '''
               '''at that favoured period, as at this.\n@highlight\n\nIt was the best of times'''
           )
           SCREAMING_SNAKE_CASE__     ,       SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		process_story(_lowercase      )

           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		[
               '''It was the year of Our Lord one thousand seven hundred and seventy-five.''',
               '''Spiritual revelations were conceded to England at that favoured period, as at this.''',
           ]
           self.assertEqual(_lowercase   ,   _lowercase      )

           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		['''It was the best of times.''']
           self.assertEqual(_lowercase   ,   _lowercase      )







     def 							lowercase__       (						self :						Tuple      ):
           SCREAMING_SNAKE_CASE__       :  Any						     =		torch.tensor([1, 2, 3, 4]      )
           SCREAMING_SNAKE_CASE__       :  Union[str, Any]						     =		torch.tensor([1, 1, 1, 1]      )
           np.testing.assert_array_equal(build_mask(_lowercase   ,   0      ).numpy()   ,   expected.numpy()      )







     def 							lowercase__       (						self :						int      ):
           SCREAMING_SNAKE_CASE__       :  List[Any]						     =		torch.tensor([1, 2, 3, 4, 23, 23, 23]      )
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		torch.tensor([1, 1, 1, 1, 0, 0, 0]      )
           np.testing.assert_array_equal(build_mask(_lowercase   ,   23      ).numpy()   ,   expected.numpy()      )







     def 							lowercase__       (						self :						Optional[int]      ):
           SCREAMING_SNAKE_CASE__       :  List[str]						     =		torch.tensor([8, 2, 3, 4, 1, 1, 1]      )
           SCREAMING_SNAKE_CASE__       :  int						     =		torch.tensor([1, 1, 1, 1, 0, 0, 0]      )
           np.testing.assert_array_equal(build_mask(_lowercase   ,   1      ).numpy()   ,   expected.numpy()      )







     def 							lowercase__       (						self :						Optional[Any]      ):
           SCREAMING_SNAKE_CASE__       :  Optional[Any]						     =		1_01
           SCREAMING_SNAKE_CASE__       :  Tuple						     =		torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 1_01, 5, 6], [1, 1_01, 3, 4, 1_01, 6]]      )
           SCREAMING_SNAKE_CASE__       :  int						     =		torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]      )

           SCREAMING_SNAKE_CASE__       :  Optional[int]						     =		compute_token_type_ids(_lowercase   ,   _lowercase      )
           np.testing.assert_array_equal(_lowercase   ,   _lowercase      )








"""simple docstring"""
import warnings

from ..trainer import Trainer
from ..utils import logging


SCREAMING_SNAKE_CASE_					     =	logging.get_logger(__name__)
class       lowerCAmelCase_		(				A__ ):



							'''simple docstring'''





							def __init__( self    ,				snake_case_=None    ,				**snake_case_				)       ->  Optional[Any]:
													warnings.warn(
													    """`SageMakerTrainer` is deprecated and will be removed in v5 of Transformers. You can use `Trainer` """
													    """instead."""    ,				snake_case_    ,				)
													super().__init__(args=snake_case_    ,				**snake_case_				)
