
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   SCREAMING_SNAKE_CASE__	(      unittest.TestCase   ):





	'''simple docstring'''



	@slow
	def 					A				(    self      :       str      ):


				'''simple docstring'''


				_snake_case            =     AutoImageProcessor.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'      )
				_snake_case            =     AutoModelForImageClassification.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'      )
				model.to(lowercase      )

				from datasets import load_dataset

				_snake_case            =     load_dataset('nielsr/rvlcdip-demo'      )

				_snake_case            =     dataset['train'][0]['image'].convert('RGB'      )

				_snake_case            =     image_processor(lowercase     ,    return_tensors='pt'      ).to(lowercase      )

				# forward pass
				with torch.no_grad():
							_snake_case            =     model(**lowercase      )
							_snake_case            =     outputs.logits

				_snake_case            =     torch.Size((1, 16)      )
				self.assertEqual(logits.shape     ,    lowercase      )

				_snake_case            =     torch.tensor(
				    [-0.4158, -0.4092, -0.4347]     ,    device=lowercase     ,    dtype=torch.float     ,    )
				self.assertTrue(torch.allclose(logits[0, :3]     ,    lowercase     ,    atol=1E-4      )      )







def     a     (		lowerCamelCase_							):






				'''simple docstring'''

				if p < 2:
								raise ValueError('''p should not be less than 2!'''							)
				elif p == 2:
								return True

				lowercase__  					=     4
				lowercase__  					=     (1 << p) - 1
				for _ in range(p - 2							):
								lowercase__  					=     ((s * s) - 2) % m
				return s == 0


if __name__ == "__main__":
							print(lucas_lehmer_test(7))
							print(lucas_lehmer_test(11))




