


from typing import Dict

from .base import GenericTensor, Pipeline


class   a__	(						lowerCAmelCase_    ):

       def 						UpperCAmelCase(   self      :     Dict      ,							lowerCamelCase_      :     Optional[int]=None      ,							lowerCamelCase_      :     Optional[int]=None      ,							lowerCamelCase_      :     Dict=None      ,							**lowerCamelCase_      :     Optional[int]    ):







            if tokenize_kwargs is None:
                 a_    :     List[str]										=    {}

            if truncation is not None:
                 if "truncation" in tokenize_kwargs:
                      raise ValueError(
                          """truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)"""    )
                 a_    :     str										=    truncation

            a_    :     Optional[Any]										=    tokenize_kwargs

            a_    :     Tuple										=    {}
            if return_tensors is not None:
                 a_    :     Union[str, Any]										=    return_tensors

            return preprocess_params, {}, postprocess_params

       def 						UpperCAmelCase(   self      :     Dict      ,							lowerCamelCase_      :     List[Any]      ,							**lowerCamelCase_      :     Tuple    ):
            a_    :     List[str]										=    self.framework
            a_    :     Dict										=    self.tokenizer(lowerCamelCase_      ,							return_tensors=lowerCamelCase_      ,							**lowerCamelCase_    )
            return model_inputs

       def 						UpperCAmelCase(   self      :     Optional[int]      ,							lowerCamelCase_      :     str    ):
            a_    :     Union[str, Any]										=    self.model(**lowerCamelCase_    )
            return model_outputs

       def 						UpperCAmelCase(   self      :     int      ,							lowerCamelCase_      :     Union[str, Any]      ,							lowerCamelCase_      :     Union[str, Any]=False    ):







            if return_tensors:
                 return model_outputs[0]
            if self.framework == "pt":
                 return model_outputs[0].tolist()
            elif self.framework == "tf":
                 return model_outputs[0].numpy().tolist()

       def __call__(   self      :     int      ,							*lowerCamelCase_      :     Optional[Any]      ,							**lowerCamelCase_      :     Any    ):
            return super().__call__(*lowerCamelCase_      ,							**lowerCamelCase_    )







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__lowerCamelCase        =     {
    '''configuration_altclip''': [
        '''ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AltCLIPConfig''',
        '''AltCLIPTextConfig''',
        '''AltCLIPVisionConfig''',
    ],
    '''processing_altclip''': ['''AltCLIPProcessor'''],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCamelCase        =     [
           '''ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
           '''AltCLIPPreTrainedModel''',
           '''AltCLIPModel''',
           '''AltCLIPTextModel''',
           '''AltCLIPVisionModel''',
       ]


if TYPE_CHECKING:
       from .configuration_altclip import (
           ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
           AltCLIPConfig,
           AltCLIPTextConfig,
           AltCLIPVisionConfig,
       )
       from .processing_altclip import AltCLIPProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_altclip import (
                  ALTCLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
                  AltCLIPModel,
                  AltCLIPPreTrainedModel,
                  AltCLIPTextModel,
                  AltCLIPVisionModel,
              )


else:
       import sys

       __lowerCamelCase        =     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



