


import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
 import torch

 from transformers import CamembertModel
@require_torch
@require_sentencepiece
@require_tokenizers
class      UpperCAmelCase_ ( unittest.TestCase   ):

   '''simple docstring'''




   @slow
   def _snake_case   (		self			):






     """simple docstring"""





     lowerCamelCase			: Dict   =    CamembertModel.from_pretrained("camembert-base"			)
     model.to(__A			)

     lowerCamelCase			: Any   =    torch.tensor(
         [[5, 121, 11, 660, 16, 730, 2_5543, 110, 83, 6]]						,    device=__A						,    dtype=torch.long						,    )  # J'aime le camembert !
     with torch.no_grad():
       lowerCamelCase			: Union[str, Any]   =    model(__A			)["last_hidden_state"]
     lowerCamelCase			: Optional[int]   =    torch.Size((1, 10, 768)			)
     self.assertEqual(output.shape						,    __A			)
     # compare the actual values for a slice.
     lowerCamelCase			: Tuple   =    torch.tensor(
         [[[-0.0254, 0.0235, 0.1027], [0.0606, -0.1811, -0.0418], [-0.1561, -0.1127, 0.2687]]]						,    device=__A						,    dtype=torch.float						,    )
     # camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
     # camembert.eval()
     # expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

     self.assertTrue(torch.allclose(output[:, :3, :3]						,    __A						,    atol=1e-4			)			)







def 		lowercase_(  SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  if number != int(SCREAMING_SNAKE_CASE_     ):
    raise ValueError("factorial() only accepts integral values"     )
  if number < 0:
    raise ValueError("factorial() not defined for negative values"     )
  lowerCamelCase			: Optional[Any]   =    1
  for i in range(1				,						number + 1     ):
    value *= i
  return value






def 		lowercase_(  SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  if not isinstance(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     ):
    raise ValueError("factorial() only accepts integral values"     )
  if n < 0:
    raise ValueError("factorial() not defined for negative values"     )
  return 1 if n == 0 or n == 1 else n * factorial(n - 1     )


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   _snake_case					=					int(input('''Enter a positive integer: ''').strip() or 0)
   print(f'''factorial{n} is {factorial(n)}''')



