class_docstr: Model Card Metadata that is used by Hugging Face Hub when included at the top of your README.md
  
  Args:
      language (`Union[str, List[str]]`, *optional*):
          Language of model's training data or metadata. It must be an ISO 639-1, 639-2 or
          639-3 code (two/three letters), or a special value like "code", "multilingual". Defaults to `None`.
      license (`str`, *optional*):
          License of this model. Example: apache-2.0 or any license from
          https://huggingface.co/docs/hub/repositories-licenses. Defaults to None.
      library_name (`str`, *optional*):
          Name of library used by this model. Example: keras or any library from
          https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/model-libraries.ts.
          Defaults to None.
      tags (`List[str]`, *optional*):
          List of tags to add to your model that can be used when filtering on the Hugging
          Face Hub. Defaults to None.
      base_model (`str` or `List[str]`, *optional*):
          The identifier of the base model from which the model derives. This is applicable for example if your model is a
          fine-tune or adapter of an existing model. The value must be the ID of a model on the Hub (or a list of IDs
          if your model derives from multiple models). Defaults to None.
      datasets (`List[str]`, *optional*):
          List of datasets that were used to train this model. Should be a dataset ID
          found on https://hf.co/datasets. Defaults to None.
      metrics (`List[str]`, *optional*):
          List of metrics used to evaluate this model. Should be a metric name that can be found
          at https://hf.co/metrics. Example: 'accuracy'. Defaults to None.
      eval_results (`Union[List[EvalResult], EvalResult]`, *optional*):
          List of `huggingface_hub.EvalResult` that define evaluation results of the model. If provided,
          `model_name` is used to as a name on PapersWithCode's leaderboards. Defaults to `None`.
      model_name (`str`, *optional*):
          A name for this model. It is used along with
          `eval_results` to construct the `model-index` within the card's metadata. The name
          you supply here is what will be used on PapersWithCode's leaderboards. If None is provided
          then the repo name is used as a default. Defaults to None.
      ignore_metadata_errors (`str`):
          If True, errors while parsing the metadata section will be ignored. Some information might be lost during
          the process. Use it at your own risk.
      kwargs (`dict`, *optional*):
          Additional metadata that will be added to the model card. Defaults to None.
  
  Example:
      ```python
      >>> from huggingface_hub import ModelCardData
      >>> card_data = ModelCardData(
      ...     language="en",
      ...     license="mit",
      ...     library_name="timm",
      ...     tags=['image-classification', 'resnet'],
      ... )
      >>> card_data.to_dict()
      {'language': 'en', 'license': 'mit', 'library_name': 'timm', 'tags': ['image-classification', 'resnet']}
  
      ```
class_docstr_tok: ["Model","Card","Metadata","that","is","used","by","Hugging","Face","Hub","when","included","at","the","top","of","your","README.md","Args",":","language","(","`","Union","[","str",",","List","[","str","]","]","`",",","*","optional","*",")",":","Language","of","model","'s","training","data","or","metadata",".","It","must","be","an","ISO","639-1",",","639-2","or","639-3","code","(","two\/three","letters",")",",","or","a","special","value","like","``","code","''",",","``","multilingual","''",".","Defaults","to","`","None","`",".","license","(","`","str","`",",","*","optional","*",")",":","License","of","this","model",".","Example",":","apache-2.0","or","any","license","from","https",":","\/\/huggingface.co\/docs\/hub\/repositories-licenses",".","Defaults","to","None",".","library_name","(","`","str","`",",","*","optional","*",")",":","Name","of","library","used","by","this","model",".","Example",":","keras","or","any","library","from","https",":","\/\/github.com\/huggingface\/huggingface.js\/blob\/main\/packages\/tasks\/src\/model-libraries.ts",".","Defaults","to","None",".","tags","(","`","List","[","str","]","`",",","*","optional","*",")",":","List","of","tags","to","add","to","your","model","that","can","be","used","when","filtering","on","the","Hugging","Face","Hub",".","Defaults","to","None",".","base_model","(","`","str","`","or","`","List","[","str","]","`",",","*","optional","*",")",":","The","identifier","of","the","base","model","from","which","the","model","derives",".","This","is","applicable","for","example","if","your","model","is","a","fine-tune","or","adapter","of","an","existing","model",".","The","value","must","be","the","ID","of","a","model","on","the","Hub","(","or","a","list","of","IDs","if","your","model","derives","from","multiple","models",")",".","Defaults","to","None",".","datasets","(","`","List","[","str","]","`",",","*","optional","*",")",":","List","of","datasets","that","were","used","to","train","this","model",".","Should","be","a","dataset","ID","found","on","https",":","\/\/hf.co\/datasets",".","Defaults","to","None",".","metrics","(","`","List","[","str","]","`",",","*","optional","*",")",":","List","of","metrics","used","to","evaluate","this","model",".","Should","be","a","metric","name","that","can","be","found","at","https",":","\/\/hf.co\/metrics",".","Example",":","'accuracy","'",".","Defaults","to","None",".","eval_results","(","`","Union","[","List","[","EvalResult","]",",","EvalResult","]","`",",","*","optional","*",")",":","List","of","`","huggingface_hub.EvalResult","`","that","define","evaluation","results","of","the","model",".","If","provided",",","`","model_name","`","is","used","to","as","a","name","on","PapersWithCode","'s","leaderboards",".","Defaults","to","`","None","`",".","model_name","(","`","str","`",",","*","optional","*",")",":","A","name","for","this","model",".","It","is","used","along","with","`","eval_results","`","to","construct","the","`","model-index","`","within","the","card","'s","metadata",".","The","name","you","supply","here","is","what","will","be","used","on","PapersWithCode","'s","leaderboards",".","If","None","is","provided","then","the","repo","name","is","used","as","a","default",".","Defaults","to","None",".","ignore_metadata_errors","(","`","str","`",")",":","If","True",",","errors","while","parsing","the","metadata","section","will","be","ignored",".","Some","information","might","be","lost","during","the","process",".","Use","it","at","your","own","risk",".","kwargs","(","`","dict","`",",","*","optional","*",")",":","Additional","metadata","that","will","be","added","to","the","model","card",".","Defaults","to","None",".","Example",":","``","`","python",">",">",">","from","huggingface_hub","import","ModelCardData",">",">",">","card_data","=","ModelCardData","(","...","language=","''","en","''",",","...","license=","''","mit","''",",","...","library_name=","''","timm","''",",","...","tags=","[","'image-classification","'",",","'resnet","'","]",",","...",")",">",">",">","card_data.to_dict","(",")","{","'language","'",":","'en","'",",","'license","'",":","'mit","'",",","'library_name","'",":","'timm","'",",","'tags","'",":","[","'image-classification","'",",","'resnet","'","]","}","``","`"]
code: def __init__(
      self,
      *,
      language: Optional[Union[str, List[str]]] = None,
      license: Optional[str] = None,
      library_name: Optional[str] = None,
      tags: Optional[List[str]] = None,
      base_model: Optional[Union[str, List[str]]] = None,
      datasets: Optional[List[str]] = None,
      metrics: Optional[List[str]] = None,
      eval_results: Optional[List[EvalResult]] = None,
      model_name: Optional[str] = None,
      ignore_metadata_errors: bool = False,
      **kwargs,
  ):
      self.language = language
      self.license = license
      self.library_name = library_name
      self.tags = tags
      self.base_model = base_model
      self.datasets = datasets
      self.metrics = metrics
      self.eval_results = eval_results
      self.model_name = model_name
  
      model_index = kwargs.pop("model-index", None)
      if model_index:
          try:
              model_name, eval_results = model_index_to_eval_results(
                  model_index
              )
              self.model_name = model_name
              self.eval_results = eval_results
          except (KeyError, TypeError) as error:
              if ignore_metadata_errors:
                  logger.warning(
                      "Invalid model-index. Not loading eval results into CardData."
                  )
              else:
                  raise ValueError(
                      f"Invalid `model_index` in metadata cannot be parsed: {error.__class__} {error}. Pass"
                      " `ignore_metadata_errors=True` to ignore this error while loading a Model Card. Warning:"
                      " some information will be lost. Use it at your own risk."
                  )
  
      super().__init__(**kwargs)
  
      if self.eval_results:
          if type(self.eval_results) == EvalResult:
              self.eval_results = [self.eval_results]
          if self.model_name is None:
              raise ValueError(
                  "Passing `eval_results` requires `model_name` to be set."
              )
  
imports: import copy
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Union
  from huggingface_hub.utils import logging, yaml_dump
label_desc: Use image node_id 1 to create a new ModelCardData object from inherited base classes: CardData with example: obj = ModelCardData()