





"""simple docstring"""
import os
import shutil
import unittest
from unittest.mock import patch

from transformers.testing_utils import CaptureStd, is_pt_tf_cross_test, require_torch
class lowerCamelCase__  (    unittest.TestCase				):



   @patch("""sys.argv"""      ,   ["""fakeprogrampath""", """env"""]	)
   def    _UpperCAmelCase	(       self	) ->    int:







      """simple docstring"""
      import transformers.commands.transformers_cli

      with CaptureStd() as cs:
         transformers.commands.transformers_cli.main()
      self.assertIn("""Python version"""      ,   cs.out	)
      self.assertIn("""Platform"""      ,   cs.out	)
      self.assertIn("""Using distributed or parallel set-up in script?"""      ,   cs.out	)



   @is_pt_tf_cross_test
   @patch(
       """sys.argv"""      ,   ["""fakeprogrampath""", """pt-to-tf""", """--model-name""", """hf-internal-testing/tiny-random-gptj""", """--no-pr"""]	)
   def    _UpperCAmelCase	(       self	) ->    Dict:







      """simple docstring"""
      import transformers.commands.transformers_cli

      shutil.rmtree("""/tmp/hf-internal-testing/tiny-random-gptj"""      ,   ignore_errors=__a	)  # cleans potential past runs
      transformers.commands.transformers_cli.main()

      # The original repo has no TF weights -- if they exist, they were created by the CLI
      self.assertTrue(os.path.exists("""/tmp/hf-internal-testing/tiny-random-gptj/tf_model.h5"""	)	)



   @require_torch
   @patch("""sys.argv"""      ,   ["""fakeprogrampath""", """download""", """hf-internal-testing/tiny-random-gptj""", """--cache-dir""", """/tmp"""]	)
   def    _UpperCAmelCase	(       self	) ->    Optional[Any]:







      """simple docstring"""
      import transformers.commands.transformers_cli

      # # remove any previously downloaded model to start clean
      shutil.rmtree("""/tmp/models--hf-internal-testing--tiny-random-gptj"""      ,   ignore_errors=__a	)

      # run the command
      transformers.commands.transformers_cli.main()

      # check if the model files are downloaded correctly on /tmp/models--hf-internal-testing--tiny-random-gptj
      self.assertTrue(os.path.exists("""/tmp/models--hf-internal-testing--tiny-random-gptj/blobs"""	)	)
      self.assertTrue(os.path.exists("""/tmp/models--hf-internal-testing--tiny-random-gptj/refs"""	)	)
      self.assertTrue(os.path.exists("""/tmp/models--hf-internal-testing--tiny-random-gptj/snapshots"""	)	)





   @require_torch
   @patch(
       """sys.argv"""      ,   [
           """fakeprogrampath""",
           """download""",
           """hf-internal-testing/test_dynamic_model_with_tokenizer""",
           """--trust-remote-code""",
           """--cache-dir""",
           """/tmp""",
       ]      ,   )
   def    _UpperCAmelCase	(       self	) ->    Union[str, Any]:







      """simple docstring"""
      import transformers.commands.transformers_cli

      # # remove any previously downloaded model to start clean
      shutil.rmtree("""/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer"""      ,   ignore_errors=__a	)

      # run the command
      transformers.commands.transformers_cli.main()

      # check if the model files are downloaded correctly on /tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer
      self.assertTrue(os.path.exists("""/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/blobs"""	)	)
      self.assertTrue(os.path.exists("""/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/refs"""	)	)
      self.assertTrue(
          os.path.exists("""/tmp/models--hf-internal-testing--test_dynamic_model_with_tokenizer/snapshots"""	)	)









"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase:	int							      =logging.get_logger(__name__)

lowerCAmelCase:	int							      ={
    "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/config.json",
    # QDQBERT models can be loaded from any BERT checkpoint, available at https://huggingface.co/models?filter=bert
}
class lowerCamelCase__  (    __UpperCamelCase				):
   __UpperCAmelCase        =					"""qdqbert"""



   def __init__(       self      ,   snake_case=3_0_5_2_2      ,   snake_case=7_6_8      ,   snake_case=1_2      ,   snake_case=1_2      ,   snake_case=3_0_7_2      ,   snake_case="gelu"      ,   snake_case=0.1      ,   snake_case=0.1      ,   snake_case=5_1_2      ,   snake_case=2      ,   snake_case=0.02      ,   snake_case=1E-12      ,   snake_case=True      ,   snake_case=1      ,   snake_case=0      ,   snake_case=2      ,   **snake_case      ,   ) ->    List[str]:







      """simple docstring"""
      super().__init__(pad_token_id=snake_case      ,   bos_token_id=snake_case      ,   eos_token_id=snake_case      ,   **snake_case	)

      lowercase    :			Optional[Any]  =       vocab_size
      lowercase    :			int  =       max_position_embeddings
      lowercase    :			Dict  =       hidden_size
      lowercase    :			Union[str, Any]  =       num_hidden_layers
      lowercase    :			str  =       num_attention_heads
      lowercase    :			List[str]  =       intermediate_size
      lowercase    :			List[str]  =       hidden_act
      lowercase    :			List[str]  =       hidden_dropout_prob
      lowercase    :			Optional[Any]  =       attention_probs_dropout_prob
      lowercase    :			Optional[Any]  =       initializer_range
      lowercase    :			str  =       type_vocab_size
      lowercase    :			Optional[int]  =       layer_norm_eps
      lowercase    :			Optional[int]  =       use_cache


