'''simple docstring'''







import collections.abc
from typing import Optional, Tuple, Union

import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_poolformer import PoolFormerConfig


UpperCamelCase_      	=	logging.get_logger(__name__)

# General docstring
UpperCamelCase_      	=	'''PoolFormerConfig'''

# Base docstring
UpperCamelCase_      	=	'''sail/poolformer_s12'''
UpperCamelCase_      	=	[1, 5_12, 7, 7]

# Image classification docstring
UpperCamelCase_      	=	'''sail/poolformer_s12'''
UpperCamelCase_      	=	'''tabby, tabby cat'''

UpperCamelCase_      	=	[
    '''sail/poolformer_s12''',
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
]


def    lowerCamelCase       (			UpperCAmelCase__				:  int				,						UpperCAmelCase__				:  float = 0.0				,						UpperCAmelCase__				:  bool = False		)			->	Optional[Any]:


							'''simple docstring'''






							if drop_prob == 0.0 or not training:
														return input
							SCREAMING_SNAKE_CASE__     :Tuple						    = 1 - drop_prob
							SCREAMING_SNAKE_CASE__     :Optional[Any]						    = (input.shape[0],) + (1,) * (input.ndim - 1)  # work with diff dim tensors, not just 2D ConvNets
							SCREAMING_SNAKE_CASE__     :Any						    = keep_prob + torch.rand(UpperCAmelCase__				,						dtype=input.dtype				,						device=input.device		)
							random_tensor.floor_()  # binarize
							SCREAMING_SNAKE_CASE__     :int						    = input.div(UpperCAmelCase__		) * random_tensor
							return output




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       Tuple							,							UpperCamelCase_ :       Optional[float] = None      )     ->				None:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :Dict						    = drop_prob




						def      __lowerCamelCase       (    self :       str							,							UpperCamelCase_ :       torch.Tensor      )     ->				torch.Tensor:
													return drop_path(UpperCamelCase_							,							self.drop_prob							,							self.training      )




						def      __lowerCamelCase       (    self :       Optional[int]      )     ->				str:
													return "p={}".format(self.drop_prob      )




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       List[Any]							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Optional[Any]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       List[str]=None      )     ->				int:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :List[str]						    = patch_size if isinstance(UpperCamelCase_							,							collections.abc.Iterable      ) else (patch_size, patch_size)
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = stride if isinstance(UpperCamelCase_							,							collections.abc.Iterable      ) else (stride, stride)
													SCREAMING_SNAKE_CASE__     :List[Any]						    = padding if isinstance(UpperCamelCase_							,							collections.abc.Iterable      ) else (padding, padding)

													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = nn.Convad(UpperCamelCase_							,							UpperCamelCase_							,							kernel_size=UpperCamelCase_							,							stride=UpperCamelCase_							,							padding=UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = norm_layer(UpperCamelCase_      ) if norm_layer else nn.Identity()




						def      __lowerCamelCase       (    self :       Dict							,							UpperCamelCase_ :       Union[str, Any]      )     ->				Optional[Any]:
													SCREAMING_SNAKE_CASE__     :Optional[Any]						    = self.projection(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Any						    = self.norm(UpperCamelCase_      )
													return embeddings




class _SCREAMING_SNAKE_CASE(							nn.GroupNorm					):




						def __init__(    self :       Dict							,							UpperCamelCase_ :       List[Any]							,							**UpperCamelCase_ :       Dict      )     ->				Tuple:
													super().__init__(1							,							UpperCamelCase_							,							**UpperCamelCase_      )




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       Any							,							UpperCamelCase_ :       List[str]      )     ->				Union[str, Any]:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :str						    = nn.AvgPoolad(UpperCamelCase_							,							stride=1							,							padding=pool_size // 2							,							count_include_pad=UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Any							,							UpperCamelCase_ :       int      )     ->				Dict:
													return self.pool(UpperCamelCase_      ) - hidden_states




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       str							,							UpperCamelCase_ :       Union[str, Any]							,							UpperCamelCase_ :       Tuple							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       List[str]      )     ->				Dict:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :str						    = nn.Convad(UpperCamelCase_							,							UpperCamelCase_							,							1      )
													SCREAMING_SNAKE_CASE__     :List[Any]						    = nn.Convad(UpperCamelCase_							,							UpperCamelCase_							,							1      )
													SCREAMING_SNAKE_CASE__     :Dict						    = PoolFormerDropPath(UpperCamelCase_      )
													if isinstance(config.hidden_act							,							UpperCamelCase_      ):
																				SCREAMING_SNAKE_CASE__     :List[Any]						    = ACTaFN[config.hidden_act]
													else:
																				SCREAMING_SNAKE_CASE__     :List[str]						    = config.hidden_act




						def      __lowerCamelCase       (    self :       Union[str, Any]							,							UpperCamelCase_ :       List[Any]      )     ->				int:
													SCREAMING_SNAKE_CASE__     :Tuple						    = self.conva(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Tuple						    = self.act_fn(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :List[str]						    = self.drop(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :int						    = self.conva(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Dict						    = self.drop(UpperCamelCase_      )

													return hidden_states




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       List[Any]							,							UpperCamelCase_ :       int							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       List[Any]							,							UpperCamelCase_ :       List[str]							,							UpperCamelCase_ :       Dict							,							UpperCamelCase_ :       Tuple      )     ->				List[str]:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :str						    = PoolFormerPooling(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :List[Any]						    = PoolFormerOutput(UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_							,							UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = PoolFormerGroupNorm(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :List[str]						    = PoolFormerGroupNorm(UpperCamelCase_      )

													# Useful for training neural nets
													SCREAMING_SNAKE_CASE__     :Any						    = PoolFormerDropPath(UpperCamelCase_      ) if drop_path > 0.0 else nn.Identity()
													SCREAMING_SNAKE_CASE__     :List[Any]						    = config.use_layer_scale
													if config.use_layer_scale:
																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = nn.Parameter(
																				    config.layer_scale_init_value * torch.ones((UpperCamelCase_)      )							,							requires_grad=UpperCamelCase_      )
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = nn.Parameter(
																				    config.layer_scale_init_value * torch.ones((UpperCamelCase_)      )							,							requires_grad=UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       str							,							UpperCamelCase_ :       Any      )     ->				Tuple:
													if self.use_layer_scale:
																				SCREAMING_SNAKE_CASE__     :List[str]						    = self.pooling(self.before_norm(UpperCamelCase_      )      )
																				SCREAMING_SNAKE_CASE__     :int						    = self.layer_scale_a.unsqueeze(-1      ).unsqueeze(-1      ) * pooling_output
																				# First residual connection
																				SCREAMING_SNAKE_CASE__     :Dict						    = hidden_states + self.drop_path(UpperCamelCase_      )
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = ()

																				SCREAMING_SNAKE_CASE__     :Optional[int]						    = self.output(self.after_norm(UpperCamelCase_      )      )
																				SCREAMING_SNAKE_CASE__     :Tuple						    = self.layer_scale_a.unsqueeze(-1      ).unsqueeze(-1      ) * layer_output
																				# Second residual connection
																				SCREAMING_SNAKE_CASE__     :List[str]						    = hidden_states + self.drop_path(UpperCamelCase_      )

																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = (output,) + outputs
																				return outputs

													else:
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = self.drop_path(self.pooling(self.before_norm(UpperCamelCase_      )      )      )
																				# First residual connection
																				SCREAMING_SNAKE_CASE__     :int						    = pooling_output + hidden_states
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = ()

																				# Second residual connection inside the PoolFormerOutput block
																				SCREAMING_SNAKE_CASE__     :List[str]						    = self.drop_path(self.output(self.after_norm(UpperCamelCase_      )      )      )
																				SCREAMING_SNAKE_CASE__     :Optional[int]						    = hidden_states + layer_output

																				SCREAMING_SNAKE_CASE__     :Optional[Any]						    = (output,) + outputs
																				return outputs




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       Optional[Any]							,							UpperCamelCase_ :       Union[str, Any]      )     ->				List[Any]:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :Any						    = config
													# stochastic depth decay rule
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = [x.item() for x in torch.linspace(0							,							config.drop_path_rate							,							sum(config.depths      )      )]

													# patch embeddings
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = []
													for i in range(config.num_encoder_blocks      ):
																				embeddings.append(
																				    PoolFormerEmbeddings(
																				        patch_size=config.patch_sizes[i]							,							stride=config.strides[i]							,							padding=config.padding[i]							,							num_channels=config.num_channels if i == 0 else config.hidden_sizes[i - 1]							,							hidden_size=config.hidden_sizes[i]							,							)      )
													SCREAMING_SNAKE_CASE__     :int						    = nn.ModuleList(UpperCamelCase_      )

													# Transformer blocks
													SCREAMING_SNAKE_CASE__     :List[Any]						    = []
													SCREAMING_SNAKE_CASE__     :Tuple						    = 0
													for i in range(config.num_encoder_blocks      ):
																				# each block consists of layers
																				SCREAMING_SNAKE_CASE__     :Any						    = []
																				if i != 0:
																											cur += config.depths[i - 1]
																				for j in range(config.depths[i]      ):
																											layers.append(
																											    PoolFormerLayer(
																											        UpperCamelCase_							,							num_channels=config.hidden_sizes[i]							,							pool_size=config.pool_size							,							hidden_size=config.hidden_sizes[i]							,							intermediate_size=int(config.hidden_sizes[i] * config.mlp_ratio      )							,							drop_path=dpr[cur + j]							,							)      )
																				blocks.append(nn.ModuleList(UpperCamelCase_      )      )

													SCREAMING_SNAKE_CASE__     :List[Any]						    = nn.ModuleList(UpperCamelCase_      )




						def      __lowerCamelCase       (    self :       Any							,							UpperCamelCase_ :       str							,							UpperCamelCase_ :       int=False							,							UpperCamelCase_ :       List[str]=True      )     ->				Union[str, Any]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = () if output_hidden_states else None

													SCREAMING_SNAKE_CASE__     :int						    = pixel_values
													for idx, layers in enumerate(zip(self.patch_embeddings							,							self.block      )      ):
																				SCREAMING_SNAKE_CASE__    ,      SCREAMING_SNAKE_CASE__     :List[Any]						    = layers
																				# Get patch embeddings from hidden_states
																				SCREAMING_SNAKE_CASE__     :int						    = embedding_layer(UpperCamelCase_      )
																				# Send the embeddings through the blocks
																				for _, blk in enumerate(UpperCamelCase_      ):
																											SCREAMING_SNAKE_CASE__     :Tuple						    = blk(UpperCamelCase_      )
																											SCREAMING_SNAKE_CASE__     :Dict						    = layer_outputs[0]

																				if output_hidden_states:
																											SCREAMING_SNAKE_CASE__     :Optional[Any]						    = all_hidden_states + (hidden_states,)

													if not return_dict:
																				return tuple(v for v in [hidden_states, all_hidden_states] if v is not None      )

													return BaseModelOutputWithNoAttention(last_hidden_state=UpperCamelCase_							,							hidden_states=UpperCamelCase_      )




class _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE					):
						A_			:							Any     		= PoolFormerConfig
						A_			:							Optional[int]     		= 'poolformer'
						A_			:							Optional[int]     		= 'pixel_values'
						A_			:							Any     		= True




						def      __lowerCamelCase       (    self :       str							,							UpperCamelCase_ :       List[Any]      )     ->				str:
													if isinstance(UpperCamelCase_							,							(nn.Linear, nn.Convad)      ):
																				module.weight.data.normal_(mean=0.0							,							std=self.config.initializer_range      )
																				if module.bias is not None:
																											module.bias.data.zero_()
													elif isinstance(UpperCamelCase_							,							nn.LayerNorm      ):
																				module.bias.data.zero_()
																				module.weight.data.fill_(1.0      )




						def      __lowerCamelCase       (    self :       int							,							UpperCamelCase_ :       Optional[int]							,							UpperCamelCase_ :       Any=False      )     ->				Union[str, Any]:
													if isinstance(UpperCamelCase_							,							UpperCamelCase_      ):
																				SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = value
UpperCamelCase_      	=	R'''
    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use
    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.

    Parameters:
        config ([`PoolFormerConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
'''

UpperCamelCase_      	=	R'''
    Args:
        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See
            [`PoolFormerImageProcessor.__call__`] for details.
'''




@add_start_docstrings(
    'The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.'						,						_SCREAMING_SNAKE_CASE						,						)
class _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE					):




						def __init__(    self :       int							,							UpperCamelCase_ :       Dict      )     ->				Tuple:
													super().__init__(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :int						    = config

													SCREAMING_SNAKE_CASE__     :int						    = PoolFormerEncoder(UpperCamelCase_      )

													# Initialize weights and apply final processing
													self.post_init()




						def      __lowerCamelCase       (    self :       Union[str, Any]      )     ->				Optional[Any]:
													return self.embeddings.patch_embeddings




						@add_start_docstrings_to_model_forward(UpperCamelCase_      )
						@add_code_sample_docstrings(
						    checkpoint=_CHECKPOINT_FOR_DOC							,							output_type=UpperCamelCase_							,							config_class=_CONFIG_FOR_DOC							,							modality='vision'							,							expected_output=_EXPECTED_OUTPUT_SHAPE							,							)
						def      __lowerCamelCase       (    self :       Union[str, Any]							,							UpperCamelCase_ :       Optional[torch.FloatTensor] = None							,							UpperCamelCase_ :       Optional[bool] = None							,							UpperCamelCase_ :       Optional[bool] = None							,							)     ->				Union[Tuple, BaseModelOutputWithNoAttention]:
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = (
													    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
													)
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = return_dict if return_dict is not None else self.config.use_return_dict

													if pixel_values is None:
																				raise ValueError('You have to specify pixel_values'      )

													SCREAMING_SNAKE_CASE__     :List[str]						    = self.encoder(
													    UpperCamelCase_							,							output_hidden_states=UpperCamelCase_							,							return_dict=UpperCamelCase_							,							)
													SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = encoder_outputs[0]

													if not return_dict:
																				return (sequence_output, None) + encoder_outputs[1:]

													return BaseModelOutputWithNoAttention(
													    last_hidden_state=UpperCamelCase_							,							hidden_states=encoder_outputs.hidden_states							,							)




class _SCREAMING_SNAKE_CASE(							nn.Module					):




						def __init__(    self :       List[str]							,							UpperCamelCase_ :       int      )     ->				Any:
													super().__init__()
													SCREAMING_SNAKE_CASE__     :Tuple						    = nn.Linear(config.hidden_size							,							config.hidden_size      )




						def      __lowerCamelCase       (    self :       List[Any]							,							UpperCamelCase_ :       List[Any]      )     ->				Dict:
													SCREAMING_SNAKE_CASE__     :Any						    = self.dense(UpperCamelCase_      )
													return output




@add_start_docstrings(
    '\n    PoolFormer Model transformer with an image classification head on top\n    '						,						_SCREAMING_SNAKE_CASE						,						)
class _SCREAMING_SNAKE_CASE(							_SCREAMING_SNAKE_CASE					):




						def __init__(    self :       Tuple							,							UpperCamelCase_ :       Dict      )     ->				Tuple:
													super().__init__(UpperCamelCase_      )
													SCREAMING_SNAKE_CASE__     :List[Any]						    = config.num_labels
													SCREAMING_SNAKE_CASE__     :str						    = PoolFormerModel(UpperCamelCase_      )

													# Final norm
													SCREAMING_SNAKE_CASE__     :Tuple						    = PoolFormerGroupNorm(config.hidden_sizes[-1]      )
													# Classifier head
													SCREAMING_SNAKE_CASE__     :str						    = (
													    nn.Linear(config.hidden_sizes[-1]							,							config.num_labels      ) if config.num_labels > 0 else nn.Identity()
													)

													# Initialize weights and apply final processing
													self.post_init()




						@add_start_docstrings_to_model_forward(UpperCamelCase_      )
						@add_code_sample_docstrings(
						    checkpoint=_IMAGE_CLASS_CHECKPOINT							,							output_type=UpperCamelCase_							,							config_class=_CONFIG_FOR_DOC							,							expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT							,							)
						def      __lowerCamelCase       (    self :       Optional[int]							,							UpperCamelCase_ :       Optional[torch.FloatTensor] = None							,							UpperCamelCase_ :       Optional[torch.LongTensor] = None							,							UpperCamelCase_ :       Optional[bool] = None							,							UpperCamelCase_ :       Optional[bool] = None							,							)     ->				Union[Tuple, ImageClassifierOutputWithNoAttention]:
													SCREAMING_SNAKE_CASE__     :Optional[int]						    = return_dict if return_dict is not None else self.config.use_return_dict

													SCREAMING_SNAKE_CASE__     :int						    = self.poolformer(
													    UpperCamelCase_							,							output_hidden_states=UpperCamelCase_							,							return_dict=UpperCamelCase_							,							)

													SCREAMING_SNAKE_CASE__     :Any						    = outputs[0]

													SCREAMING_SNAKE_CASE__     :Dict						    = self.classifier(self.norm(UpperCamelCase_      ).mean([-2, -1]      )      )

													SCREAMING_SNAKE_CASE__     :Any						    = None
													if labels is not None:
																				if self.config.problem_type is None:
																											if self.num_labels == 1:
																																		SCREAMING_SNAKE_CASE__     :str						    = 'regression'
																											elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																																		SCREAMING_SNAKE_CASE__     :Optional[int]						    = 'single_label_classification'
																											else:
																																		SCREAMING_SNAKE_CASE__     :str						    = 'multi_label_classification'

																				if self.config.problem_type == "regression":
																											SCREAMING_SNAKE_CASE__     :List[Any]						    = MSELoss()
																											if self.num_labels == 1:
																																		SCREAMING_SNAKE_CASE__     :Optional[Any]						    = loss_fct(logits.squeeze()							,							labels.squeeze()      )
																											else:
																																		SCREAMING_SNAKE_CASE__     :Any						    = loss_fct(UpperCamelCase_							,							UpperCamelCase_      )
																				elif self.config.problem_type == "single_label_classification":
																											SCREAMING_SNAKE_CASE__     :str						    = CrossEntropyLoss()
																											SCREAMING_SNAKE_CASE__     :Optional[Any]						    = loss_fct(logits.view(-1							,							self.num_labels      )							,							labels.view(-1      )      )
																				elif self.config.problem_type == "multi_label_classification":
																											SCREAMING_SNAKE_CASE__     :int						    = BCEWithLogitsLoss()
																											SCREAMING_SNAKE_CASE__     :Union[str, Any]						    = loss_fct(UpperCamelCase_							,							UpperCamelCase_      )

													if not return_dict:
																				SCREAMING_SNAKE_CASE__     :Optional[int]						    = (logits,) + outputs[2:]
																				return ((loss,) + output) if loss is not None else output

													return ImageClassifierOutputWithNoAttention(loss=UpperCamelCase_							,							logits=UpperCamelCase_							,							hidden_states=outputs.hidden_states      )







'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


UpperCamelCase_      	=	{
    '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''],
}
try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCamelCase_      	=	['''BloomTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCamelCase_      	=	[
		    '''BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''BloomForCausalLM''',
		    '''BloomModel''',
		    '''BloomPreTrainedModel''',
		    '''BloomForSequenceClassification''',
		    '''BloomForTokenClassification''',
		    '''BloomForQuestionAnswering''',
		]

if TYPE_CHECKING:
		from .configuration_bloom import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP, BloomConfig, BloomOnnxConfig

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_bloom_fast import BloomTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_bloom import (
				    BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST,
				    BloomForCausalLM,
				    BloomForQuestionAnswering,
				    BloomForSequenceClassification,
				    BloomForTokenClassification,
				    BloomModel,
				    BloomPreTrainedModel,
				)

else:
		import sys

		UpperCamelCase_      	=	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






