


"""simple docstring"""


import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
A     :   List[Any]			    =			sys.version_info >= (3, 1_0)


def _lowerCamelCase	(		_UpperCamelCase=None    , _UpperCamelCase=None      ):

			'''simple docstring'''




			return field(default_factory=lambda: default    , metadata=_UpperCamelCase      )
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    int
							__UpperCAmelCase						:    float
							__UpperCAmelCase						:    str
							__UpperCAmelCase						:    bool
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    int				      =4_2
							__UpperCAmelCase						:    str				      =field(default="""toto"""       ,metadata={"""help""": """help message"""}		)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    bool				      =False
							__UpperCAmelCase						:    bool				      =True
							__UpperCAmelCase						:    Optional[bool]				      =None
class   _UpperCamelCase  (   __lowercase		):
							'''simple docstring'''







							__UpperCAmelCase						:    List[Any]				      ='''titi'''
							__UpperCAmelCase						:    List[str]				      ='''toto'''
class   _UpperCamelCase  (   __lowercase		):
							'''simple docstring'''







							__UpperCAmelCase						:    List[str]				      ='''titi'''
							__UpperCAmelCase						:    Any				      ='''toto'''
							__UpperCAmelCase						:    Union[str, Any]				      =4_2
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    BasicEnum				      ="toto"

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			BasicEnum(self.foo	)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    MixedTypeEnum				      ="toto"

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			MixedTypeEnum(self.foo	)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    Optional[int]				      =None
							__UpperCAmelCase						:    Optional[float]				      =field(default=__lowercase       ,metadata={"""help""": """help message"""}		)
							__UpperCAmelCase						:    Optional[str]				      =None
							__UpperCAmelCase						:    Optional[List[str]]				      =list_field(default=[]		)
							__UpperCAmelCase						:    Optional[List[int]]				      =list_field(default=[]		)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    List[int]				      =list_field(default=[]		)
							__UpperCAmelCase						:    List[int]				      =list_field(default=[1, 2, 3]		)
							__UpperCAmelCase						:    List[str]				      =list_field(default=["""Hallo""", """Bonjour""", """Hello"""]		)
							__UpperCAmelCase						:    List[float]				      =list_field(default=[0.1, 0.2, 0.3]		)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    List[int]				      =field()
							__UpperCAmelCase						:    str				      =field()
							__UpperCAmelCase						:    BasicEnum				      =field()

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			BasicEnum(self.required_enum	)
@dataclass
class   _UpperCamelCase  :
							'''simple docstring'''







							__UpperCAmelCase						:    int
							__UpperCAmelCase						:    "BasicEnum"				      =field()
							__UpperCAmelCase						:    "Optional[bool]"				      =None
							__UpperCAmelCase						:    "str"				      =field(default="""toto"""       ,metadata={"""help""": """help message"""}		)
							__UpperCAmelCase						:    "List[str]"				      =list_field(default=["""Hallo""", """Bonjour""", """Hello"""]		)


if is_python_no_less_than_3_10:
	@dataclass
	class   _UpperCamelCase  :
								'''simple docstring'''







								__UpperCAmelCase						:    bool				      =False
								__UpperCAmelCase						:    bool				      =True
								__UpperCAmelCase						:    bool | None				      =None
	@dataclass
	class   _UpperCamelCase  :
								'''simple docstring'''







								__UpperCAmelCase						:    int | None				      =None
								__UpperCAmelCase						:    float | None				      =field(default=__lowercase       ,metadata={"""help""": """help message"""}		)
								__UpperCAmelCase						:    str | None				      =None
								__UpperCAmelCase						:    list[str] | None				      =list_field(default=[]		)
								__UpperCAmelCase						:    list[int] | None				      =list_field(default=[]		)


class   _UpperCamelCase  (   unittest.TestCase		):
							'''simple docstring'''







							def 			snake_case				(     self    ,   __a    ,   __a	):
										self.assertEqual(len(a._actions	)    ,   len(b._actions	)	)
										for x, y in zip(a._actions    ,   b._actions	):
													__lowerCAmelCase				    =			{k: v for k, v in vars(UpperCAmelCase__	).items() if k != "container"}
													__lowerCAmelCase				    =			{k: v for k, v in vars(UpperCAmelCase__	).items() if k != "container"}

													# Choices with mixed type have custom function as "type"
													# So we need to compare results directly for equality
													if xx.get("choices"    ,   UpperCAmelCase__	) and yy.get("choices"    ,   UpperCAmelCase__	):
																for expected_choice in yy["choices"] + xx["choices"]:
																			self.assertEqual(xx["type"](UpperCAmelCase__	)    ,   yy["type"](UpperCAmelCase__	)	)
																del xx["type"], yy["type"]

													self.assertEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument("--bar"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument("--baz"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument("--flag"    ,   type=UpperCAmelCase__    ,   default=UpperCAmelCase__    ,   const=UpperCAmelCase__    ,   nargs="?"	)
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

										__lowerCAmelCase				    =			["--foo", "1", "--baz", "quux", "--bar", "0.5"]
										((__lowerCAmelCase  )    ,	  )				    =			parser.parse_args_into_dataclasses(UpperCAmelCase__    ,   look_for_args_file=UpperCAmelCase__	)
										self.assertFalse(example.flag	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo"    ,   default=42    ,   type=UpperCAmelCase__	)
										expected.add_argument("--baz"    ,   default="toto"    ,   type=UpperCAmelCase__    ,   help="help message"	)
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo"    ,   type=UpperCAmelCase__    ,   default=UpperCAmelCase__    ,   const=UpperCAmelCase__    ,   nargs="?"	)
										expected.add_argument("--baz"    ,   type=UpperCAmelCase__    ,   default=UpperCAmelCase__    ,   const=UpperCAmelCase__    ,   nargs="?"	)
										# A boolean no_* argument always has to come after its "default: True" regular counter-part
										# and its default must be set to False
										expected.add_argument("--no_baz"    ,   action="store_false"    ,   default=UpperCAmelCase__    ,   dest="baz"	)
										expected.add_argument("--opt"    ,   type=UpperCAmelCase__    ,   default=UpperCAmelCase__	)

										__lowerCAmelCase				    =			[WithDefaultBoolExample]
										if is_python_no_less_than_3_10:
													dataclass_types.append(UpperCAmelCase__	)

										for dataclass_type in dataclass_types:
													__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)
													self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

													__lowerCAmelCase				    =			parser.parse_args([]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   opt=UpperCAmelCase__	)	)

													__lowerCAmelCase				    =			parser.parse_args(["--foo", "--no_baz"]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   opt=UpperCAmelCase__	)	)

													__lowerCAmelCase				    =			parser.parse_args(["--foo", "--baz"]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   opt=UpperCAmelCase__	)	)

													__lowerCAmelCase				    =			parser.parse_args(["--foo", "True", "--baz", "True", "--opt", "True"]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   opt=UpperCAmelCase__	)	)

													__lowerCAmelCase				    =			parser.parse_args(["--foo", "False", "--baz", "False", "--opt", "False"]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   opt=UpperCAmelCase__	)	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument(
										    "--foo"    ,   default="toto"    ,   choices=["titi", "toto", 42]    ,   type=make_choice_type_function(["titi", "toto", 42]	)    ,   )
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

										__lowerCAmelCase				    =			parser.parse_args([]	)
										self.assertEqual(args.foo    ,   "toto"	)
										__lowerCAmelCase				    =			parser.parse_args_into_dataclasses([]	)[0]
										self.assertEqual(enum_ex.foo    ,   MixedTypeEnum.toto	)

										__lowerCAmelCase				    =			parser.parse_args(["--foo", "titi"]	)
										self.assertEqual(args.foo    ,   "titi"	)
										__lowerCAmelCase				    =			parser.parse_args_into_dataclasses(["--foo", "titi"]	)[0]
										self.assertEqual(enum_ex.foo    ,   MixedTypeEnum.titi	)

										__lowerCAmelCase				    =			parser.parse_args(["--foo", "42"]	)
										self.assertEqual(args.foo    ,   42	)
										__lowerCAmelCase				    =			parser.parse_args_into_dataclasses(["--foo", "42"]	)[0]
										self.assertEqual(enum_ex.foo    ,   MixedTypeEnum.fourtytwo	)

							def 			snake_case				(     self	):
										@dataclass
										class   _UpperCamelCase  :
																	'''simple docstring'''







																	__UpperCAmelCase						:    Literal["titi", "toto", 4_2]				      ="toto"
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument(
										    "--foo"    ,   default="toto"    ,   choices=("titi", "toto", 42)    ,   type=make_choice_type_function(["titi", "toto", 42]	)    ,   )
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

										__lowerCAmelCase				    =			parser.parse_args([]	)
										self.assertEqual(args.foo    ,   "toto"	)

										__lowerCAmelCase				    =			parser.parse_args(["--foo", "titi"]	)
										self.assertEqual(args.foo    ,   "titi"	)

										__lowerCAmelCase				    =			parser.parse_args(["--foo", "42"]	)
										self.assertEqual(args.foo    ,   42	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo_int"    ,   nargs="+"    ,   default=[]    ,   type=UpperCAmelCase__	)
										expected.add_argument("--bar_int"    ,   nargs="+"    ,   default=[1, 2, 3]    ,   type=UpperCAmelCase__	)
										expected.add_argument("--foo_str"    ,   nargs="+"    ,   default=["Hallo", "Bonjour", "Hello"]    ,   type=UpperCAmelCase__	)
										expected.add_argument("--foo_float"    ,   nargs="+"    ,   default=[0.1, 0.2, 0.3]    ,   type=UpperCAmelCase__	)

										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

										__lowerCAmelCase				    =			parser.parse_args([]	)
										self.assertEqual(
										    UpperCAmelCase__    ,   Namespace(foo_int=[]    ,   bar_int=[1, 2, 3]    ,   foo_str=["Hallo", "Bonjour", "Hello"]    ,   foo_float=[0.1, 0.2, 0.3]	)    ,   )

										__lowerCAmelCase				    =			parser.parse_args("--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7".split()	)
										self.assertEqual(UpperCAmelCase__    ,   Namespace(foo_int=[1]    ,   bar_int=[2, 3]    ,   foo_str=["a", "b", "c"]    ,   foo_float=[0.1, 0.7]	)	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo"    ,   default=UpperCAmelCase__    ,   type=UpperCAmelCase__	)
										expected.add_argument("--bar"    ,   default=UpperCAmelCase__    ,   type=UpperCAmelCase__    ,   help="help message"	)
										expected.add_argument("--baz"    ,   default=UpperCAmelCase__    ,   type=UpperCAmelCase__	)
										expected.add_argument("--ces"    ,   nargs="+"    ,   default=[]    ,   type=UpperCAmelCase__	)
										expected.add_argument("--des"    ,   nargs="+"    ,   default=[]    ,   type=UpperCAmelCase__	)

										__lowerCAmelCase				    =			[OptionalExample]
										if is_python_no_less_than_3_10:
													dataclass_types.append(UpperCAmelCase__	)

										for dataclass_type in dataclass_types:
													__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

													self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

													__lowerCAmelCase				    =			parser.parse_args([]	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=UpperCAmelCase__    ,   bar=UpperCAmelCase__    ,   baz=UpperCAmelCase__    ,   ces=[]    ,   des=[]	)	)

													__lowerCAmelCase				    =			parser.parse_args("--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3".split()	)
													self.assertEqual(UpperCAmelCase__    ,   Namespace(foo=12    ,   bar=3.1_4    ,   baz="42"    ,   ces=["a", "b", "c"]    ,   des=[1, 2, 3]	)	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--required_list"    ,   nargs="+"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument("--required_str"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument(
										    "--required_enum"    ,   type=make_choice_type_function(["titi", "toto"]	)    ,   choices=["titi", "toto"]    ,   required=UpperCAmelCase__    ,   )
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			argparse.ArgumentParser()
										expected.add_argument("--foo"    ,   type=UpperCAmelCase__    ,   required=UpperCAmelCase__	)
										expected.add_argument(
										    "--required_enum"    ,   type=make_choice_type_function(["titi", "toto"]	)    ,   choices=["titi", "toto"]    ,   required=UpperCAmelCase__    ,   )
										expected.add_argument("--opt"    ,   type=UpperCAmelCase__    ,   default=UpperCAmelCase__	)
										expected.add_argument("--baz"    ,   default="toto"    ,   type=UpperCAmelCase__    ,   help="help message"	)
										expected.add_argument("--foo_str"    ,   nargs="+"    ,   default=["Hallo", "Bonjour", "Hello"]    ,   type=UpperCAmelCase__	)
										self.argparsersEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			{
										    "foo": 12,
										    "bar": 3.1_4,
										    "baz": "42",
										    "flag": True,
										}

										__lowerCAmelCase				    =			parser.parse_dict(UpperCAmelCase__	)[0]
										__lowerCAmelCase				    =			BasicExample(**UpperCAmelCase__	)
										self.assertEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			{
										    "foo": 12,
										    "bar": 3.1_4,
										    "baz": "42",
										    "flag": True,
										    "extra": 42,
										}

										self.assertRaises(UpperCAmelCase__    ,   parser.parse_dict    ,   UpperCAmelCase__    ,   allow_extra_keys=UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			{
										    "foo": 12,
										    "bar": 3.1_4,
										    "baz": "42",
										    "flag": True,
										}
										with tempfile.TemporaryDirectory() as tmp_dir:
													__lowerCAmelCase				    =			os.path.join(UpperCAmelCase__    ,   "temp_json"	)
													os.mkdir(UpperCAmelCase__	)
													with open(temp_local_path + ".json"    ,   "w+"	) as f:
																json.dump(UpperCAmelCase__    ,   UpperCAmelCase__	)
													__lowerCAmelCase				    =			parser.parse_yaml_file(Path(temp_local_path + ".json"	)	)[0]

										__lowerCAmelCase				    =			BasicExample(**UpperCAmelCase__	)
										self.assertEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)

							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)

										__lowerCAmelCase				    =			{
										    "foo": 12,
										    "bar": 3.1_4,
										    "baz": "42",
										    "flag": True,
										}
										with tempfile.TemporaryDirectory() as tmp_dir:
													__lowerCAmelCase				    =			os.path.join(UpperCAmelCase__    ,   "temp_yaml"	)
													os.mkdir(UpperCAmelCase__	)
													with open(temp_local_path + ".yaml"    ,   "w+"	) as f:
																yaml.dump(UpperCAmelCase__    ,   UpperCAmelCase__	)
													__lowerCAmelCase				    =			parser.parse_yaml_file(Path(temp_local_path + ".yaml"	)	)[0]
										__lowerCAmelCase				    =			BasicExample(**UpperCAmelCase__	)
										self.assertEqual(UpperCAmelCase__    ,   UpperCAmelCase__	)



							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			HfArgumentParser(UpperCAmelCase__	)
										self.assertIsNotNone(UpperCAmelCase__	)








'''simple docstring'''




import gc
import unittest

import numpy as np
import torch

from diffusers import StableDiffusionKDiffusionPipeline
from diffusers.utils import slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu


enable_full_determinism()

@slow
@require_torch_gpu
class 		UpperCAmelCase_      (  unittest.TestCase		):





     def 							__UpperCAmelCase      ( self       :      Optional[int]    )				->  int:
        # clean up the VRAM after each test
        super().tearDown()
        gc.collect()
        torch.cuda.empty_cache()





     def 							__UpperCAmelCase      ( self       :      Tuple    )				->  Any:
        lowerCAmelCase     =			StableDiffusionKDiffusionPipeline.from_pretrained('CompVis/stable-diffusion-v1-4'    )
        lowerCAmelCase     =			sd_pipe.to(UpperCAmelCase__    )
        sd_pipe.set_progress_bar_config(disable=UpperCAmelCase__    )

        sd_pipe.set_scheduler('sample_euler'    )

        lowerCAmelCase     =			'A painting of a squirrel eating a burger'
        lowerCAmelCase     =			torch.manual_seed(0    )
        lowerCAmelCase     =			sd_pipe([prompt]    ,      generator=UpperCAmelCase__    ,      guidance_scale=9.0    ,      num_inference_steps=2_0    ,      output_type='np'    )

        lowerCAmelCase     =			output.images

        lowerCAmelCase     =			image[0, -3:, -3:, -1]

        assert image.shape == (1, 5_1_2, 5_1_2, 3)
        lowerCAmelCase     =			np.array([0.0_447, 0.0_492, 0.0_468, 0.0_408, 0.0_383, 0.0_408, 0.0_354, 0.0_380, 0.0_339]    )

        assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2





     def 							__UpperCAmelCase      ( self       :      List[str]    )				->  Dict:
        lowerCAmelCase     =			StableDiffusionKDiffusionPipeline.from_pretrained('stabilityai/stable-diffusion-2-1-base'    )
        lowerCAmelCase     =			sd_pipe.to(UpperCAmelCase__    )
        sd_pipe.set_progress_bar_config(disable=UpperCAmelCase__    )

        sd_pipe.set_scheduler('sample_euler'    )

        lowerCAmelCase     =			'A painting of a squirrel eating a burger'
        lowerCAmelCase     =			torch.manual_seed(0    )
        lowerCAmelCase     =			sd_pipe([prompt]    ,      generator=UpperCAmelCase__    ,      guidance_scale=9.0    ,      num_inference_steps=2_0    ,      output_type='np'    )

        lowerCAmelCase     =			output.images

        lowerCAmelCase     =			image[0, -3:, -3:, -1]

        assert image.shape == (1, 5_1_2, 5_1_2, 3)
        lowerCAmelCase     =			np.array([0.1_237, 0.1_320, 0.1_438, 0.1_359, 0.1_390, 0.1_132, 0.1_277, 0.1_175, 0.1_112]    )

        assert np.abs(image_slice.flatten() - expected_slice    ).max() < 5E-1





     def 							__UpperCAmelCase      ( self       :      Optional[Any]    )				->  List[str]:
        lowerCAmelCase     =			StableDiffusionKDiffusionPipeline.from_pretrained('stabilityai/stable-diffusion-2-1-base'    )
        lowerCAmelCase     =			sd_pipe.to(UpperCAmelCase__    )
        sd_pipe.set_progress_bar_config(disable=UpperCAmelCase__    )

        sd_pipe.set_scheduler('sample_dpmpp_2m'    )

        lowerCAmelCase     =			'A painting of a squirrel eating a burger'
        lowerCAmelCase     =			torch.manual_seed(0    )
        lowerCAmelCase     =			sd_pipe(
            [prompt]    ,      generator=UpperCAmelCase__    ,      guidance_scale=7.5    ,      num_inference_steps=1_5    ,      output_type='np'    ,      use_karras_sigmas=UpperCAmelCase__    ,      )

        lowerCAmelCase     =			output.images

        lowerCAmelCase     =			image[0, -3:, -3:, -1]

        assert image.shape == (1, 5_1_2, 5_1_2, 3)
        lowerCAmelCase     =			np.array(
            [0.11_381_689, 0.12_112_921, 0.1_389_457, 0.12_549_606, 0.1_244_964, 0.10_831_517, 0.11_562_866, 0.10_867_816, 0.10_499_048]    )

        assert np.abs(image_slice.flatten() - expected_slice    ).max() < 1E-2





