


"""simple docstring"""






import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING


__snake_case				=				logging.get_logger(__name__)

__snake_case				=				{
    '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json''',
}


class 			__lowerCamelCase     (    _A ):

     '''simple docstring'''
     A_				:		int			=						"deta"
     A_				:		List[str]			=						{
         "hidden_size": "d_model",
         "num_attention_heads": "encoder_attention_heads",
     }


     def __init__(					self			, __UpperCAmelCase=None			, __UpperCAmelCase=900			, __UpperCAmelCase=2048			, __UpperCAmelCase=6			, __UpperCAmelCase=2048			, __UpperCAmelCase=8			, __UpperCAmelCase=6			, __UpperCAmelCase=1024			, __UpperCAmelCase=8			, __UpperCAmelCase=0.0			, __UpperCAmelCase=True			, __UpperCAmelCase="relu"			, __UpperCAmelCase=256			, __UpperCAmelCase=0.1			, __UpperCAmelCase=0.0			, __UpperCAmelCase=0.0			, __UpperCAmelCase=0.02			, __UpperCAmelCase=1.0			, __UpperCAmelCase=True			, __UpperCAmelCase=False			, __UpperCAmelCase="sine"			, __UpperCAmelCase=5			, __UpperCAmelCase=4			, __UpperCAmelCase=4			, __UpperCAmelCase=True			, __UpperCAmelCase=300			, __UpperCAmelCase=True			, __UpperCAmelCase=True			, __UpperCAmelCase=1			, __UpperCAmelCase=5			, __UpperCAmelCase=2			, __UpperCAmelCase=1			, __UpperCAmelCase=1			, __UpperCAmelCase=5			, __UpperCAmelCase=2			, __UpperCAmelCase=0.1			, __UpperCAmelCase=0.25			, **__UpperCAmelCase			, )				->							Dict:
          if backbone_config is None:
               logger.info('''`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone.'''							)
               _a					= CONFIG_MAPPING['''resnet'''](out_features=['''stage2''', '''stage3''', '''stage4''']							)
          else:
               if isinstance(__UpperCAmelCase			, __UpperCAmelCase							):
                    _a					= backbone_config.pop('''model_type'''							)
                    _a					= CONFIG_MAPPING[backbone_model_type]
                    _a					= config_class.from_dict(__UpperCAmelCase							)

          _a					= backbone_config
          _a					= num_queries
          _a					= max_position_embeddings
          _a					= d_model
          _a					= encoder_ffn_dim
          _a					= encoder_layers
          _a					= encoder_attention_heads
          _a					= decoder_ffn_dim
          _a					= decoder_layers
          _a					= decoder_attention_heads
          _a					= dropout
          _a					= attention_dropout
          _a					= activation_dropout
          _a					= activation_function
          _a					= init_std
          _a					= init_xavier_std
          _a					= encoder_layerdrop
          _a					= auxiliary_loss
          _a					= position_embedding_type
          # deformable attributes
          _a					= num_feature_levels
          _a					= encoder_n_points
          _a					= decoder_n_points
          _a					= two_stage
          _a					= two_stage_num_proposals
          _a					= with_box_refine
          _a					= assign_first_stage
          if two_stage is True and with_box_refine is False:
               raise ValueError('''If two_stage is True, with_box_refine must be True.'''							)
          # Hungarian matcher
          _a					= class_cost
          _a					= bbox_cost
          _a					= giou_cost
          # Loss coefficients
          _a					= mask_loss_coefficient
          _a					= dice_loss_coefficient
          _a					= bbox_loss_coefficient
          _a					= giou_loss_coefficient
          _a					= eos_coefficient
          _a					= focal_alpha
          super().__init__(is_encoder_decoder=__UpperCAmelCase			, **__UpperCAmelCase							)


     @property
     def 							_UpperCAmelCase					(					self							)				->							int:
          return self.encoder_attention_heads


     @property
     def 							_UpperCAmelCase					(					self							)				->							int:
          return self.d_model





     def 							_UpperCAmelCase					(					self							)				->							Dict:
          _a					= copy.deepcopy(self.__dict__							)
          _a					= self.backbone_config.to_dict()
          _a					= self.__class__.model_type
          return output







"""simple docstring"""



import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


__A		:       Dict  				=		'''
Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] After open-sourcing the model behind the chatbot, the company pivoted to focus on being a platform for machine learning.

In March 2021, Hugging Face raised $40 million in a Series B funding round.[3]

On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model.[4] In 2022, the workshop concluded with the announcement of BLOOM, a multilingual large language model with 176 billion parameters.[5]
'''





class 					_UpperCAmelCase       ( unittest.TestCase   ,						_A							):




					def   A  (				self     :						List[Any]   )  ->  Dict:
							lowercase_ : Optional[int]							       =   load_tool('''text-question-answering'''   )
							self.tool.setup()
							lowercase_ : Union[str, Any]							       =   load_tool('''text-question-answering'''    ,						remote=A   )




					def   A  (				self     :						Any   )  ->  List[str]:
							lowercase_ : Union[str, Any]							       =   self.tool(A    ,						'''What did Hugging Face do in April 2021?'''   )
							self.assertEqual(A    ,						'''launched the BigScience Research Workshop'''   )




					def   A  (				self     :						str   )  ->  List[str]:
							lowercase_ : int							       =   self.remote_tool(A    ,						'''What did Hugging Face do in April 2021?'''   )
							self.assertEqual(A    ,						'''launched the BigScience Research Workshop'''   )




					def   A  (				self     :						List[Any]   )  ->  int:
							lowercase_ : Optional[Any]							       =   self.tool(text=A    ,						question='''What did Hugging Face do in April 2021?'''   )
							self.assertEqual(A    ,						'''launched the BigScience Research Workshop'''   )






					def   A  (				self     :						List[str]   )  ->  Optional[int]:
							lowercase_ : int							       =   self.remote_tool(text=A    ,						question='''What did Hugging Face do in April 2021?'''   )
							self.assertEqual(A    ,						'''launched the BigScience Research Workshop'''   )



