






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


lowerCamelCase__							=     logging.get_logger(__name__)

lowerCamelCase__							=     {
    """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""",
}




class 			snake_case__   (							lowercase_):

       '''simple docstring'''
       lowerCamelCase							:				Dict 				= "nllb-moe"
       lowerCamelCase							:				List[str] 				= ["past_key_values"]
       lowerCamelCase							:				Dict 				= {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}



       def __init__(							self			,						a__=12_81_12			,						a__=10_24			,						a__=12			,						a__=40_96			,						a__=16			,						a__=12			,						a__=40_96			,						a__=16			,						a__=0.05			,						a__=0.05			,						a__=True			,						a__=True			,						a__="relu"			,						a__=10_24			,						a__=0.1			,						a__=0.1			,						a__=0.0			,						a__=0.02			,						a__=2			,						a__=True			,						a__=False			,						a__="float32"			,						a__=False			,						a__=1_28			,						a__=64			,						a__=4			,						a__=4			,						a__=0.0_01			,						a__=0.0_01			,						a__="all"			,						a__=False			,						a__=False			,						a__=1.0			,						a__=0.2			,						a__=1			,						a__=0			,						a__=2			,						a__=False			,						**a__			,						) ->      Optional[int]:






            '''simple docstring'''





            __snake_case			:Tuple          =						vocab_size
            __snake_case			:str          =						max_position_embeddings
            __snake_case			:Dict          =						d_model
            __snake_case			:Any          =						encoder_ffn_dim
            __snake_case			:Optional[Any]          =						encoder_layers
            __snake_case			:List[Any]          =						encoder_attention_heads
            __snake_case			:List[str]          =						decoder_ffn_dim
            __snake_case			:Union[str, Any]          =						decoder_layers
            __snake_case			:List[str]          =						decoder_attention_heads
            __snake_case			:Tuple          =						dropout
            __snake_case			:Tuple          =						attention_dropout
            __snake_case			:Tuple          =						activation_dropout
            __snake_case			:Tuple          =						activation_function
            __snake_case			:List[str]          =						init_std
            __snake_case			:Tuple          =						encoder_layerdrop
            __snake_case			:Optional[Any]          =						decoder_layerdrop
            __snake_case			:List[Any]          =						use_cache
            __snake_case			:List[str]          =						encoder_layers
            __snake_case			:str          =						scale_embedding  # scale factor will be sqrt(d_model) if True
            __snake_case			:Any          =						router_z_loss_coef
            __snake_case			:Optional[Any]          =						router_aux_loss_coef
            __snake_case			:Dict          =						decoder_sparse_step
            __snake_case			:Union[str, Any]          =						encoder_sparse_step
            __snake_case			:Optional[int]          =						num_experts
            __snake_case			:Union[str, Any]          =						expert_capacity
            __snake_case			:Tuple          =						router_bias
            if router_dtype not in ["float32", "float16", "bfloat16"]:
                 raise ValueError(F'''`router_dtype` must be one of \'float32\', \'float16\' or \'bfloat16\', got {router_dtype}'''    )
            __snake_case			:Any          =						router_dtype

            __snake_case			:Optional[Any]          =						router_ignore_padding_tokens
            __snake_case			:int          =						batch_prioritized_routing
            __snake_case			:Union[str, Any]          =						second_expert_policy
            __snake_case			:str          =						normalize_router_prob_before_dropping
            __snake_case			:Any          =						moe_eval_capacity_token_fraction
            __snake_case			:Union[str, Any]          =						moe_token_dropout
            __snake_case			:int          =						output_router_logits
            super().__init__(
                pad_token_id=a__			,						bos_token_id=a__			,						eos_token_id=a__			,						is_encoder_decoder=a__			,						decoder_start_token_id=a__			,						**a__			,						)










import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


lowerCamelCase__							=     """
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 			snake_case__   (							unittest.TestCase	,    lowercase_):

       '''simple docstring'''



       def 					__lowercase						(							self    ) ->      List[str]:






            '''simple docstring'''





            __snake_case			:int          =						load_tool("""text-question-answering"""    )
            self.tool.setup()
            __snake_case			:Tuple          =						load_tool("""text-question-answering"""			,						remote=a__    )



       def 					__lowercase						(							self    ) ->      Any:






            '''simple docstring'''





            __snake_case			:List[str]          =						self.tool(a__			,						"""What did Hugging Face do in April 2021?"""    )
            self.assertEqual(a__			,						"""launched the BigScience Research Workshop"""    )



       def 					__lowercase						(							self    ) ->      Any:






            '''simple docstring'''





            __snake_case			:List[str]          =						self.remote_tool(a__			,						"""What did Hugging Face do in April 2021?"""    )
            self.assertEqual(a__			,						"""launched the BigScience Research Workshop"""    )



       def 					__lowercase						(							self    ) ->      Dict:






            '''simple docstring'''





            __snake_case			:Optional[int]          =						self.tool(text=a__			,						question="""What did Hugging Face do in April 2021?"""    )
            self.assertEqual(a__			,						"""launched the BigScience Research Workshop"""    )



       def 					__lowercase						(							self    ) ->      Tuple:






            '''simple docstring'''





            __snake_case			:List[str]          =						self.remote_tool(text=a__			,						question="""What did Hugging Face do in April 2021?"""    )
            self.assertEqual(a__			,						"""launched the BigScience Research Workshop"""    )


