



from argparse import ArgumentParser

from . import BaseTransformersCLICommand

def    A_  (							a  ):

      """simple docstring"""



      return DownloadCommand(args.model					,   args.cache_dir					,   args.force					,   args.trust_remote_code  )



class  _A		(  __magic_name__):

  @staticmethod
  def  UpperCAmelCase    (				_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_				:  List[Any]           =     parser.add_parser('download'					)
        download_parser.add_argument(
            '--cache-dir' ,					type=_SCREAMING_SNAKE_CASE ,					default=_SCREAMING_SNAKE_CASE ,					help='Path to location to store the models'					)
        download_parser.add_argument(
            '--force' ,					action='store_true' ,					help='Force the model to be download even if already in cache-dir'					)
        download_parser.add_argument(
            '--trust-remote-code' ,					action='store_true' ,					help='Whether or not to allow for custom models defined on the Hub in their own modeling files. Use only if you\'ve reviewed the code as it will execute on your local machine' ,					)
        download_parser.add_argument('model' ,					type=_SCREAMING_SNAKE_CASE ,					help='Name of the model to download'					)
        download_parser.set_defaults(func=_SCREAMING_SNAKE_CASE					)

  def __init__(				self ,					_SCREAMING_SNAKE_CASE ,					_SCREAMING_SNAKE_CASE ,					_SCREAMING_SNAKE_CASE ,					_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     model
        SCREAMING_SNAKE_CASE_				:  Any           =     cache
        SCREAMING_SNAKE_CASE_				:  Any           =     force
        SCREAMING_SNAKE_CASE_				:  List[str]           =     trust_remote_code



  def  UpperCAmelCase    (				self					):





        """simple docstring"""







        from ..models.auto import AutoModel, AutoTokenizer

        AutoModel.from_pretrained(
            self._model ,					cache_dir=self._cache ,					force_download=self._force ,					trust_remote_code=self._trust_remote_code					)
        AutoTokenizer.from_pretrained(
            self._model ,					cache_dir=self._cache ,					force_download=self._force ,					trust_remote_code=self._trust_remote_code					)









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

from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=__magic_name__)
class  _A		(  __magic_name__):
  SCREAMING_SNAKE_CASE    :      str       =  field(default='''automatic-speech-recognition'''   ,     metadata={'''include_in_asdict_even_if_is_default''': True})
  SCREAMING_SNAKE_CASE    :      ClassVar[Features]       =  Features({'''audio''': Audio()})
  SCREAMING_SNAKE_CASE    :      ClassVar[Features]       =  Features({'''transcription''': Value('''string''')})
  SCREAMING_SNAKE_CASE    :      str       =  "audio"
  SCREAMING_SNAKE_CASE    :      str       =  "transcription"

  def  UpperCAmelCase    (				self ,					_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        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] ,					_SCREAMING_SNAKE_CASE					):
              raise ValueError(f"Column {self.audio_column} is not an Audio type."					)
        SCREAMING_SNAKE_CASE_				:  int           =     copy.deepcopy(self					)
        SCREAMING_SNAKE_CASE_				:  int           =     self.input_schema.copy()
        SCREAMING_SNAKE_CASE_				:  List[Any]           =     features[self.audio_column]
        SCREAMING_SNAKE_CASE_				:  List[str]           =     input_schema
        return task_template



  @property
  def  UpperCAmelCase    (				self					):





        """simple docstring"""







        return {self.audio_column: "audio", self.transcription_column: "transcription"}






