





'''simple docstring'''


import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import ClassLabel, Features, Value
from .base import TaskTemplate






@dataclass(frozen=UpperCAmelCase_    )
class     lowerCAmelCase__ (				UpperCAmelCase_    ):

       '''simple docstring'''
       # `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
       _lowerCamelCase								=field(default="text-classification"      , metadata={"include_in_asdict_even_if_is_default": True}    )
       _lowerCamelCase								=Features({"text": Value("string"    )}    )
       _lowerCamelCase								=Features({"labels": ClassLabel}    )
       _lowerCamelCase								="text"
       _lowerCamelCase								="labels"

       def 			__snake_case      ( self					:				str       ,     a__					:				str						):
              if self.label_column not in features:
                     raise ValueError(f"Column {self.label_column} is not present in features."						)
              if not isinstance(features[self.label_column]       ,     a__						):
                     raise ValueError(f"Column {self.label_column} is not a ClassLabel."						)
              UpperCAmelCase  =						copy.deepcopy(self						)
              UpperCAmelCase  =						self.label_schema.copy()
              UpperCAmelCase  =						features[self.label_column]
              UpperCAmelCase  =						label_schema
              return task_template



       @property
       def 			__snake_case      ( self					:				Dict						):
              return {
                  self.text_column: "text",
                  self.label_column: "labels",
              }






'''simple docstring'''





from typing import TYPE_CHECKING

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


__lowerCamelCase												=						{
    '''configuration_maskformer''': ['''MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MaskFormerConfig'''],
    '''configuration_maskformer_swin''': ['''MaskFormerSwinConfig'''],
}

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase												=						['''MaskFormerFeatureExtractor''']
    __lowerCamelCase												=						['''MaskFormerImageProcessor''']


try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase												=						[
        '''MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''MaskFormerForInstanceSegmentation''',
        '''MaskFormerModel''',
        '''MaskFormerPreTrainedModel''',
    ]
    __lowerCamelCase												=						[
        '''MaskFormerSwinBackbone''',
        '''MaskFormerSwinModel''',
        '''MaskFormerSwinPreTrainedModel''',
    ]

if TYPE_CHECKING:
    from .configuration_maskformer import MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, MaskFormerConfig
    from .configuration_maskformer_swin import MaskFormerSwinConfig

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_maskformer import MaskFormerFeatureExtractor
        from .image_processing_maskformer import MaskFormerImageProcessor
    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_maskformer import (
            MASKFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            MaskFormerForInstanceSegmentation,
            MaskFormerModel,
            MaskFormerPreTrainedModel,
        )
        from .modeling_maskformer_swin import (
            MaskFormerSwinBackbone,
            MaskFormerSwinModel,
            MaskFormerSwinPreTrainedModel,
        )


else:
    import sys

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



