


'''simple docstring'''



import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference



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


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						List[Any]     )		->				Dict:
          __UpperCAmelCase      :					Any    				=     '''runwayml/stable-diffusion-v1-5'''
          __UpperCAmelCase      :					List[Any]    				=     TextToVideoZeroPipeline.from_pretrained(snake_case				,					torch_dtype=torch.floataa     ).to('''cuda'''     )
          __UpperCAmelCase      :					List[str]    				=     DDIMScheduler.from_config(pipe.scheduler.config     )
          __UpperCAmelCase      :					Optional[Any]    				=     torch.Generator(device='''cuda'''     ).manual_seed(0     )

          __UpperCAmelCase      :					Any    				=     '''A bear is playing a guitar on Times Square'''
          __UpperCAmelCase      :					Union[str, Any]    				=     pipe(prompt=snake_case				,					generator=snake_case     ).images

          __UpperCAmelCase      :					int    				=     load_pt(
              '''https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt'''     )

          assert_mean_pixel_difference(snake_case				,					snake_case     )



'''simple docstring'''



import unittest
import warnings
from dataclasses import dataclass

from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir



@dataclass
class       a							:


     """simple docstring"""






     SCREAMING_SNAKE_CASE			:					str



class       a							(						unittest.TestCase			):


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						str     )		->				Dict:
          __UpperCAmelCase      :					str    				=     get_tests_dir('''fixtures/test_sentencepiece.model'''     )
          __UpperCAmelCase      :					List[Any]    				=     get_tests_dir('''fixtures/test_sentencepiece_with_bytefallback.model'''     )

          __UpperCAmelCase      :					Tuple    				=     FakeOriginalTokenizer(vocab_file=snake_case     )

          with warnings.catch_warnings(record=snake_case     ) as w:
               __UpperCAmelCase      :					Optional[int]    				=     SpmConverter(snake_case     )
          self.assertEqual(len(snake_case     )				,					0     )

          __UpperCAmelCase      :					str    				=     FakeOriginalTokenizer(vocab_file=snake_case     )

          with warnings.catch_warnings(record=snake_case     ) as w:
               __UpperCAmelCase      :					Optional[int]    				=     SpmConverter(snake_case     )
          self.assertEqual(len(snake_case     )				,					1     )

          self.assertIn(
              '''The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option'''
              ''' which is not implemented in the fast tokenizers.'''				,					str(w[0].message     )				,					)