import unittest

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


if is_torch_available():
  import torch

  from transformers import AutoModelForImageClassification

if is_vision_available():
  from transformers import AutoImageProcessor
@require_torch
@require_vision
class    A_ (       unittest.TestCase ):

  @slow
  def 		_UpperCAmelCase   (		self :      int       ):
   __a       =  AutoImageProcessor.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"       )
   __a       =  AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"       )
   model.to(__SCREAMING_SNAKE_CASE       )

   from datasets import load_dataset

   __a       =  load_dataset("nielsr/rvlcdip-demo"       )

   __a       =  dataset["train"][0]["image"].convert("RGB"       )

   __a       =  image_processor(__SCREAMING_SNAKE_CASE     ,							return_tensors="pt"       ).to(__SCREAMING_SNAKE_CASE       )

   # forward pass
   with torch.no_grad():
    __a       =  model(**__SCREAMING_SNAKE_CASE       )
    __a       =  outputs.logits

   __a       =  torch.Size((1, 16)       )
   self.assertEqual(logits.shape     ,							__SCREAMING_SNAKE_CASE       )

   __a       =  torch.tensor(
       [-0.41_58, -0.40_92, -0.43_47]     ,							device=__SCREAMING_SNAKE_CASE     ,							dtype=torch.float     ,							)
   self.assertTrue(torch.allclose(logits[0, :3]     ,							__SCREAMING_SNAKE_CASE     ,							atol=1E-4       )       )



# Function to print upper half of diamond (pyramid)



def   __A		(			_A					):



 """simple docstring"""


 for i in range(0							,				_A					):
  for _ in range(0							,				n - i - 1					):  # printing spaces
   print(" "							,				end=""					)
  for _ in range(0							,				i + 1					):  # printing stars
   print("* "							,				end=""					)
  print()



def   __A		(			_A					):



 """simple docstring"""


 for i in range(_A							,				0							,				-1					):
  for _ in range(_A							,				0							,				-1					):  # printing stars
   print("* "							,				end=""					)
  print()
  for _ in range(n - i + 1							,				0							,				-1					):  # printing spaces
   print(" "							,				end=""					)



def   __A		(			_A					):



 """simple docstring"""


 if n <= 0:
  print("       ...       ....        nothing printing :("					)
  return
 floyd(_A					)  # upper half
 reverse_floyd(_A					)  # lower half


if __name__ == "__main__":
  print(R"""| /\ | |- |  |-  |--| |\  /| |-""")
  print(R"""|/  \| |- |_ |_  |__| | \/ | |_""")
  SCREAMING_SNAKE_CASE :	Tuple							     =		1
  while K:
    SCREAMING_SNAKE_CASE :	Tuple							     =		int(input("""enter the number and , and see the magic : """))
    print()
    pretty_print(user_number)
    SCREAMING_SNAKE_CASE :	Optional[int]							     =		int(input("""press 0 to exit... and 1 to continue..."""))

  print("""Good Bye...""")


