



import math
import os
import unittest

from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
				import torch

				from transformers import (
				    MODEL_FOR_PRETRAINING_MAPPING,
				    MegatronBertForCausalLM,
				    MegatronBertForMaskedLM,
				    MegatronBertForMultipleChoice,
				    MegatronBertForNextSentencePrediction,
				    MegatronBertForPreTraining,
				    MegatronBertForQuestionAnswering,
				    MegatronBertForSequenceClassification,
				    MegatronBertForTokenClassification,
				    MegatronBertModel,
				)



class 	_lowercase							:





	"""simple docstring"""




	def __init__(self		,       lowerCamelCase_		,       lowerCamelCase_=13		,       lowerCamelCase_=7		,       lowerCamelCase_=True		,       lowerCamelCase_=True		,       lowerCamelCase_=True		,       lowerCamelCase_=True		,       lowerCamelCase_=99		,       lowerCamelCase_=64		,       lowerCamelCase_=32		,       lowerCamelCase_=5		,       lowerCamelCase_=4		,       lowerCamelCase_=37		,       lowerCamelCase_="gelu"		,       lowerCamelCase_=0.1		,       lowerCamelCase_=0.1		,       lowerCamelCase_=512		,       lowerCamelCase_=16		,       lowerCamelCase_=2		,       lowerCamelCase_=0.02		,       lowerCamelCase_=3		,       lowerCamelCase_=4		,       lowerCamelCase_=None		,       ):
						"""simple docstring"""

						a					     =   parent
						a					     =   batch_size
						a					     =   seq_length
						a					     =   is_training
						a					     =   use_input_mask
						a					     =   use_token_type_ids
						a					     =   use_labels
						a					     =   vocab_size
						a					     =   hidden_size
						a					     =   embedding_size
						a					     =   num_hidden_layers
						a					     =   num_attention_heads
						a					     =   intermediate_size
						a					     =   hidden_act
						a					     =   hidden_dropout_prob
						a					     =   attention_probs_dropout_prob
						a					     =   max_position_embeddings
						a					     =   type_vocab_size
						a					     =   type_sequence_label_size
						a					     =   initializer_range
						a					     =   num_labels
						a					     =   num_choices
						a					     =   scope




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   ids_tensor([self.batch_size, self.seq_length]		,       self.vocab_size		)

						a					     =   None
						if self.use_input_mask:
											a					     =   random_attention_mask([self.batch_size, self.seq_length]		)

						a					     =   None
						if self.use_token_type_ids:
											a					     =   ids_tensor([self.batch_size, self.seq_length]		,       self.type_vocab_size		)

						a					     =   None
						a					     =   None
						a					     =   None
						if self.use_labels:
											a					     =   ids_tensor([self.batch_size]		,       self.type_sequence_label_size		)
											a					     =   ids_tensor([self.batch_size, self.seq_length]		,       self.num_labels		)
											a					     =   ids_tensor([self.batch_size]		,       self.num_choices		)

						a					     =   self.get_config()

						return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						return MegatronBertConfig(
						    vocab_size=self.vocab_size		,       hidden_size=self.hidden_size		,       num_hidden_layers=self.num_hidden_layers		,       num_attention_heads=self.num_attention_heads		,       intermediate_size=self.intermediate_size		,       embedding_size=self.embedding_size		,       hidden_act=self.hidden_act		,       hidden_dropout_prob=self.hidden_dropout_prob		,       attention_probs_dropout_prob=self.attention_probs_dropout_prob		,       max_position_embeddings=self.max_position_embeddings		,       type_vocab_size=self.type_vocab_size		,       is_decoder=lowerCamelCase_		,       initializer_range=self.initializer_range		,       )




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertModel(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		)
						a					     =   model(lowerCamelCase_		,       token_type_ids=lowerCamelCase_		)
						a					     =   model(lowerCamelCase_		)

						self.parent.assertEqual(result.last_hidden_state.shape		,       (self.batch_size, self.seq_length, self.hidden_size)		)
						self.parent.assertEqual(result.pooler_output.shape		,       (self.batch_size, self.hidden_size)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertForMaskedLM(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		)
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.seq_length, self.vocab_size)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertForCausalLM(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		)
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.seq_length, self.vocab_size)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertForNextSentencePrediction(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(
						    lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		,       )
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, 2)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertForPreTraining(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(
						    lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		,       next_sentence_label=lowerCamelCase_		,       )
						self.parent.assertEqual(result.prediction_logits.shape		,       (self.batch_size, self.seq_length, self.vocab_size)		)
						self.parent.assertEqual(result.seq_relationship_logits.shape		,       (self.batch_size, 2)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   MegatronBertForQuestionAnswering(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(
						    lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       start_positions=lowerCamelCase_		,       end_positions=lowerCamelCase_		,       )
						self.parent.assertEqual(result.start_logits.shape		,       (self.batch_size, self.seq_length)		)
						self.parent.assertEqual(result.end_logits.shape		,       (self.batch_size, self.seq_length)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   self.num_labels
						a					     =   MegatronBertForSequenceClassification(lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		)
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.num_labels)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   self.num_labels
						a					     =   MegatronBertForTokenClassification(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   model(lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		)
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.seq_length, self.num_labels)		)




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		):
						"""simple docstring"""

						a					     =   self.num_choices
						a					     =   MegatronBertForMultipleChoice(config=lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.eval()
						a					     =   input_ids.unsqueeze(1		).expand(-1		,       self.num_choices		,       -1		).contiguous()
						a					     =   token_type_ids.unsqueeze(1		).expand(-1		,       self.num_choices		,       -1		).contiguous()
						a					     =   input_mask.unsqueeze(1		).expand(-1		,       self.num_choices		,       -1		).contiguous()
						a					     =   model(
						    lowerCamelCase_		,       attention_mask=lowerCamelCase_		,       token_type_ids=lowerCamelCase_		,       labels=lowerCamelCase_		,       )
						self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.num_choices)		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.prepare_config_and_inputs()
						(
						    (
						    a
						)     ,				(
						    a
						)     ,				(
						    a
						)     ,				(
						    a
						)     ,				(
						    a
						)     ,				(
						    a
						)     ,				(
						    a
						)     ,				
						)					     =   config_and_inputs
						a					     =   {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
						return config, inputs_dict




@require_torch
class 	_lowercase							(   lowerCAmelCase,      lowerCAmelCase,      unittest.TestCase	):





	"""simple docstring"""
	__A							=							(
	    (
	        MegatronBertModel,
	        MegatronBertForMaskedLM,
	        MegatronBertForCausalLM,
	        MegatronBertForMultipleChoice,
	        MegatronBertForNextSentencePrediction,
	        MegatronBertForPreTraining,
	        MegatronBertForQuestionAnswering,
	        MegatronBertForSequenceClassification,
	        MegatronBertForTokenClassification,
	    )
	    if is_torch_available()
	    else ()
	)
	__A							=							(
	    {
	        "feature-extraction": MegatronBertModel,
	        "fill-mask": MegatronBertForMaskedLM,
	        "question-answering": MegatronBertForQuestionAnswering,
	        "text-classification": MegatronBertForSequenceClassification,
	        "text-generation": MegatronBertForCausalLM,
	        "token-classification": MegatronBertForTokenClassification,
	        "zero-shot": MegatronBertForSequenceClassification,
	    }
	    if is_torch_available()
	    else {}
	)
	__A							=							True
	# test_resize_embeddings = False
	__A							=							False




	def      UpperCamelCase_       (self		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_=False		):
						"""simple docstring"""

						a					     =   super()._prepare_for_class(lowerCamelCase_		,       lowerCamelCase_		,       return_labels=lowerCamelCase_		)

						if return_labels:
											if model_class in get_values(lowerCamelCase_		):
																a					     =   torch.zeros(
																    (self.model_tester.batch_size, self.model_tester.seq_length)		,       dtype=torch.long		,       device=lowerCamelCase_		)
																a					     =   torch.zeros(
																    self.model_tester.batch_size		,       dtype=torch.long		,       device=lowerCamelCase_		)
						return inputs_dict




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   MegatronBertModelTester(self		)
						a					     =   ConfigTester(self		,       config_class=lowerCamelCase_		,       hidden_size=37		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						self.config_tester.run_common_tests()




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_model(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_masked_lm(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_pretraining(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_question_answering(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_megatron_bert_for_token_classification(*lowerCamelCase_		)






def     a(      A       :    List[str]       )		->       str:
					"""simple docstring"""





					return torch.tensor(
					    A ,     dtype=torch.long ,     device=A ,     )


_lowercase: Dict      			=		1E-4







@require_torch
@require_sentencepiece
@require_tokenizers
class 	_lowercase							(   unittest.TestCase	):





	"""simple docstring"""




	@slow
	@unittest.skip("Model is not available."		)
	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   "nvidia/megatron-bert-uncased-345m"
						if "MYDIR" in os.environ:
											a					     =   os.path.join(os.environ["MYDIR"]		,       lowerCamelCase_		)
						a					     =   MegatronBertModel.from_pretrained(lowerCamelCase_		)
						model.to(lowerCamelCase_		)
						model.half()
						a					     =   _long_tensor([[101, 7110, 1005, 1056, 2023, 11333, 17413, 1029, 102]]		)
						with torch.no_grad():
											a					     =   model(lowerCamelCase_		)[0]
						a					     =   torch.Size((1, 9, 1024)		)
						self.assertEqual(output.shape		,       lowerCamelCase_		)

						a					     =   [-0.6040, -0.2517, -0.1025, 0.3420, -0.6758, -0.0017, -0.1089, -0.1990, 0.5728]
						for ii in range(3		):
											for jj in range(3		):
																a					     =   output[0, ii, jj]
																a					     =   expected[3 * ii + jj]
																a					     =   "ii={} jj={} a={} b={}".format(lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		)
																self.assertTrue(math.isclose(lowerCamelCase_		,       lowerCamelCase_		,       rel_tol=lowerCamelCase_		,       abs_tol=lowerCamelCase_		)		,       msg=lowerCamelCase_		)





import torch

from diffusers import DDPMScheduler

from .test_schedulers import SchedulerCommonTest



class 	_lowercase							(   lowerCAmelCase	):





	"""simple docstring"""
	__A							=							(DDPMScheduler,)




	def      UpperCamelCase_       (self		,       **lowerCamelCase_		):
						"""simple docstring"""

						a					     =   {
						    "num_train_timesteps": 1000,
						    "beta_start": 0.0001,
						    "beta_end": 0.02,
						    "beta_schedule": "linear",
						    "variance_type": "fixed_small",
						    "clip_sample": True,
						}

						config.update(**lowerCamelCase_		)
						return config




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for timesteps in [1, 5, 100, 1000]:
											self.check_over_configs(num_train_timesteps=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for beta_start, beta_end in zip([0.0001, 0.001, 0.01, 0.1]		,       [0.002, 0.02, 0.2, 2]		):
											self.check_over_configs(beta_start=lowerCamelCase_		,       beta_end=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for schedule in ["linear", "squaredcos_cap_v2"]:
											self.check_over_configs(beta_schedule=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for variance in ["fixed_small", "fixed_large", "other"]:
											self.check_over_configs(variance_type=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for clip_sample in [True, False]:
											self.check_over_configs(clip_sample=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						self.check_over_configs(thresholding=lowerCamelCase_		)
						for threshold in [0.5, 1.0, 2.0]:
											for prediction_type in ["epsilon", "sample", "v_prediction"]:
																self.check_over_configs(
																    thresholding=lowerCamelCase_		,       prediction_type=lowerCamelCase_		,       sample_max_value=lowerCamelCase_		,       )




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for prediction_type in ["epsilon", "sample", "v_prediction"]:
											self.check_over_configs(prediction_type=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						for t in [0, 500, 999]:
											self.check_over_forward(time_step=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						assert torch.sum(torch.abs(scheduler._get_variance(0		) - 0.0		)		) < 1E-5
						assert torch.sum(torch.abs(scheduler._get_variance(487		) - 0.0_0979		)		) < 1E-5
						assert torch.sum(torch.abs(scheduler._get_variance(999		) - 0.02		)		) < 1E-5




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   len(lowerCamelCase_		)

						a					     =   self.dummy_model()
						a					     =   self.dummy_sample_deter
						a					     =   torch.manual_seed(0		)

						for t in reversed(range(lowerCamelCase_		)		):
											# 1. predict noise residual
											a					     =   model(lowerCamelCase_		,       lowerCamelCase_		)

											# 2. predict previous mean of sample x_t-1
											a					     =   scheduler.step(lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       generator=lowerCamelCase_		).prev_sample

											# if t > 0:
											#     noise = self.dummy_sample_deter
											#     variance = scheduler.get_variance(t) ** (0.5) * noise
											#
											# sample = pred_prev_sample + variance
											a					     =   pred_prev_sample

						a					     =   torch.sum(torch.abs(lowerCamelCase_		)		)
						a					     =   torch.mean(torch.abs(lowerCamelCase_		)		)

						assert abs(result_sum.item() - 258.9606		) < 1E-2
						assert abs(result_mean.item() - 0.3372		) < 1E-3




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config(prediction_type="v_prediction"		)
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   len(lowerCamelCase_		)

						a					     =   self.dummy_model()
						a					     =   self.dummy_sample_deter
						a					     =   torch.manual_seed(0		)

						for t in reversed(range(lowerCamelCase_		)		):
											# 1. predict noise residual
											a					     =   model(lowerCamelCase_		,       lowerCamelCase_		)

											# 2. predict previous mean of sample x_t-1
											a					     =   scheduler.step(lowerCamelCase_		,       lowerCamelCase_		,       lowerCamelCase_		,       generator=lowerCamelCase_		).prev_sample

											# if t > 0:
											#     noise = self.dummy_sample_deter
											#     variance = scheduler.get_variance(t) ** (0.5) * noise
											#
											# sample = pred_prev_sample + variance
											a					     =   pred_prev_sample

						a					     =   torch.sum(torch.abs(lowerCamelCase_		)		)
						a					     =   torch.mean(torch.abs(lowerCamelCase_		)		)

						assert abs(result_sum.item() - 202.0296		) < 1E-2
						assert abs(result_mean.item() - 0.2631		) < 1E-3




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   [100, 87, 50, 1, 0]

						scheduler.set_timesteps(timesteps=lowerCamelCase_		)

						a					     =   scheduler.timesteps

						for i, timestep in enumerate(lowerCamelCase_		):
											if i == len(lowerCamelCase_		) - 1:
																a					     =   -1
											else:
																a					     =   timesteps[i + 1]

											a					     =   scheduler.previous_timestep(lowerCamelCase_		)
											a					     =   prev_t.item()

											self.assertEqual(lowerCamelCase_		,       lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   [100, 87, 50, 51, 0]

						with self.assertRaises(lowerCamelCase_		,       msg="`custom_timesteps` must be in descending order."		):
											scheduler.set_timesteps(timesteps=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   [100, 87, 50, 1, 0]
						a					     =   len(lowerCamelCase_		)

						with self.assertRaises(lowerCamelCase_		,       msg="Can only pass one of `num_inference_steps` or `custom_timesteps`."		):
											scheduler.set_timesteps(num_inference_steps=lowerCamelCase_		,       timesteps=lowerCamelCase_		)




	def      UpperCamelCase_       (self		):
						"""simple docstring"""

						a					     =   self.scheduler_classes[0]
						a					     =   self.get_scheduler_config()
						a					     =   scheduler_class(**lowerCamelCase_		)

						a					     =   [scheduler.config.num_train_timesteps]

						with self.assertRaises(
						    lowerCamelCase_		,       msg="`timesteps` must start before `self.config.train_timesteps`: {scheduler.config.num_train_timesteps}}"		,       ):
											scheduler.set_timesteps(timesteps=lowerCamelCase_		)
