




import os
import sys
import unittest


_lowerCamelCase      :						Optional[int]							=  os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, """utils"""))

import get_test_info  # noqa: E402
from get_test_info import (  # noqa: E402
    get_model_to_test_mapping,
    get_model_to_tester_mapping,
    get_test_to_tester_mapping,
)


_lowerCamelCase      :						List[Any]							=  os.path.join("""tests""", """models""", """bert""", """test_modeling_bert.py""")
_lowerCamelCase      :						Dict							=  os.path.join("""tests""", """models""", """blip""", """test_modeling_blip.py""")


class 							UpperCamelCase_       (					unittest.TestCase	):

    '''simple docstring'''






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





           '''simple docstring'''

           A__ 					=       get_test_to_tester_mapping(lowerCAmelCase_)
           A__ 					=       get_test_to_tester_mapping(lowerCAmelCase_)

           A__ 					=       {'BertModelTest': 'BertModelTester'}

           A__ 					=       {
               'BlipModelTest': 'BlipModelTester',
               'BlipTextImageModelTest': 'BlipTextImageModelsModelTester',
               'BlipTextModelTest': 'BlipTextModelTester',
               'BlipTextRetrievalModelTest': 'BlipTextRetrievalModelTester',
               'BlipVQAModelTest': 'BlipVQAModelTester',
               'BlipVisionModelTest': 'BlipVisionModelTester',
           }

           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)
           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)


    def 			SCREAMING_SNAKE_CASE				(     self :      Optional[int])		->Tuple:





           '''simple docstring'''

           A__ 					=       get_model_to_test_mapping(lowerCAmelCase_)
           A__ 					=       get_model_to_test_mapping(lowerCAmelCase_)

           A__ 					=       {
               'BertForMaskedLM': ['BertModelTest'],
               'BertForMultipleChoice': ['BertModelTest'],
               'BertForNextSentencePrediction': ['BertModelTest'],
               'BertForPreTraining': ['BertModelTest'],
               'BertForQuestionAnswering': ['BertModelTest'],
               'BertForSequenceClassification': ['BertModelTest'],
               'BertForTokenClassification': ['BertModelTest'],
               'BertLMHeadModel': ['BertModelTest'],
               'BertModel': ['BertModelTest'],
           }

           A__ 					=       {
               'BlipForConditionalGeneration': ['BlipTextImageModelTest'],
               'BlipForImageTextRetrieval': ['BlipTextRetrievalModelTest'],
               'BlipForQuestionAnswering': ['BlipVQAModelTest'],
               'BlipModel': ['BlipModelTest'],
               'BlipTextModel': ['BlipTextModelTest'],
               'BlipVisionModel': ['BlipVisionModelTest'],
           }

           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)
           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)





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





           '''simple docstring'''

           A__ 					=       get_model_to_tester_mapping(lowerCAmelCase_)
           A__ 					=       get_model_to_tester_mapping(lowerCAmelCase_)

           A__ 					=       {
               'BertForMaskedLM': ['BertModelTester'],
               'BertForMultipleChoice': ['BertModelTester'],
               'BertForNextSentencePrediction': ['BertModelTester'],
               'BertForPreTraining': ['BertModelTester'],
               'BertForQuestionAnswering': ['BertModelTester'],
               'BertForSequenceClassification': ['BertModelTester'],
               'BertForTokenClassification': ['BertModelTester'],
               'BertLMHeadModel': ['BertModelTester'],
               'BertModel': ['BertModelTester'],
           }

           A__ 					=       {
               'BlipForConditionalGeneration': ['BlipTextImageModelsModelTester'],
               'BlipForImageTextRetrieval': ['BlipTextRetrievalModelTester'],
               'BlipForQuestionAnswering': ['BlipVQAModelTester'],
               'BlipModel': ['BlipModelTester'],
               'BlipTextModel': ['BlipTextModelTester'],
               'BlipVisionModel': ['BlipVisionModelTester'],
           }

           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)
           self.assertEqual(get_test_info.to_json(lowerCAmelCase_)   ,					lowerCAmelCase_)










"""simple docstring"""
import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand





def 				lowercase__		(					lowerCamelCase       ):
				return EnvironmentCommand()






class _lowerCAmelCase						(    __UpperCAmelCase       ):







						@staticmethod
						def 			A      (    lowerCAmelCase_							)		->							List[Any]:
										_SCREAMING_SNAKE_CASE   :		int       		=    parser.add_parser('env'							)
										download_parser.set_defaults(func=lowerCAmelCase_							)







						def 			A      (    self							)		->							Any:
										_SCREAMING_SNAKE_CASE   :		int       		=    huggingface_hub.__version__

										_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    'not installed'
										_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    'NA'
										if is_torch_available():
														import torch

														_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    torch.__version__
														_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    torch.cuda.is_available()

										_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    'not installed'
										if is_transformers_available():
														import transformers

														_SCREAMING_SNAKE_CASE   :		Tuple       		=    transformers.__version__

										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    'not installed'
										if is_accelerate_available():
														import accelerate

														_SCREAMING_SNAKE_CASE   :		str       		=    accelerate.__version__

										_SCREAMING_SNAKE_CASE   :		str       		=    'not installed'
										if is_xformers_available():
														import xformers

														_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    xformers.__version__

										_SCREAMING_SNAKE_CASE   :		Any       		=    {
										    '`diffusers` version': version,
										    'Platform': platform.platform(),
										    'Python version': platform.python_version(),
										    'PyTorch version (GPU?)': F"""{pt_version} ({pt_cuda_available})""",
										    'Huggingface_hub version': hub_version,
										    'Transformers version': transformers_version,
										    'Accelerate version': accelerate_version,
										    'xFormers version': xformers_version,
										    'Using GPU in script?': '<fill in>',
										    'Using distributed or parallel set-up in script?': '<fill in>',
										}

										print('\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n'							)
										print(self.format_dict(lowerCAmelCase_							)							)

										return info







						@staticmethod
						def 			A      (    lowerCAmelCase_							)		->							int:
										return "\n".join([F"""- {prop}: {val}""" for prop, val in d.items()]							) + "\n"

