


import os
import pickle
import tempfile
import unittest
from typing import Callable, Optional

import numpy as np

from transformers import (
    BatchEncoding,
    BertTokenizer,
    BertTokenizerFast,
    PreTrainedTokenizer,
    PreTrainedTokenizerFast,
    TensorType,
    TokenSpan,
    is_tokenizers_available,
)
from transformers.models.gpta.tokenization_gpta import GPTaTokenizer
from transformers.testing_utils import CaptureStderr, require_flax, require_tf, require_tokenizers, require_torch, slow


if is_tokenizers_available():
     from tokenizers import Tokenizer
     from tokenizers.models import WordPiece







class 	_snake_case						(   unittest.TestCase							):




 def  SCREAMING_SNAKE_CASE__       (	self      ,						_lowerCamelCase					):
       a		:Any											= list(tokenizer_class.max_model_input_sizes.keys()					)
       for model_name in sa_models[:1]:
             a		:Dict											= tokenizer_class.from_pretrained(_lowerCamelCase					)
             self.assertIsNotNone(_lowerCamelCase					)
             self.assertIsInstance(_lowerCamelCase      ,						_lowerCamelCase					)
             self.assertIsInstance(_lowerCamelCase      ,						_lowerCamelCase					)

             for special_tok in tokenizer.all_special_tokens:
                   self.assertIsInstance(_lowerCamelCase      ,						_lowerCamelCase					)
                   a		:Any											= tokenizer.convert_tokens_to_ids(_lowerCamelCase					)
                   self.assertIsInstance(_lowerCamelCase      ,						_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self      ,						_lowerCamelCase      ,						_lowerCamelCase = None					):
       a		:Optional[int]											= pickle.dumps(_lowerCamelCase					)
       self.assertIsNotNone(_lowerCamelCase					)

       a		:List[Any]											= pickle.loads(_lowerCamelCase					)

       # Ensure is_fast is correctly restored
       self.assertEqual(be_restored.is_fast      ,						be_original.is_fast					)

       # Ensure encodings are potentially correctly restored
       if be_original.is_fast:
             self.assertIsNotNone(be_restored.encodings					)
       else:
             self.assertIsNone(be_restored.encodings					)

       # Ensure the keys are the same
       for original_v, restored_v in zip(be_original.values()      ,						be_restored.values()					):
             if equal_op:
                   self.assertTrue(equal_op(_lowerCamelCase      ,						_lowerCamelCase					)					)
             else:
                   self.assertEqual(_lowerCamelCase      ,						_lowerCamelCase					)




 @slow
 def  SCREAMING_SNAKE_CASE__       (	self					):
       self.check_tokenizer_from_pretrained(_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       self.assertEqual(TensorType('''tf'''					)      ,						TensorType.TENSORFLOW					)
       self.assertEqual(TensorType('''pt'''					)      ,						TensorType.PYTORCH					)
       self.assertEqual(TensorType('''np'''					)      ,						TensorType.NUMPY					)




 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       import numpy as np

       a		:List[Any]											= BertTokenizer.from_pretrained('''bert-base-cased'''					)
       a		:List[Any]											= BertTokenizerFast.from_pretrained('''bert-base-cased'''					)

       # Python no tensor
       with self.subTest('''BatchEncoding (Python, return_tensors=None)'''					):
             self.assert_dump_and_restore(tokenizer_p('''Small example to encode'''					)					)

       with self.subTest('''BatchEncoding (Python, return_tensors=NUMPY)'''					):
             self.assert_dump_and_restore(
                 tokenizer_p('''Small example to encode'''      ,						return_tensors=TensorType.NUMPY					)      ,						np.array_equal					)

       with self.subTest('''BatchEncoding (Rust, return_tensors=None)'''					):
             self.assert_dump_and_restore(tokenizer_r('''Small example to encode'''					)					)

       with self.subTest('''BatchEncoding (Rust, return_tensors=NUMPY)'''					):
             self.assert_dump_and_restore(
                 tokenizer_r('''Small example to encode'''      ,						return_tensors=TensorType.NUMPY					)      ,						np.array_equal					)




 @require_tf
 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       import tensorflow as tf

       def tf_array_equals(_lowerCamelCase      ,						_lowerCamelCase					):
             return tf.reduce_all(tf.equal(_lowerCamelCase      ,						_lowerCamelCase					)					)

       a		:Union[str, Any]											= BertTokenizer.from_pretrained('''bert-base-cased'''					)
       a		:str											= BertTokenizerFast.from_pretrained('''bert-base-cased'''					)

       with self.subTest('''BatchEncoding (Python, return_tensors=TENSORFLOW)'''					):
             self.assert_dump_and_restore(
                 tokenizer_p('''Small example to encode'''      ,						return_tensors=TensorType.TENSORFLOW					)      ,						_lowerCamelCase					)

       with self.subTest('''BatchEncoding (Rust, return_tensors=TENSORFLOW)'''					):
             self.assert_dump_and_restore(
                 tokenizer_r('''Small example to encode'''      ,						return_tensors=TensorType.TENSORFLOW					)      ,						_lowerCamelCase					)




 @require_torch
 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       import torch

       a		:int											= BertTokenizer.from_pretrained('''bert-base-cased'''					)
       a		:List[Any]											= BertTokenizerFast.from_pretrained('''bert-base-cased'''					)

       with self.subTest('''BatchEncoding (Python, return_tensors=PYTORCH)'''					):
             self.assert_dump_and_restore(
                 tokenizer_p('''Small example to encode'''      ,						return_tensors=TensorType.PYTORCH					)      ,						torch.equal					)

       with self.subTest('''BatchEncoding (Rust, return_tensors=PYTORCH)'''					):
             self.assert_dump_and_restore(
                 tokenizer_r('''Small example to encode'''      ,						return_tensors=TensorType.PYTORCH					)      ,						torch.equal					)




 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Optional[Any]											= BertTokenizer.from_pretrained('''bert-base-cased'''					)
       a		:str											= BertTokenizerFast.from_pretrained('''bert-base-cased'''					)

       with self.subTest('''Python Tokenizer'''					):
             self.assertFalse(tokenizer_p('''Small example to_encode'''					).is_fast					)

       with self.subTest('''Rust Tokenizer'''					):
             self.assertTrue(tokenizer_r('''Small example to_encode'''					).is_fast					)




 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:List[Any]											= BertTokenizerFast.from_pretrained('''bert-base-cased'''					)
       a		:List[str]											= tokenizer_r(['''Test''', '''\xad''', '''test''']      ,						is_split_into_words=_lowerCamelCase					)

       self.assertEqual(encoded.word_to_tokens(0					)      ,						TokenSpan(start=1      ,						end=2					)					)
       self.assertEqual(encoded.word_to_tokens(1					)      ,						_lowerCamelCase					)
       self.assertEqual(encoded.word_to_tokens(2					)      ,						TokenSpan(start=2      ,						end=3					)					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:List[str]											= BatchEncoding({'''inputs''': [[1, 2, 3], [4, 5, 6]], '''labels''': [0, 1]}					)
       a		:Union[str, Any]											= batch.convert_to_tensors(tensor_type='''np'''					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(2, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(2,)					)
       # test converting the converted
       with CaptureStderr() as cs:
             a		:Tuple											= batch.convert_to_tensors(tensor_type='''np'''					)
       self.assertFalse(len(cs.err					)      ,						msg=F'''should have no warning, but got {cs.err}'''					)

       a		:List[Any]											= BatchEncoding({'''inputs''': [1, 2, 3], '''labels''': 0}					)
       a		:int											= batch.convert_to_tensors(tensor_type='''np'''      ,						prepend_batch_axis=_lowerCamelCase					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(1, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(1,)					)




 @require_torch
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Optional[int]											= BatchEncoding({'''inputs''': [[1, 2, 3], [4, 5, 6]], '''labels''': [0, 1]}					)
       a		:Tuple											= batch.convert_to_tensors(tensor_type='''pt'''					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(2, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(2,)					)
       # test converting the converted
       with CaptureStderr() as cs:
             a		:Dict											= batch.convert_to_tensors(tensor_type='''pt'''					)
       self.assertFalse(len(cs.err					)      ,						msg=F'''should have no warning, but got {cs.err}'''					)

       a		:Tuple											= BatchEncoding({'''inputs''': [1, 2, 3], '''labels''': 0}					)
       a		:List[Any]											= batch.convert_to_tensors(tensor_type='''pt'''      ,						prepend_batch_axis=_lowerCamelCase					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(1, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(1,)					)




 @require_tf
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Dict											= BatchEncoding({'''inputs''': [[1, 2, 3], [4, 5, 6]], '''labels''': [0, 1]}					)
       a		:Dict											= batch.convert_to_tensors(tensor_type='''tf'''					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(2, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(2,)					)
       # test converting the converted
       with CaptureStderr() as cs:
             a		:Any											= batch.convert_to_tensors(tensor_type='''tf'''					)
       self.assertFalse(len(cs.err					)      ,						msg=F'''should have no warning, but got {cs.err}'''					)

       a		:Tuple											= BatchEncoding({'''inputs''': [1, 2, 3], '''labels''': 0}					)
       a		:Union[str, Any]											= batch.convert_to_tensors(tensor_type='''tf'''      ,						prepend_batch_axis=_lowerCamelCase					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(1, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(1,)					)




 @require_flax
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Dict											= BatchEncoding({'''inputs''': [[1, 2, 3], [4, 5, 6]], '''labels''': [0, 1]}					)
       a		:Tuple											= batch.convert_to_tensors(tensor_type='''jax'''					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(2, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(2,)					)
       # test converting the converted
       with CaptureStderr() as cs:
             a		:str											= batch.convert_to_tensors(tensor_type='''jax'''					)
       self.assertFalse(len(cs.err					)      ,						msg=F'''should have no warning, but got {cs.err}'''					)

       a		:Union[str, Any]											= BatchEncoding({'''inputs''': [1, 2, 3], '''labels''': 0}					)
       a		:Optional[Any]											= batch.convert_to_tensors(tensor_type='''jax'''      ,						prepend_batch_axis=_lowerCamelCase					)
       self.assertEqual(tensor_batch['''inputs'''].shape      ,						(1, 3)					)
       self.assertEqual(tensor_batch['''labels'''].shape      ,						(1,)					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Optional[int]											= [{'''input_ids''': np.array([0, 1, 2]					)}, {'''input_ids''': np.array([0, 1, 2, 3]					)}]
       a		:Dict											= BertTokenizer.from_pretrained('''bert-base-cased'''					)

       a		:List[Any]											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						np.ndarray					)					)
       self.assertEqual(batch['''input_ids'''].tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)
       a		:Optional[Any]											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase      ,						return_tensors='''np'''					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						np.ndarray					)					)
       self.assertEqual(batch['''input_ids'''].tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)




 @require_torch
 def  SCREAMING_SNAKE_CASE__       (	self					):
       import torch

       a		:Any											= [{'''input_ids''': torch.tensor([0, 1, 2]					)}, {'''input_ids''': torch.tensor([0, 1, 2, 3]					)}]
       a		:List[Any]											= BertTokenizer.from_pretrained('''bert-base-cased'''					)

       a		:Dict											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						torch.Tensor					)					)
       self.assertEqual(batch['''input_ids'''].tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)
       a		:List[str]											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase      ,						return_tensors='''pt'''					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						torch.Tensor					)					)
       self.assertEqual(batch['''input_ids'''].tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)




 @require_tf
 def  SCREAMING_SNAKE_CASE__       (	self					):
       import tensorflow as tf

       a		:Any											= [{'''input_ids''': tf.constant([0, 1, 2]					)}, {'''input_ids''': tf.constant([0, 1, 2, 3]					)}]
       a		:Union[str, Any]											= BertTokenizer.from_pretrained('''bert-base-cased'''					)

       a		:Dict											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						tf.Tensor					)					)
       self.assertEqual(batch['''input_ids'''].numpy().tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)
       a		:List[Any]											= tokenizer.pad(_lowerCamelCase      ,						padding=_lowerCamelCase      ,						return_tensors='''tf'''					)
       self.assertTrue(isinstance(batch['''input_ids''']      ,						tf.Tensor					)					)
       self.assertEqual(batch['''input_ids'''].numpy().tolist()      ,						[[0, 1, 2, tokenizer.pad_token_id], [0, 1, 2, 3]]					)




 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Optional[Any]											= Tokenizer(WordPiece(unk_token='''[UNK]'''					)					)
       PreTrainedTokenizerFast(tokenizer_object=_lowerCamelCase					)




 @require_tokenizers
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Tuple											= Tokenizer(WordPiece(unk_token='''[UNK]'''					)					)
       with tempfile.TemporaryDirectory() as tmpdirname:
             bert_tokenizer.save(os.path.join(_lowerCamelCase      ,						'''tokenizer.json'''					)					)
             PreTrainedTokenizerFast(tokenizer_file=os.path.join(_lowerCamelCase      ,						'''tokenizer.json'''					)					)









import tempfile
import unittest

import numpy as np
import torch

from diffusers import ScoreSdeVeScheduler







class 	_snake_case						(   unittest.TestCase							):
 # TODO adapt with class SchedulerCommonTest (scheduler needs Numpy Integration)
 SCREAMING_SNAKE_CASE__   = (ScoreSdeVeScheduler,)
 SCREAMING_SNAKE_CASE__   = ()




 @property
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Tuple											= 4
       a		:List[str]											= 3
       a		:Any											= 8
       a		:Any											= 8

       a		:List[str]											= torch.rand((batch_size, num_channels, height, width)					)

       return sample




 @property
 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:int											= 4
       a		:Union[str, Any]											= 3
       a		:Optional[Any]											= 8
       a		:Tuple											= 8

       a		:Dict											= batch_size * num_channels * height * width
       a		:Optional[int]											= torch.arange(_lowerCamelCase					)
       a		:List[Any]											= sample.reshape(_lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase					)
       a		:Union[str, Any]											= sample / num_elems
       a		:Dict											= sample.permute(3      ,						0      ,						1      ,						2					)

       return sample




 def  SCREAMING_SNAKE_CASE__       (	self					):
       def model(_lowerCamelCase      ,						_lowerCamelCase      ,						*_lowerCamelCase					):
             return sample * t / (t + 1)

       return model




 def  SCREAMING_SNAKE_CASE__       (	self      ,						**_lowerCamelCase					):
       a		:str											= {
           '''num_train_timesteps''': 2000,
           '''snr''': 0.15,
           '''sigma_min''': 0.01,
           '''sigma_max''': 1348,
           '''sampling_eps''': 1e-5,
       }

       config.update(**_lowerCamelCase					)
       return config




 def  SCREAMING_SNAKE_CASE__       (	self      ,						_lowerCamelCase=0      ,						**_lowerCamelCase					):
       a		:Optional[int]											= dict(self.forward_default_kwargs					)

       for scheduler_class in self.scheduler_classes:
             a		:Union[str, Any]											= self.dummy_sample
             a		:Tuple											= 0.1 * sample

             a		:Union[str, Any]											= self.get_scheduler_config(**_lowerCamelCase					)
             a		:Union[str, Any]											= scheduler_class(**_lowerCamelCase					)

             with tempfile.TemporaryDirectory() as tmpdirname:
                   scheduler.save_config(_lowerCamelCase					)
                   a		:Optional[int]											= scheduler_class.from_pretrained(_lowerCamelCase					)

             a		:List[str]											= scheduler.step_pred(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample
             a		:Dict											= new_scheduler.step_pred(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample

             assert torch.sum(torch.abs(output - new_output					)					) < 1e-5, "Scheduler outputs are not identical"

             a		:int											= scheduler.step_correct(_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample
             a		:Optional[Any]											= new_scheduler.step_correct(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample

             assert torch.sum(torch.abs(output - new_output					)					) < 1e-5, "Scheduler correction are not identical"




 def  SCREAMING_SNAKE_CASE__       (	self      ,						_lowerCamelCase=0      ,						**_lowerCamelCase					):
       a		:Dict											= dict(self.forward_default_kwargs					)
       kwargs.update(_lowerCamelCase					)

       for scheduler_class in self.scheduler_classes:
             a		:int											= self.dummy_sample
             a		:str											= 0.1 * sample

             a		:Optional[Any]											= self.get_scheduler_config()
             a		:Union[str, Any]											= scheduler_class(**_lowerCamelCase					)

             with tempfile.TemporaryDirectory() as tmpdirname:
                   scheduler.save_config(_lowerCamelCase					)
                   a		:Union[str, Any]											= scheduler_class.from_pretrained(_lowerCamelCase					)

             a		:Union[str, Any]											= scheduler.step_pred(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample
             a		:Optional[int]											= new_scheduler.step_pred(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample

             assert torch.sum(torch.abs(output - new_output					)					) < 1e-5, "Scheduler outputs are not identical"

             a		:List[str]											= scheduler.step_correct(_lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample
             a		:Tuple											= new_scheduler.step_correct(
                 _lowerCamelCase      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample

             assert torch.sum(torch.abs(output - new_output					)					) < 1e-5, "Scheduler correction are not identical"




 def  SCREAMING_SNAKE_CASE__       (	self					):
       for timesteps in [10, 100, 1000]:
             self.check_over_configs(num_train_timesteps=_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       for sigma_min, sigma_max in zip([0.0001, 0.001, 0.01]      ,						[1, 100, 1000]					):
             self.check_over_configs(sigma_min=_lowerCamelCase      ,						sigma_max=_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       for t in [0.1, 0.5, 0.75]:
             self.check_over_forward(time_step=_lowerCamelCase					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:Dict											= dict(self.forward_default_kwargs					)

       a		:Optional[Any]											= self.scheduler_classes[0]
       a		:Union[str, Any]											= self.get_scheduler_config()
       a		:List[Any]											= scheduler_class(**_lowerCamelCase					)

       a		:Union[str, Any]											= 3

       a		:List[Any]											= self.dummy_model()
       a		:Dict											= self.dummy_sample_deter

       scheduler.set_sigmas(_lowerCamelCase					)
       scheduler.set_timesteps(_lowerCamelCase					)
       a		:str											= torch.manual_seed(0					)

       for i, t in enumerate(scheduler.timesteps					):
             a		:Optional[int]											= scheduler.sigmas[i]

             for _ in range(scheduler.config.correct_steps					):
                   with torch.no_grad():
                         a		:Dict											= model(_lowerCamelCase      ,						_lowerCamelCase					)
                   a		:int											= scheduler.step_correct(_lowerCamelCase      ,						_lowerCamelCase      ,						generator=_lowerCamelCase      ,						**_lowerCamelCase					).prev_sample

             with torch.no_grad():
                   a		:Any											= model(_lowerCamelCase      ,						_lowerCamelCase					)

             a		:Optional[Any]											= scheduler.step_pred(_lowerCamelCase      ,						_lowerCamelCase      ,						_lowerCamelCase      ,						generator=_lowerCamelCase      ,						**_lowerCamelCase					)
             a							,       a		:Any											= output.prev_sample, output.prev_sample_mean

       a		:Dict											= torch.sum(torch.abs(_lowerCamelCase					)					)
       a		:int											= torch.mean(torch.abs(_lowerCamelCase					)					)

       assert np.isclose(result_sum.item()      ,						143_7275_8528.0					)
       assert np.isclose(result_mean.item()      ,						1871_4530.0					)




 def  SCREAMING_SNAKE_CASE__       (	self					):
       a		:str											= dict(self.forward_default_kwargs					)

       a		:Union[str, Any]											= kwargs.pop('''num_inference_steps'''      ,						_lowerCamelCase					)

       for scheduler_class in self.scheduler_classes:
             a		:Optional[int]											= self.get_scheduler_config()
             a		:str											= scheduler_class(**_lowerCamelCase					)

             a		:List[str]											= self.dummy_sample
             a		:List[Any]											= 0.1 * sample

             if num_inference_steps is not None and hasattr(_lowerCamelCase      ,						'''set_timesteps'''					):
                   scheduler.set_timesteps(_lowerCamelCase					)
             elif num_inference_steps is not None and not hasattr(_lowerCamelCase      ,						'''set_timesteps'''					):
                   a		:Dict											= num_inference_steps

             a		:Tuple											= scheduler.step_pred(_lowerCamelCase      ,						0      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample
             a		:Tuple											= scheduler.step_pred(_lowerCamelCase      ,						1      ,						_lowerCamelCase      ,						generator=torch.manual_seed(0					)      ,						**_lowerCamelCase					).prev_sample

             self.assertEqual(output_a.shape      ,						sample.shape					)
             self.assertEqual(output_a.shape      ,						output_a.shape					)





