






"""simple docstring"""







import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers import is_speech_available, is_vision_available
from transformers.testing_utils import require_torch


if is_vision_available():
		from transformers import TvltImageProcessor

if is_speech_available():
		from transformers import TvltFeatureExtractor

from transformers import TvltProcessor







@require_torch
class  lowerCamelCase__ (	unittest.TestCase			):






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	"""ZinengTang/tvlt-base"""
										UpperCAmelCase          =	tempfile.mkdtemp()






				def     _UpperCamelCase							(			self     ,**A ):
										return TvltImageProcessor.from_pretrained(self.checkpoint     ,**A )






				def     _UpperCamelCase							(			self     ,**A ):
										return TvltFeatureExtractor.from_pretrained(self.checkpoint     ,**A )






				def     _UpperCamelCase							(			self ):
										shutil.rmtree(self.tmpdirname )






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	self.get_image_processor()
										UpperCAmelCase          =	self.get_feature_extractor()

										UpperCAmelCase          =	TvltProcessor(image_processor=A     ,feature_extractor=A )
										processor.save_pretrained(self.tmpdirname )
										UpperCAmelCase          =	TvltProcessor.from_pretrained(self.tmpdirname )

										self.assertIsInstance(processor.feature_extractor     ,A )
										self.assertIsInstance(processor.image_processor     ,A )






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	self.get_image_processor()
										UpperCAmelCase          =	self.get_feature_extractor()

										UpperCAmelCase          =	TvltProcessor(image_processor=A     ,feature_extractor=A )

										UpperCAmelCase          =	np.ones([12_000] )

										UpperCAmelCase          =	feature_extractor(A     ,return_tensors="""np""" )
										UpperCAmelCase          =	processor(audio=A     ,return_tensors="""np""" )

										for key in audio_dict.keys():
																self.assertAlmostEqual(audio_dict[key].sum()     ,input_processor[key].sum()     ,delta=1e-2 )






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	self.get_image_processor()
										UpperCAmelCase          =	self.get_feature_extractor()

										UpperCAmelCase          =	TvltProcessor(image_processor=A     ,feature_extractor=A )

										UpperCAmelCase          =	np.ones([3, 224, 224] )

										UpperCAmelCase          =	image_processor(A     ,return_tensors="""np""" )
										UpperCAmelCase          =	processor(images=A     ,return_tensors="""np""" )

										for key in image_dict.keys():
																self.assertAlmostEqual(image_dict[key].sum()     ,input_processor[key].sum()     ,delta=1e-2 )






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	self.get_image_processor()
										UpperCAmelCase          =	self.get_feature_extractor()

										UpperCAmelCase          =	TvltProcessor(image_processor=A     ,feature_extractor=A )

										UpperCAmelCase          =	np.ones([12_000] )
										UpperCAmelCase          =	np.ones([3, 224, 224] )

										UpperCAmelCase          =	processor(audio=A     ,images=A )

										self.assertListEqual(list(inputs.keys() )     ,["""audio_values""", """audio_mask""", """pixel_values""", """pixel_mask"""] )

										# test if it raises when no input is passed
										with pytest.raises(A ):
																processor()






				def     _UpperCamelCase							(			self ):
										UpperCAmelCase          =	self.get_image_processor()
										UpperCAmelCase          =	self.get_feature_extractor()

										UpperCAmelCase          =	TvltProcessor(image_processor=A     ,feature_extractor=A )

										self.assertListEqual(
										    processor.model_input_names     ,image_processor.model_input_names + feature_extractor.model_input_names     ,msg="""`processor` and `image_processor`+`feature_extractor` model input names do not match"""     ,)











"""simple docstring"""







def _a			(		_snake_case = 6008_5147_5143							):







      """simple docstring"""






      try:
            UpperCAmelCase          =	int(_snake_case							)
      except (TypeError, ValueError):
            raise TypeError("""Parameter n must be int or castable to int."""							)
      if n <= 0:
            raise ValueError("""Parameter n must be greater than or equal to one."""							)
      UpperCAmelCase          =	1
      UpperCAmelCase          =	2
      while i * i <= n:
            while n % i == 0:
                  UpperCAmelCase          =	i
                  n //= i
            i += 1
      if n > 1:
            UpperCAmelCase          =	n
      return int(_snake_case							)


if __name__ == "__main__":
  print(F"""{solution() = }""")



