code: 
  
  
  
  
  
  
  import unittest
  from pathlib import Path
  
  from transformers import is_vision_available, load_tool
  from transformers.testing_utils import get_tests_dir
  
  from .test_tools_common import ToolTesterMixin
  
  
  if is_vision_available():
   from PIL import Image
  
  
  
  
  
  
  
  class     UpperCAmelCase_		(      unittest.TestCase,			lowercase				):
  
  
  
        """simple docstring"""
        def 					UpperCAmelCase		(       self				)       ->   int:
            UpperCamelCase :Tuple										=     load_tool('''image-segmentation'''				)
            self.tool.setup()
            UpperCamelCase :List[Any]										=     load_tool('''image-segmentation'''					,       remote=SCREAMING_SNAKE_CASE_				)
        def 					UpperCAmelCase		(       self				)       ->   Tuple:
            UpperCamelCase :Optional[int]										=     Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''				)				) / '''000000039769.png'''				)
            UpperCamelCase :List[Any]										=     self.tool(SCREAMING_SNAKE_CASE_					,       '''cat'''				)
            self.assertTrue(isinstance(SCREAMING_SNAKE_CASE_					,       Image.Image				)				)
        def 					UpperCAmelCase		(       self				)       ->   Any:
            UpperCamelCase :Optional[int]										=     Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''				)				) / '''000000039769.png'''				)
            UpperCamelCase :List[str]										=     self.remote_tool(SCREAMING_SNAKE_CASE_					,       '''cat'''				)
            self.assertTrue(isinstance(SCREAMING_SNAKE_CASE_					,       Image.Image				)				)
        def 					UpperCAmelCase		(       self				)       ->   Union[str, Any]:
            UpperCamelCase :Tuple										=     Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''				)				) / '''000000039769.png'''				)
            UpperCamelCase :Union[str, Any]										=     self.tool(image=SCREAMING_SNAKE_CASE_					,       label='''cat'''				)
            self.assertTrue(isinstance(SCREAMING_SNAKE_CASE_					,       Image.Image				)				)
  
  
  
  
        def 					UpperCAmelCase		(       self				)       ->   Tuple:
            UpperCamelCase :Union[str, Any]										=     Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''				)				) / '''000000039769.png'''				)
            UpperCamelCase :int										=     self.remote_tool(image=SCREAMING_SNAKE_CASE_					,       label='''cat'''				)
            self.assertTrue(isinstance(SCREAMING_SNAKE_CASE_					,       Image.Image				)				)
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_sentencepiece_available,
      is_tokenizers_available,
      is_torch_available,
  )
  
  
  __snake_case							      =						{
      """configuration_open_llama""": ["""OPEN_LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """OpenLlamaConfig"""],
  }
  
  try:
   if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   __snake_case							      =						["""LlamaTokenizer"""]
  
  try:
   if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   __snake_case							      =						["""LlamaTokenizerFast"""]
  
  try:
   if not is_torch_available():
    raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
   pass
  else:
   __snake_case							      =						[
       """OpenLlamaForCausalLM""",
       """OpenLlamaModel""",
       """OpenLlamaPreTrainedModel""",
       """OpenLlamaForSequenceClassification""",
   ]
  
  
  if TYPE_CHECKING:
   from .configuration_open_llama import OPEN_LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP, OpenLlamaConfig
  
   try:
    if not is_sentencepiece_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from transformers import LlamaTokenizer
  
   try:
    if not is_tokenizers_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from transformers import LlamaTokenizerFast
  
   try:
    if not is_torch_available():
     raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
    pass
   else:
    from .modeling_open_llama import (
        OpenLlamaForCausalLM,
        OpenLlamaForSequenceClassification,
        OpenLlamaModel,
        OpenLlamaPreTrainedModel,
    )
  
  
  else:
   import sys
  
   __snake_case							      =						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
  
  
  
  
  
  