

import random
import unittest

import torch

from diffusers import IFSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS, TEXT_GUIDED_IMAGE_VARIATION_PARAMS
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin



@skip_mps
class 					A__(a_,     a_,     unittest.TestCase       ):
						"""simple docstring"""






						_A						:							Any									= IFSuperResolutionPipeline
						_A						:							int									= TEXT_GUIDED_IMAGE_VARIATION_PARAMS - {'''width''', '''height'''}
						_A						:							Optional[Any]									= TEXT_GUIDED_IMAGE_VARIATION_BATCH_PARAMS
						_A						:							Any									= PipelineTesterMixin.required_optional_params - {'''latents'''}





						def  UpperCamelCase__				(						self						)    ->   int:
									return self._get_superresolution_dummy_components()





						def  UpperCamelCase__				(						self     ,			_lowercase     ,			_lowercase=0						)    ->   List[Any]:
									if str(_lowercase						).startswith("""mps"""						):
												a_	:	Any          =   torch.manual_seed(_lowercase						)
									else:
												a_	:	Optional[Any]          =   torch.Generator(device=_lowercase						).manual_seed(_lowercase						)

									a_	:	Dict          =   floats_tensor((1, 3, 32, 32)     ,			rng=random.Random(_lowercase						)						).to(_lowercase						)

									a_	:	List[Any]          =   {
									    """prompt""": """A painting of a squirrel eating a burger""",
									    """image""": image,
									    """generator""": generator,
									    """num_inference_steps""": 2,
									    """output_type""": """numpy""",
									}

									return inputs





						@unittest.skipIf(
						    torch_device != """cuda""" or not is_xformers_available()     ,			reason="""XFormers attention is only available with CUDA and `xformers` installed"""     ,			)
						def  UpperCamelCase__				(						self						)    ->   Union[str, Any]:
									self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1e-3						)





						def  UpperCamelCase__				(						self						)    ->   Optional[int]:
									self._test_save_load_optional_components()





						@unittest.skipIf(torch_device != """cuda"""     ,			reason="""float16 requires CUDA"""						)
						def  UpperCamelCase__				(						self						)    ->   Any:
									# Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
									super().test_save_load_floataa(expected_max_diff=1e-1						)





						def  UpperCamelCase__				(						self						)    ->   Optional[Any]:
									self._test_attention_slicing_forward_pass(expected_max_diff=1e-2						)





						def  UpperCamelCase__				(						self						)    ->   Optional[Any]:
									self._test_save_load_local()





						def  UpperCamelCase__				(						self						)    ->   Dict:
									self._test_inference_batch_single_identical(
									    expected_max_diff=1e-2     ,			)





from collections import defaultdict


def 				_UpperCAmelCase							(	a__):

			'''simple docstring'''



			a_	:	defaultdict[str, int]          =   defaultdict(a__)
			# Creating a dictionary containing count of each word
			for word in sentence.split():
						occurrence[word] += 1
			return occurrence


if __name__ == "__main__":
	for word, count in word_occurrence("""INPUT STRING""").items():
		print(F"""{word}: {count}""")


