



"""simple docstring"""






import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_torch


if is_torch_available():
	import torch

	from transformers.generation import DisjunctiveConstraint



@require_torch
class 			A__   (  unittest.TestCase							):




	'''simple docstring'''





	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[int])				->       List[str]:

				"""simple docstring"""

				__lowerCAmelCase      :  Optional[Any]												=       [[1, 2, 4], [1, 2, 3, 4]]
				__lowerCAmelCase      :  Optional[Any]												=       DisjunctiveConstraint(_SCREAMING_SNAKE_CASE)
				self.assertTrue(isinstance(dc.token_ids       ,			_SCREAMING_SNAKE_CASE))

				with self.assertRaises(_SCREAMING_SNAKE_CASE):
							DisjunctiveConstraint(torch.LongTensor([[1, 2, 4], [1, 2, 3]]))

				with self.assertRaises(_SCREAMING_SNAKE_CASE):
							DisjunctiveConstraint([torch.LongTensor([1, 2, 4]), torch.LongTensor([1, 2, 3, 4, 5])])

	def 							_SCREAMING_SNAKE_CASE   (     self:		str)				->       str:

				"""simple docstring"""

				__lowerCAmelCase      :  int												=       [[1, 2], [1, 2, 3, 4]]

				with self.assertRaises(_SCREAMING_SNAKE_CASE):
							DisjunctiveConstraint(_SCREAMING_SNAKE_CASE)  # fails here

	def 							_SCREAMING_SNAKE_CASE   (     self:		List[Any])				->       Union[str, Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Any												=       [[1, 2, 3], [1, 2, 4]]

				__lowerCAmelCase      :  List[Any]												=       DisjunctiveConstraint(_SCREAMING_SNAKE_CASE)

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Union[str, Any]												=       dc.update(1)
				__lowerCAmelCase      :  Optional[int]												=       stepped is True and completed is False and reset is False
				self.assertTrue(_SCREAMING_SNAKE_CASE)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.current_seq == [1])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Optional[int]												=       dc.update(2)
				__lowerCAmelCase      :  List[Any]												=       stepped is True and completed is False and reset is False
				self.assertTrue(_SCREAMING_SNAKE_CASE)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.current_seq == [1, 2])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Any												=       dc.update(3)
				__lowerCAmelCase      :  List[str]												=       stepped is True and completed is True and reset is False
				self.assertTrue(_SCREAMING_SNAKE_CASE)
				self.assertTrue(dc.completed)  # Completed!
				self.assertTrue(dc.current_seq == [1, 2, 3])







	def 							_SCREAMING_SNAKE_CASE   (     self:		Any)				->       Union[str, Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Union[str, Any]												=       [[1, 2, 3], [1, 2, 4, 5], [1, 2, 5]]

				__lowerCAmelCase      :  Tuple												=       DisjunctiveConstraint(_SCREAMING_SNAKE_CASE)

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  int												=       dc.update(1)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.current_seq == [1])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Optional[int]												=       dc.update(2)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.current_seq == [1, 2])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Optional[Any]												=       dc.update(4)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.current_seq == [1, 2, 4])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Tuple												=       dc.update(5)
				self.assertTrue(dc.completed)  # Completed!
				self.assertTrue(dc.current_seq == [1, 2, 4, 5])

				dc.reset()

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Optional[Any]												=       dc.update(1)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.remaining() == 3)
				self.assertTrue(dc.current_seq == [1])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  int												=       dc.update(2)
				self.assertTrue(not dc.completed)
				self.assertTrue(dc.remaining() == 2)
				self.assertTrue(dc.current_seq == [1, 2])

				__lowerCAmelCase						,	__lowerCAmelCase						,	__lowerCAmelCase      :  Optional[int]												=       dc.update(5)
				self.assertTrue(dc.completed)  # Completed!
				self.assertTrue(dc.remaining() == 0)
				self.assertTrue(dc.current_seq == [1, 2, 5])




"""simple docstring"""






from ....configuration_utils import PretrainedConfig
from ....utils import logging


__snake_case							:   List[Any]      =    logging.get_logger(__name__)

__snake_case							:   Any      =    {
    'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json',
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}



class 			A__   (  __SCREAMING_SNAKE_CASE							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	'mctct'

	def __init__(     self:		Union[str, Any]       ,			_SCREAMING_SNAKE_CASE:		str=8065       ,			_SCREAMING_SNAKE_CASE:		str=1536       ,			_SCREAMING_SNAKE_CASE:		str=36       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=6144       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=4       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=384       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=920       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=1e-5       ,			_SCREAMING_SNAKE_CASE:		List[Any]=0.3       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]="relu"       ,			_SCREAMING_SNAKE_CASE:		Optional[int]=0.02       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=0.3       ,			_SCREAMING_SNAKE_CASE:		Dict=0.3       ,			_SCREAMING_SNAKE_CASE:		List[Any]=1       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=0       ,			_SCREAMING_SNAKE_CASE:		List[str]=2       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=1       ,			_SCREAMING_SNAKE_CASE:		Tuple=0.3       ,			_SCREAMING_SNAKE_CASE:		Dict=1       ,			_SCREAMING_SNAKE_CASE:		int=(7,)       ,			_SCREAMING_SNAKE_CASE:		str=(3,)       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=80       ,			_SCREAMING_SNAKE_CASE:		Tuple=1       ,			_SCREAMING_SNAKE_CASE:		Dict=None       ,			_SCREAMING_SNAKE_CASE:		Tuple="sum"       ,			_SCREAMING_SNAKE_CASE:		List[str]=False       ,			**_SCREAMING_SNAKE_CASE:		Tuple       ,			)				->       Tuple:

				"""simple docstring"""

				super().__init__(**_SCREAMING_SNAKE_CASE       ,			pad_token_id=_SCREAMING_SNAKE_CASE       ,			bos_token_id=_SCREAMING_SNAKE_CASE       ,			eos_token_id=_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  str												=       vocab_size
				__lowerCAmelCase      :  str												=       hidden_size
				__lowerCAmelCase      :  str												=       num_hidden_layers
				__lowerCAmelCase      :  str												=       intermediate_size
				__lowerCAmelCase      :  List[Any]												=       num_attention_heads
				__lowerCAmelCase      :  Dict												=       attention_head_dim
				__lowerCAmelCase      :  Optional[int]												=       max_position_embeddings
				__lowerCAmelCase      :  str												=       layer_norm_eps
				__lowerCAmelCase      :  Tuple												=       layerdrop
				__lowerCAmelCase      :  str												=       hidden_act
				__lowerCAmelCase      :  List[Any]												=       initializer_range
				__lowerCAmelCase      :  int												=       hidden_dropout_prob
				__lowerCAmelCase      :  Optional[Any]												=       attention_probs_dropout_prob
				__lowerCAmelCase      :  str												=       pad_token_id
				__lowerCAmelCase      :  Optional[int]												=       bos_token_id
				__lowerCAmelCase      :  Union[str, Any]												=       eos_token_id
				__lowerCAmelCase      :  Any												=       conv_glu_dim
				__lowerCAmelCase      :  Optional[int]												=       conv_dropout
				__lowerCAmelCase      :  Union[str, Any]												=       num_conv_layers
				__lowerCAmelCase      :  Optional[int]												=       input_feat_per_channel
				__lowerCAmelCase      :  Union[str, Any]												=       input_channels
				__lowerCAmelCase      :  Optional[Any]												=       conv_channels
				__lowerCAmelCase      :  Dict												=       ctc_loss_reduction
				__lowerCAmelCase      :  int												=       ctc_zero_infinity

				# prevents config testing fail with exporting to json
				__lowerCAmelCase      :  List[str]												=       list(_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  Dict												=       list(_SCREAMING_SNAKE_CASE)

				if len(self.conv_kernel) != self.num_conv_layers:
							raise ValueError(
							    "Configuration for convolutional module is incorrect. "
							    "It is required that `len(config.conv_kernel)` == `config.num_conv_layers` "
							    F"""but is `len(config.conv_kernel) = {len(self.conv_kernel)}`, """
							    F"""`config.num_conv_layers = {self.num_conv_layers}`.""")