



"""simple docstring"""







from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
			import torch

A    =					logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
			from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):

			def    __SCREAMING_SNAKE_CASE		( cls:       List[Any]   ):
									"""simple docstring"""






									return cls

def    __SCREAMING_SNAKE_CASE		( lowerCamelCase_:       Union[Tuple, List]    ,		lowerCamelCase_:       Optional[Union[List["torch.Generator"], "torch.Generator"]] = None    ,		lowerCamelCase_:       Optional["torch.device"] = None    ,		lowerCamelCase_:       Optional["torch.dtype"] = None    ,		lowerCamelCase_:       Optional["torch.layout"] = None    ,		):
						"""simple docstring"""






						snake_case      : str							=   device
						snake_case      : List[Any]							=   shape[0]

						snake_case      : Tuple							=   layout or torch.strided
						snake_case      : Any							=   device or torch.device("cpu"   )

						if generator is not None:
												snake_case      : List[str]							=   generator.device.type if not isinstance(lowerCamelCase_    ,		lowerCamelCase_   ) else generator[0].device.type
												if gen_device_type != device.type and gen_device_type == "cpu":
																		snake_case      : int							=   "cpu"
																		if device != "mps":
																								logger.info(
																								    f'''The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'''
																								    f''' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'''
																								    f''' slighly speed up this function by passing a generator that was created on the {device} device.'''   )
												elif gen_device_type != device.type and gen_device_type == "cuda":
																		raise ValueError(f'''Cannot generate a {device} tensor from a generator of type {gen_device_type}.'''   )

						if isinstance(lowerCamelCase_    ,		lowerCamelCase_   ):
												snake_case      : Any							=   (1,) + shape[1:]
												snake_case      : Optional[int]							=   [
												    torch.randn(lowerCamelCase_    ,		generator=generator[i]    ,		device=lowerCamelCase_    ,		dtype=lowerCamelCase_    ,		layout=lowerCamelCase_   )
												    for i in range(lowerCamelCase_   )
												]
												snake_case      : Optional[Any]							=   torch.cat(lowerCamelCase_    ,		dim=0   ).to(lowerCamelCase_   )
						else:
												snake_case      : Optional[int]							=   torch.randn(lowerCamelCase_    ,		generator=lowerCamelCase_    ,		device=lowerCamelCase_    ,		dtype=lowerCamelCase_    ,		layout=lowerCamelCase_   ).to(lowerCamelCase_   )

						return latents

def    __SCREAMING_SNAKE_CASE		( lowerCamelCase_:       Dict   ):
						"""simple docstring"""






						if is_torch_version("<"    ,		"2.0.0"   ) or not hasattr(lowerCamelCase_    ,		"_dynamo"   ):
												return False
						return isinstance(lowerCamelCase_    ,		torch._dynamo.eval_frame.OptimizedModule   )








"""simple docstring"""







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


A    =	logging.get_logger(__name__)

A    =	{
    'uw-madison/yoso-4096': 'https://huggingface.co/uw-madison/yoso-4096/resolve/main/config.json',
    # See all YOSO models at https://huggingface.co/models?filter=yoso
}

class 			_a     (   SCREAMING_SNAKE_CASE__):
			__magic_name__    				=    """yoso"""



			def __init__( self       :							List[str]      ,  _lowercase       :							List[str]=50265      ,  _lowercase       :							List[str]=768      ,  _lowercase       :							Optional[int]=12      ,  _lowercase       :							str=12      ,  _lowercase       :							List[Any]=3072      ,  _lowercase       :							Dict="gelu"      ,  _lowercase       :							int=0.1      ,  _lowercase       :							Optional[Any]=0.1      ,  _lowercase       :							Dict=4096      ,  _lowercase       :							Optional[Any]=1      ,  _lowercase       :							Any=0.02      ,  _lowercase       :							Union[str, Any]=1E-12      ,  _lowercase       :							int="absolute"      ,  _lowercase       :							Any=True      ,  _lowercase       :							Dict=9      ,  _lowercase       :							int=64      ,  _lowercase       :							Any=None      ,  _lowercase       :							List[str]=True      ,  _lowercase       :							Optional[Any]=True      ,  _lowercase       :							Any=1      ,  _lowercase       :							int=0      ,  _lowercase       :							List[str]=2      ,  **_lowercase       :							List[Any]      ,  )       ->				Union[str, Any]:
									super().__init__(pad_token_id=_lowercase      ,  bos_token_id=_lowercase      ,  eos_token_id=_lowercase      ,  **_lowercase		)

									snake_case      : List[str]							=   vocab_size
									snake_case      : Tuple							=   max_position_embeddings
									snake_case      : Optional[Any]							=   hidden_size
									snake_case      : Tuple							=   num_hidden_layers
									snake_case      : Tuple							=   num_attention_heads
									snake_case      : Any							=   intermediate_size
									snake_case      : Union[str, Any]							=   hidden_act
									snake_case      : int							=   hidden_dropout_prob
									snake_case      : Dict							=   attention_probs_dropout_prob
									snake_case      : Any							=   initializer_range
									snake_case      : Optional[Any]							=   type_vocab_size
									snake_case      : List[str]							=   layer_norm_eps
									snake_case      : Dict							=   position_embedding_type
									snake_case      : Tuple							=   use_expectation
									snake_case      : Dict							=   hash_code_len
									snake_case      : Optional[Any]							=   num_hash
									snake_case      : List[str]							=   conv_window
									snake_case      : Optional[Any]							=   use_fast_hash
									snake_case      : Tuple							=   lsh_backward



