






from math import ceil






def 				lowerCamelCase__      (    __lowerCamelCase			:     Any  ,		__lowerCamelCase			:     str		):
  __UpperCAmelCase							:	Any           =  list(range(0  ,		__lowerCamelCase		)		)

  __UpperCAmelCase							:	List[Any]           =  [item for sublist in list(device_map.values()		) for item in sublist]

  # Duplicate check
  __UpperCAmelCase							:	Optional[int]           =  []
  for i in device_map_blocks:
    if device_map_blocks.count(__lowerCamelCase		) > 1 and i not in duplicate_blocks:
      duplicate_blocks.append(__lowerCamelCase		)
    # Missing blocks
  __UpperCAmelCase							:	Optional[int]           =  [i for i in blocks if i not in device_map_blocks]
  __UpperCAmelCase							:	Union[str, Any]           =  [i for i in device_map_blocks if i not in blocks]

  if len(__lowerCamelCase		) != 0:
    raise ValueError(
        """Duplicate attention blocks specified in device_map. Attention blocks must be specified to one device."""
        """ These attention blocks were specified more than once: """ + str(__lowerCamelCase		)		)
  if len(__lowerCamelCase		) != 0:
    raise ValueError(
        """There are attention blocks for this model that are not specified in the device_map. Add these attention """
        """blocks to a device on the device_map: """ + str(__lowerCamelCase		)		)
  if len(__lowerCamelCase		) != 0:
    raise ValueError(
        """The device_map contains more attention blocks than this model has. Remove these from the device_map:"""
        + str(__lowerCamelCase		)		)







def 				lowerCamelCase__      (    __lowerCamelCase			:     Tuple  ,		__lowerCamelCase			:     Optional[int]		):
  __UpperCAmelCase							:	List[str]           =  list(range(__lowerCamelCase		)		)
  __UpperCAmelCase							:	Dict           =  int(ceil(n_layers / len(__lowerCamelCase		)		)		)
  __UpperCAmelCase							:	Optional[Any]           =  [layers[i : i + n_blocks] for i in range(0  ,		__lowerCamelCase  ,		__lowerCamelCase		)]

  return dict(zip(__lowerCamelCase  ,		__lowerCamelCase		)		)










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

from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=lowercase__   )
class     a    ( lowercase__   ):



      """simple docstring"""


      a  : str							       =	field(default='automatic-speech-recognition'							,       metadata={'include_in_asdict_even_if_is_default': True}   )
      a  : ClassVar[Features]							       =	Features({'audio': Audio()}   )
      a  : ClassVar[Features]							       =	Features({'transcription': Value('string'   )}   )
      a  : str							       =	"audio"
      a  : str							       =	"transcription"
      def 	UpperCAmelCase      (      self					:			Optional[Any]		,      __lowercase					:			Optional[int]					)							->      str:
        if self.audio_column not in features:
          raise ValueError(f"""Column {self.audio_column} is not present in features."""					)
        if not isinstance(features[self.audio_column]		,      __lowercase					):
          raise ValueError(f"""Column {self.audio_column} is not an Audio type."""					)
        __UpperCAmelCase							:	int           =  copy.deepcopy(self					)
        __UpperCAmelCase							:	str           =  self.input_schema.copy()
        __UpperCAmelCase							:	List[str]           =  features[self.audio_column]
        __UpperCAmelCase							:	Optional[Any]           =  input_schema
        return task_template




      @property
      def 	UpperCAmelCase      (      self					:			Union[str, Any]					)							->      Dict[str, str]:
        return {self.audio_column: "audio", self.transcription_column: "transcription"}


