ó
    pyüiW„  ã            	       ó¤  • S SK r S SKJr  S SKJr  S SKJr  S SKJrJ	r	  \R                  " \5      r\ " S S5      5       r\ " S S	5      5       rS
\\\   -  S-  S\S-  S\\   4S jr " S S\5      r " S S\5      r " S S\5      rS\\\\4      S\\\\   4   4S jrS rS\S
\\   S\\\\4      4S jrS\\   S-  S\\   S-  4S jrg)é    N)Údefaultdict)Ú	dataclass)ÚAny)ÚloggingÚ	yaml_dumpc                   ó„  • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   \\S'   Sr\S-  \S	'   Sr	\S-  \S
'   Sr
\S-  \S'   Sr\S-  \S'   Sr\\\4   S-  \S'   Sr\S-  \S'   Sr\S-  \S'   Sr\\\4   S-  \S'   Sr\S-  \S'   Sr\S-  \S'   Sr\S-  \S'   Sr\S-  \S'   \S\4S j5       rSS S\4S jrSS jrSrg)Ú
EvalResulté   uC  
Flattened representation of individual evaluation results found in model-index of Model Cards.

For more information on the model-index spec, see https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1.

Args:
    task_type (`str`):
        The task identifier. Example: "image-classification".
    dataset_type (`str`):
        The dataset identifier. Example: "common_voice". Use dataset id from https://hf.co/datasets.
    dataset_name (`str`):
        A pretty name for the dataset. Example: "Common Voice (French)".
    metric_type (`str`):
        The metric identifier. Example: "wer". Use metric id from https://hf.co/metrics.
    metric_value (`Any`):
        The metric value. Example: 0.9 or "20.0 Â± 1.2".
    task_name (`str`, *optional*):
        A pretty name for the task. Example: "Speech Recognition".
    dataset_config (`str`, *optional*):
        The name of the dataset configuration used in `load_dataset()`.
        Example: fr in `load_dataset("common_voice", "fr")`. See the `datasets` docs for more info:
        https://hf.co/docs/datasets/package_reference/loading_methods#datasets.load_dataset.name
    dataset_split (`str`, *optional*):
        The split used in `load_dataset()`. Example: "test".
    dataset_revision (`str`, *optional*):
        The revision (AKA Git Sha) of the dataset used in `load_dataset()`.
        Example: 5503434ddd753f426f4b38109466949a1217c2bb
    dataset_args (`dict[str, Any]`, *optional*):
        The arguments passed during `Metric.compute()`. Example for `bleu`: `{"max_order": 4}`
    metric_name (`str`, *optional*):
        A pretty name for the metric. Example: "Test WER".
    metric_config (`str`, *optional*):
        The name of the metric configuration used in `load_metric()`.
        Example: bleurt-large-512 in `load_metric("bleurt", "bleurt-large-512")`.
        See the `datasets` docs for more info: https://huggingface.co/docs/datasets/v2.1.0/en/loading#load-configurations
    metric_args (`dict[str, Any]`, *optional*):
        The arguments passed during `Metric.compute()`. Example for `bleu`: max_order: 4
    verified (`bool`, *optional*):
        Indicates whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not. Automatically computed by Hugging Face, do not set.
    verify_token (`str`, *optional*):
        A JSON Web Token that is used to verify whether the metrics originate from Hugging Face's [evaluation service](https://huggingface.co/spaces/autoevaluate/model-evaluator) or not.
    source_name (`str`, *optional*):
        The name of the source of the evaluation result. Example: "Open LLM Leaderboard".
    source_url (`str`, *optional*):
        The URL of the source of the evaluation result. Example: "https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard".
Ú	task_typeÚdataset_typeÚdataset_nameÚmetric_typeÚmetric_valueNÚ	task_nameÚdataset_configÚdataset_splitÚdataset_revisionÚdataset_argsÚmetric_nameÚmetric_configÚmetric_argsÚverifiedÚverify_tokenÚsource_nameÚ
source_urlÚreturnc                 ót   • U R                   U R                  U R                  U R                  U R                  4$ )z9Returns a tuple that uniquely identifies this evaluation.)r   r   r   r   r   ©Úselfs    ÚZ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/huggingface_hub/repocard_data.pyÚunique_identifierÚEvalResult.unique_identifier†   s9   € ð �N‰NØ×ÑØ×ÑØ×ÑØ×!Ñ!ð
ð 	
ó    Úotherc                 óž   • U R                   R                  5        H/  u  p#US:X  a  M  US:w  d  M  [        X5      [        X5      :w  d  M/    g   g)z`
Return True if `self` and `other` describe exactly the same metric but with a
different value.
r   r   FT)Ú__dict__ÚitemsÚgetattr)r   r$   ÚkeyÚ_s       r    Úis_equal_except_valueÚ EvalResult.is_equal_except_value‘   sK   € ð
 —m‘m×)Ñ)Ö+‰FˆCØ�nÓ$Ùð �nÕ$¬°Ó);¼wÀuÓ?RÕ)RÙñ ,ð r#   c                 óP   • U R                   b  U R                  c  [        S5      eg g )NzAIf `source_name` is provided, `source_url` must also be provided.)r   r   Ú
ValueErrorr   s    r    Ú__post_init__ÚEvalResult.__post_init__Ÿ   s,   € Ø×ÑÑ'¨D¯O©OÑ,CÜÐ`ÓaÐað -DÐ'r#   © )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚstrÚ__annotations__r   r   r   r   r   r   Údictr   r   r   r   Úboolr   r   r   ÚpropertyÚtupler!   r+   r/   Ú__static_attributes__r1   r#   r    r	   r	      s4  ‡ ñ-ðf ƒNð Óð Óð Óð Óð !€Iˆs�T‰zÓ ð "&€N�C˜$‘JÓ%ð !%€M�3˜‘:Ó$ð $(Ð�c˜D‘jÓ'ð +/€L�$�s˜C�x‘. 4Ñ'Ó.ð #€K��t‘Ó"ð
 !%€M�3˜‘:Ó$ð *.€K��c˜3�h‘ $Ñ&Ó-ð !€Hˆd�T‰kÓ ð  $€L�#˜‘*Ó#ð #€K��t‘Ó"ð "€J��d‘
Ó!àð
 5ó 
ó ð
ð¨<ð ¸Dô ÷br#   r	   c                   óà   • \ rS rSrSrSS\4S jjrS rS rSS\	\
   S-  S	\
4S
 jjrS rS rSS\
S\S	\4S jjrSS\
S\S	\4S jjrS\
S	\4S jrS\
S\S	S4S jrS\
S	\4S jrS	\4S jrSrg)ÚCardDataé¤   a’  Structure containing metadata from a RepoCard.

[`CardData`] is the parent class of [`ModelCardData`] and [`DatasetCardData`].

Metadata can be exported as a dictionary or YAML. Export can be customized to alter the representation of the data
(example: flatten evaluation results). `CardData` behaves as a dictionary (can get, pop, set values) but do not
inherit from `dict` to allow this export step.
Úignore_metadata_errorsc                 ó:   • U R                   R                  U5        g ©N)r&   Úupdate)r   rA   Úkwargss      r    Ú__init__ÚCardData.__init__¯   s   € Ø�‰×Ñ˜VÕ$r#   c                 óÄ   • [         R                  " U R                  5      nU R                  U5        UR	                  5        VVs0 s H  u  p#Uc  M
  X#_M     snn$ s  snnf )z¢Converts CardData to a dict.

Returns:
    `dict`: CardData represented as a dictionary ready to be dumped to a YAML
    block for inclusion in a README.md file.
)ÚcopyÚdeepcopyr&   Ú_to_dictr'   )r   Ú	data_dictr)   Úvalues       r    Úto_dictÚCardData.to_dict²   sK   € ô —M’M $§-¡-Ó0ˆ	Ø�‰�iÔ Ø-6¯_©_Ô->ÔTÒ->™z˜sÀ%“
�’
Ñ->ÒTÐTùÓTs   Á	AÁAc                 ó   • g)zµUse this method in child classes to alter the dict representation of the data. Alter the dict in-place.

Args:
    data_dict (`dict`): The raw dict representation of the card data.
Nr1   ©r   rL   s     r    rK   ÚCardData._to_dict¾   s   € ð 	r#   NÚoriginal_orderr   c                 óF  • U(       ao  U[        [        U R                  R                  5       5      [        U5      -
  5      -    Vs0 s H#  nX0R                  ;   d  M  X0R                  U   _M%     snU l        [	        U R                  5       SUS9R                  5       $ s  snf )zÚDumps CardData to a YAML block for inclusion in a README.md file.

Args:
    line_break (str, *optional*):
        The line break to use when dumping to yaml.

Returns:
    `str`: CardData represented as a YAML block.
F)Ú	sort_keysÚ
line_break)ÚlistÚsetr&   Úkeysr   rN   Ústrip)r   rV   rS   Úks       r    Úto_yamlÚCardData.to_yamlÆ   s‹   € ö ð (¬$¬s°4·=±=×3EÑ3EÓ3GÓ/HÌ3È~ÓK^Ñ/^Ó*_Ò_óâ_�AØŸ™Ñ%ó $�—=‘= Ñ#Ò#Ù_ñˆDŒMô
 ˜Ÿ™›°5ÀZÑP×VÑVÓXÐXùòs   ÁBÁBc                 ó,   • [        U R                  5      $ rC   )Úreprr&   r   s    r    Ú__repr__ÚCardData.__repr__Ø   s   € Ü�D—M‘MÓ"Ð"r#   c                 ó"   • U R                  5       $ rC   )r\   r   s    r    Ú__str__ÚCardData.__str__Û   s   € Ø�|‰|‹~Ðr#   r)   Údefaultc                 óF   • U R                   R                  U5      nUc  U$ U$ ©z#Get value for a given metadata key.)r&   Úget)r   r)   re   rM   s       r    rh   ÚCardData.getÞ   s%   € à—‘×!Ñ! #Ó&ˆØ™-ˆwÐ2¨UÐ2r#   c                 ó8   • U R                   R                  X5      $ )z#Pop value for a given metadata key.)r&   Úpop)r   r)   re   s      r    rk   ÚCardData.popã   s   € à�}‰}× Ñ  Ó.Ð.r#   c                 ó    • U R                   U   $ rg   ©r&   ©r   r)   s     r    Ú__getitem__ÚCardData.__getitem__ç   s   € à�}‰}˜SÑ!Ð!r#   rM   c                 ó    • X R                   U'   g)z#Set value for a given metadata key.Nrn   )r   r)   rM   s      r    Ú__setitem__ÚCardData.__setitem__ë   s   € à"�‰�cÒr#   c                 ó   • XR                   ;   $ )z%Check if a given metadata key is set.rn   ro   s     r    Ú__contains__ÚCardData.__contains__ï   s   € à—m‘mÑ#Ð#r#   c                 ó,   • [        U R                  5      $ )z'Return the number of metadata keys set.)Úlenr&   r   s    r    Ú__len__ÚCardData.__len__ó   s   € ä�4—=‘=Ó!Ð!r#   rn   )F)NNrC   )r2   r3   r4   r5   r6   r:   rF   rN   rK   rW   r7   r\   r`   rc   r   rh   rk   rp   rs   rv   Úintrz   r=   r1   r#   r    r?   r?   ¤   sÈ   † ññ%¨tõ %ò
UòñY°t¸C±yÀ4Ñ7Gð YÐSVõ Yò$#òñ3�sð 3 Sð 3°Cõ 3ñ
/�sð / Sð /°Cõ /ð"˜sð " sô "ð#˜sð #¨3ð #°4ô #ð$ ð $¨ô $ð"˜÷ "r#   r?   Úeval_resultsÚ
model_namer   c                 óä   • U c  / $ [        U [        5      (       a  U /n [        U [        5      (       a  [        S U  5       5      (       d  [	        S[        U 5       S35      eUc  [	        S5      eU $ )Nc              3   óB   #   • U  H  n[        U[        5      v •  M     g 7frC   )Ú
isinstancer	   )Ú.0Úrs     r    Ú	<genexpr>Ú)_validate_eval_results.<locals>.<genexpr>   s   é € Ð4eÒXdÐST´ZÀÄ:×5NÐ5NÒXdùs   ‚zM`eval_results` should be of type `EvalResult` or a list of `EvalResult`, got Ú.z7Passing `eval_results` requires `model_name` to be set.)r�   r	   rW   Úallr.   Útype)r}   r~   s     r    Ú_validate_eval_resultsr‰   ø   s}   € ð ÑØˆ	Ü�,¤
×+Ñ+Ø$�~ˆÜ�l¤D×)Ñ)´Ñ4eÑXdÓ4e×1eÑ1eÜØ[Ô\`ÐamÓ\nÐ[oÐopÐqó
ð 	
ð ÑÜÐRÓSÐSØÐr#   c                   ó  ^ • \ rS rSrSrSSSSSSSSSSSSSS.S\\\   -  S-  S\\\   -  S-  S\\   S-  S	\\\   -  S-  S
\S-  S\S-  S\S-  S\S-  S\\   S-  S\S-  S\S-  S\\   S-  S\4U 4S jjjr	S r
SrU =r$ )ÚModelCardDatai	  ai  Model Card Metadata that is used by Hugging Face Hub when included at the top of your README.md

Args:
    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 (`Union[str, list[str]]`, *optional*):
        Dataset or list of datasets that were used to train this model. Should be a dataset ID
        found on https://hf.co/datasets. 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`.
    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`.
    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.
    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.
    license_name (`str`, *optional*):
        Name of the license of this model. Defaults to None. To be used in conjunction with `license_link`.
        Common licenses (Apache-2.0, MIT, CC-BY-SA-4.0) do not need a name. In that case, use `license` instead.
    license_link (`str`, *optional*):
        Link to the license of this model. Defaults to None. To be used in conjunction with `license_name`.
        Common licenses (Apache-2.0, MIT, CC-BY-SA-4.0) do not need a link. In that case, use `license` instead.
    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.
    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.
    pipeline_tag (`str`, *optional*):
        The pipeline tag associated with the model. Example: "text-classification".
    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.
    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']}

    ```
NF)Ú
base_modelÚdatasetsr}   ÚlanguageÚlibrary_nameÚlicenseÚlicense_nameÚlicense_linkÚmetricsr~   Úpipeline_tagÚtagsrA   rŒ   r�   r}   rŽ   r�   r�   r‘   r’   r“   r~   r”   r•   rA   c                óÖ  >• Xl         X l        X0l        X@l        XPl        X`l        Xpl        X€l        X�l        X l	        X°l
        [        U5      U l        UR                  SS 5      nU(       a   [        U5      u  p£X l	        X0l        [*        TU ]X  " S0 UD6  U R                  (       a'   [/        U R                  U R                  5      U l        g g ! [        [         4 aB  nU(       a  ["        R%                  S5         S nANz['        SUR(                   SU S35      eS nAff = f! [0         a9  nU(       a  ["        R%                  SU S35         S nAg ['        SU 35      UeS nAff = f)	Númodel-indexz<Invalid model-index. Not loading eval results into CardData.z4Invalid `model_index` in metadata cannot be parsed: Ú z–. 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.z!Failed to validate eval_results: z). Not loading eval results into CardData.r1   )rŒ   r�   r}   rŽ   r�   r�   r‘   r’   r“   r~   r”   Ú_to_unique_listr•   rk   Úmodel_index_to_eval_resultsÚKeyErrorÚ	TypeErrorÚloggerÚwarningr.   Ú	__class__ÚsuperrF   r‰   Ú	Exception)r   rŒ   r�   r}   rŽ   r�   r�   r‘   r’   r“   r~   r”   r•   rA   rE   Úmodel_indexÚerrorÚerŸ   s                     €r    rF   ÚModelCardData.__init__I  s[  ø€ ð$ %ŒØ ŒØ(ÔØ ŒØ(ÔØŒØ(ÔØ(ÔØŒØ$ŒØ(ÔÜ# DÓ)ˆŒ	à—j‘j °Ó5ˆÞðÜ+FÀ{Ó+SÑ(�
Ø",”Ø$0Ô!ô 	‰ÒÑ"˜6Ò"à××ðUÜ$:¸4×;LÑ;LÈdÏoÉoÓ$^�Õ!ð øô œiÐ(ó Þ)Ü—N‘NÐ#a×bÑbä$ØNÈuÏÉÐN_Ð_`ÐafÐ`gð hSð Sóð ûð	ûô ó UÞ)Ü—N‘NÐ%FÀqÀcÐIrÐ#s×tÑtä$Ð'HÈÈÐ%LÓMÐSTÐTûð	Uús<   Á.C Â)%D% ÃD"Ã DÄDÄD"Ä%
E(Ä/ E#ÅE#Å#E(c                 ór   • U R                   b*  [        U R                  U R                   5      US'   US	 US	 gg)z[Format the internal data dict. In this case, we convert eval results to a valid model indexNr—   r}   r~   )r}   Úeval_results_to_model_indexr~   rQ   s     r    rK   ÚModelCardData._to_dictƒ  s>   € à×ÑÑ(Ü'BÀ4Ç?Á?ÐTX×TeÑTeÓ'fˆI�mÑ$Ø˜.Ð)¨9°\Ñ+Bð )r#   )rŒ   r�   r}   rŽ   r�   r�   r’   r‘   r“   r~   r”   r•   )r2   r3   r4   r5   r6   r7   rW   r	   r:   rF   rK   r=   Ú__classcell__©rŸ   s   @r    r‹   r‹   	  s5  ø† ñ=ðD .2Ø+/Ø04Ø+/Ø#'Ø"Ø#'Ø#'Ø$(Ø!%Ø#'Ø!%Ø',ò8Uð ˜$˜s™)‘O dÑ*ð8Uð ˜˜S™	‘/ DÑ(ð	8Uð
 ˜:Ñ&¨Ñ-ð8Uð ˜˜S™	‘/ DÑ(ð8Uð ˜D‘jð8Uð �t‘ð8Uð ˜D‘jð8Uð ˜D‘jð8Uð �c‘˜TÑ!ð8Uð ˜$‘Jð8Uð ˜D‘jð8Uð �3‰i˜$Ñð8Uð !%÷8Uð 8U÷tCð Cr#   r‹   c                   óP  ^ • \ rS rSrSrSSSSSSSSSSSSSSS.S\\\   -  S-  S\\\   -  S-  S\\\   -  S-  S	\\\   -  S-  S
\\\   -  S-  S\\\   -  S-  S\\   S-  S\\\   -  S-  S\\\   -  S-  S\S-  S\S-  S\S-  S\\\   -  S-  S\4U 4S jjjr	S r
SrU =r$ )ÚDatasetCardDataiŠ  aG	  Dataset Card Metadata that is used by Hugging Face Hub when included at the top of your README.md

Args:
    language (`list[str]`, *optional*):
        Language of dataset's 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".
    license (`Union[str, list[str]]`, *optional*):
        License(s) of this dataset. Example: apache-2.0 or any license from
        https://huggingface.co/docs/hub/repositories-licenses.
    annotations_creators (`Union[str, list[str]]`, *optional*):
        How the annotations for the dataset were created.
        Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'no-annotation', 'other'.
    language_creators (`Union[str, list[str]]`, *optional*):
        How the text-based data in the dataset was created.
        Options are: 'found', 'crowdsourced', 'expert-generated', 'machine-generated', 'other'
    multilinguality (`Union[str, list[str]]`, *optional*):
        Whether the dataset is multilingual.
        Options are: 'monolingual', 'multilingual', 'translation', 'other'.
    size_categories (`Union[str, list[str]]`, *optional*):
        The number of examples in the dataset. Options are: 'n<1K', '1K<n<10K', '10K<n<100K',
        '100K<n<1M', '1M<n<10M', '10M<n<100M', '100M<n<1B', '1B<n<10B', '10B<n<100B', '100B<n<1T', 'n>1T', and 'other'.
    source_datasets (`list[str]]`, *optional*):
        Indicates whether the dataset is an original dataset or extended from another existing dataset.
        Options are: 'original' and 'extended'.
    task_categories (`Union[str, list[str]]`, *optional*):
        What categories of task does the dataset support?
    task_ids (`Union[str, list[str]]`, *optional*):
        What specific tasks does the dataset support?
    paperswithcode_id (`str`, *optional*):
        ID of the dataset on PapersWithCode.
    pretty_name (`str`, *optional*):
        A more human-readable name for the dataset. (ex. "Cats vs. Dogs")
    train_eval_index (`dict`, *optional*):
        A dictionary that describes the necessary spec for doing evaluation on the Hub.
        If not provided, it will be gathered from the 'train-eval-index' key of the kwargs.
    config_names (`Union[str, list[str]]`, *optional*):
        A list of the available dataset configs for the dataset.
NF)rŽ   r�   Úannotations_creatorsÚlanguage_creatorsÚmultilingualityÚsize_categoriesÚsource_datasetsÚtask_categoriesÚtask_idsÚpaperswithcode_idÚpretty_nameÚtrain_eval_indexÚconfig_namesrA   rŽ   r�   r­   r®   r¯   r°   r±   r²   r³   r´   rµ   r¶   r·   rA   c                óö   >• X0l         X@l        Xl        X l        XPl        X`l        Xpl        X€l        X�l        X l	        X°l
        XÐl        U=(       d    UR                  SS 5      U l        [        TU ]<  " S0 UD6  g )Nútrain-eval-indexr1   )r­   r®   rŽ   r�   r¯   r°   r±   r²   r³   r´   rµ   r·   rk   r¶   r    rF   )r   rŽ   r�   r­   r®   r¯   r°   r±   r²   r³   r´   rµ   r¶   r·   rA   rE   rŸ   s                   €r    rF   ÚDatasetCardData.__init__²  sv   ø€ ð& %9Ô!Ø!2ÔØ ŒØŒØ.ÔØ.ÔØ.ÔØ.ÔØ ŒØ!2ÔØ&ÔØ(Ôð !1× X°F·J±JÐ?QÐSWÓ4XˆÔÜ‰ÒÑ"˜6Ó"r#   c                 ó,   • UR                  S5      US'   g )Nr¶   r¹   )rk   rQ   s     r    rK   ÚDatasetCardData._to_dictÖ  s   € Ø(1¯©Ð6HÓ(Iˆ	Ð$Ò%r#   )r­   r·   rŽ   r®   r�   r¯   r´   rµ   r°   r±   r²   r³   r¶   )r2   r3   r4   r5   r6   r7   rW   r9   r:   rF   rK   r=   r©   rª   s   @r    r¬   r¬   Š  sb  ø† ñ%ðT ,0Ø*.Ø7;Ø48Ø26Ø26Ø,0Ø26Ø+/Ø(,Ø"&Ø(,Ø/3Ø',ò!"#ð ˜˜S™	‘/ DÑ(ð"#ð �t˜C‘y‘ 4Ñ'ð	"#ð
 " D¨¡I™o°Ñ4ð"#ð   c¡™?¨TÑ1ð"#ð ˜t C™y™¨4Ñ/ð"#ð ˜t C™y™¨4Ñ/ð"#ð ˜c™ TÑ)ð"#ð ˜t C™y™¨4Ñ/ð"#ð ˜˜S™	‘/ DÑ(ð"#ð  ™:ð"#ð ˜4‘Zð"#ð  ™+ð"#ð ˜D ™I‘o¨Ñ,ð"#ð  !%÷!"#ð "#÷HJð Jr#   r¬   c                   óÒ   ^ • \ rS rSrSrSSSSSSSSSSSSS.S\S-  S\S-  S\S-  S	\S-  S
\S-  S\S-  S\S-  S\S-  S\\   S-  S\\   S-  S\\   S-  S\4U 4S jjjr	Sr
U =r$ )ÚSpaceCardDataiÚ  a8	  Space Card Metadata that is used by Hugging Face Hub when included at the top of your README.md

To get an exhaustive reference of Spaces configuration, please visit https://huggingface.co/docs/hub/spaces-config-reference#spaces-configuration-reference.

Args:
    title (`str`, *optional*)
        Title of the Space.
    sdk (`str`, *optional*)
        SDK of the Space (one of `gradio`, `streamlit`, `docker`, or `static`).
    sdk_version (`str`, *optional*)
        Version of the used SDK (if Gradio/Streamlit sdk).
    python_version (`str`, *optional*)
        Python version used in the Space (if Gradio/Streamlit sdk).
    app_file (`str`, *optional*)
        Path to your main application file (which contains either gradio or streamlit Python code, or static html code).
        Path is relative to the root of the repository.
    app_port (`str`, *optional*)
        Port on which your application is running. Used only if sdk is `docker`.
    license (`str`, *optional*)
        License of this model. Example: apache-2.0 or any license from
        https://huggingface.co/docs/hub/repositories-licenses.
    duplicated_from (`str`, *optional*)
        ID of the original Space if this is a duplicated Space.
    models (list[`str`], *optional*)
        List of models related to this Space. Should be a dataset ID found on https://hf.co/models.
    datasets (`list[str]`, *optional*)
        List of datasets related to this Space. Should be a dataset ID found on https://hf.co/datasets.
    tags (`list[str]`, *optional*)
        List of tags to add to your Space that can be used when filtering on the Hub.
    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 space card.

Example:
    ```python
    >>> from huggingface_hub import SpaceCardData
    >>> card_data = SpaceCardData(
    ...     title="Dreambooth Training",
    ...     license="mit",
    ...     sdk="gradio",
    ...     duplicated_from="multimodalart/dreambooth-training"
    ... )
    >>> card_data.to_dict()
    {'title': 'Dreambooth Training', 'sdk': 'gradio', 'license': 'mit', 'duplicated_from': 'multimodalart/dreambooth-training'}
    ```
NF)ÚtitleÚsdkÚsdk_versionÚpython_versionÚapp_fileÚapp_portr�   Úduplicated_fromÚmodelsr�   r•   rA   r¿   rÀ   rÁ   rÂ   rÃ   rÄ   r�   rÅ   rÆ   r�   r•   rA   c                ó¾   >• Xl         X l        X0l        X@l        XPl        X`l        Xpl        X€l        X�l        X l	        [        U5      U l        [        TU ]4  " S0 UD6  g )Nr1   )r¿   rÀ   rÁ   rÂ   rÃ   rÄ   r�   rÅ   rÆ   r�   r™   r•   r    rF   )r   r¿   rÀ   rÁ   rÂ   rÃ   rÄ   r�   rÅ   rÆ   r�   r•   rA   rE   rŸ   s                 €r    rF   ÚSpaceCardData.__init__  sV   ø€ ð" Œ
ØŒØ&ÔØ,ÔØ ŒØ ŒØŒØ.ÔØŒØ ŒÜ# DÓ)ˆŒ	Ü‰ÒÑ"˜6Ó"r#   )rÃ   rÄ   r�   rÅ   r�   rÆ   rÂ   rÀ   rÁ   r•   r¿   )r2   r3   r4   r5   r6   r7   r|   rW   r:   rF   r=   r©   rª   s   @r    r¾   r¾   Ú  sì   ø† ñ/ðh !ØØ"&Ø%)Ø#Ø#Ø"Ø&*Ø#'Ø%)Ø!%Ø',ò#ð �T‰zð#ð �4‰Zð	#ð
 ˜4‘Zð#ð ˜d™
ð#ð ˜‘*ð#ð ˜‘*ð#ð �t‘ð#ð ˜t™ð#ð �S‘	˜DÑ ð#ð �s‘)˜dÑ"ð#ð �3‰i˜$Ñð#ð !%÷#ö #r#   r¾   r¢   c           	      ó:  • / nU  GH�  nUS   nUS   nU GHz  nUS   S   nUS   R                  S5      nUS   S   nUS   S   n	US   R                  S5      n
US   R                  S5      nUS   R                  S5      nUS   R                  S	5      nUR                  S
0 5      R                  S5      nUR                  S
0 5      R                  S5      nUS    H¯  nUS   nUS   nUR                  S5      nUR                  S	5      nUR                  S5      nUR                  S5      nUR                  S5      n[        S 0 SU_SU_SU	_SU_SU_SU_SU
_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_6nUR                  U5        M±     GM}     GM’     WU4$ )!a  Takes in a model index and returns the model name and a list of `huggingface_hub.EvalResult` objects.

A detailed spec of the model index can be found here:
https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1

Args:
    model_index (`list[dict[str, Any]]`):
        A model index data structure, likely coming from a README.md file on the
        Hugging Face Hub.

Returns:
    model_name (`str`):
        The name of the model as found in the model index. This is used as the
        identifier for the model on leaderboards like PapersWithCode.
    eval_results (`list[EvalResult]`):
        A list of `huggingface_hub.EvalResult` objects containing the metrics
        reported in the provided model_index.

Example:
    ```python
    >>> from huggingface_hub.repocard_data import model_index_to_eval_results
    >>> # Define a minimal model index
    >>> model_index = [
    ...     {
    ...         "name": "my-cool-model",
    ...         "results": [
    ...             {
    ...                 "task": {
    ...                     "type": "image-classification"
    ...                 },
    ...                 "dataset": {
    ...                     "type": "beans",
    ...                     "name": "Beans"
    ...                 },
    ...                 "metrics": [
    ...                     {
    ...                         "type": "accuracy",
    ...                         "value": 0.9
    ...                     }
    ...                 ]
    ...             }
    ...         ]
    ...     }
    ... ]
    >>> model_name, eval_results = model_index_to_eval_results(model_index)
    >>> model_name
    'my-cool-model'
    >>> eval_results[0].task_type
    'image-classification'
    >>> eval_results[0].metric_type
    'accuracy'

    ```
ÚnameÚresultsÚtaskrˆ   ÚdatasetÚconfigÚsplitÚrevisionÚargsÚsourceÚurlr“   rM   r   ÚverifyTokenr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r1   )rh   r	   Úappend)r¢   r}   ÚelemrÊ   rË   Úresultr   r   r   r   r   r   r   r   r   r   Úmetricr   r   r   r   r   r   r   Úeval_results                            r    rš   rš   +  s0  € ðp €LÜˆØ�F‰|ˆØ�y‘/ˆÜˆFØ˜v™ vÑ.ˆIØ˜v™×*Ñ*¨6Ó2ˆIØ! )Ñ,¨VÑ4ˆLØ! )Ñ,¨VÑ4ˆLØ# IÑ.×2Ñ2°8Ó<ˆNØ" 9Ñ-×1Ñ1°'Ó:ˆMØ% iÑ0×4Ñ4°ZÓ@ÐØ! )Ñ,×0Ñ0°Ó8ˆLØ Ÿ*™* X¨rÓ2×6Ñ6°vÓ>ˆKØŸ™ H¨bÓ1×5Ñ5°eÓ<ˆJà  Ô+�Ø$ V™n�Ø% g™�Ø$Ÿj™j¨Ó0�Ø$Ÿj™j¨Ó0�Ø &§
¡
¨8Ó 4�Ø!Ÿ:™: jÓ1�Ø%Ÿz™z¨-Ó8�ä(ò Ù'ðá!-ðñ ".ðñ !,ð	ñ
 ".ðñ (ðñ $2ðñ #0ðñ &6ðñ ".ðñ !,ðñ !,ðñ #0ðñ &ðñ ".ðñ  !,ð!ñ"  *ð#�ð& ×#Ñ# KÖ0ô9 ,ô ñ ðX �ÐÐr#   c                 óì   • [        U [        [        [        45      (       a  [	        U 5      " S U  5       5      $ [        U [
        5      (       a&  [	        U 5      " S U R                  5        5       5      $ U $ )zc
Recursively remove `None` values from a dict. Borrowed from: https://stackoverflow.com/a/20558778
c              3   ó@   #   • U  H  oc  M  [        U5      v •  M     g 7frC   ©Ú_remove_none)r‚   Úxs     r    r„   Ú_remove_none.<locals>.<genexpr>˜  s   é € ÐG²#¨Q›œ aŸ˜²#ùs   ‚Œc              3   óf   #   • U  H'  u  pUc  M
  Uc  M  [        U5      [        U5      4v •  M)     g 7frC   rÜ   )r‚   r[   Úvs      r    r„   rß   š  s+   é € ÐwÊÁÀÐWXÓ;ÐijÓ;œ, q›/¬<¸«?Õ;Êùs   ‚	1�1”1)r�   rW   r<   rX   rˆ   r9   r'   )Úobjs    r    rÝ   rÝ   “  sZ   € ô �#œœe¤SÐ)×*Ñ*Ü�CŒyÑG±#ÓGÓGÐGÜ	�Cœ×	Ñ	Ü�CŒyÑwÈÏ	É	ÌÓwÓwÐwàˆ
r#   c                 óî  • [        [        5      nU H   nX#R                     R                  U5        M"     / nUR	                  5        GH  nUS   nUR
                  UR                  S.UR                  UR                  UR                  UR                  UR                  UR                  S.U Vs/ s HS  nUR                  UR                  UR                  UR                   UR"                  UR$                  UR&                  S.PMU     snS.nUR(                  b.  SUR(                  0n	UR*                  b  UR*                  U	S'   X˜S'   UR                  U5        GM     U US	./n
[-        U
5      $ s  snf )
a@  Takes in given model name and list of `huggingface_hub.EvalResult` and returns a
valid model-index that will be compatible with the format expected by the
Hugging Face Hub.

Args:
    model_name (`str`):
        Name of the model (ex. "my-cool-model"). This is used as the identifier
        for the model on leaderboards like PapersWithCode.
    eval_results (`list[EvalResult]`):
        List of `huggingface_hub.EvalResult` objects containing the metrics to be
        reported in the model-index.

Returns:
    model_index (`list[dict[str, Any]]`): The eval_results converted to a model-index.

Example:
    ```python
    >>> from huggingface_hub.repocard_data import eval_results_to_model_index, EvalResult
    >>> # Define minimal eval_results
    >>> eval_results = [
    ...     EvalResult(
    ...         task_type="image-classification",  # Required
    ...         dataset_type="beans",  # Required
    ...         dataset_name="Beans",  # Required
    ...         metric_type="accuracy",  # Required
    ...         metric_value=0.9,  # Required
    ...     )
    ... ]
    >>> eval_results_to_model_index("my-cool-model", eval_results)
    [{'name': 'my-cool-model', 'results': [{'task': {'type': 'image-classification'}, 'dataset': {'name': 'Beans', 'type': 'beans'}, 'metrics': [{'type': 'accuracy', 'value': 0.9}]}]}]

    ```
r   )rˆ   rÊ   )rÊ   rˆ   rÎ   rÏ   rÐ   rÑ   )rˆ   rM   rÊ   rÎ   rÑ   r   rÔ   )rÌ   rÍ   r“   rÓ   rÊ   rÒ   )rÊ   rË   )r   rW   r!   rÕ   Úvaluesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rÝ   )r~   r}   Útask_and_ds_types_maprÙ   Úmodel_index_datarË   Úsample_resultr×   ÚdatarÒ   r¢   s              r    r§   r§   Ÿ  s�  € ôJ :EÄTÓ9JÐÛ#ˆØ×;Ñ;Ñ<×CÑCÀKÖPñ $ð .0ÐØ(×/Ñ/×1ˆà ™
ˆð &×/Ñ/Ø%×/Ñ/ñð
 &×2Ñ2Ø%×2Ñ2Ø'×6Ñ6Ø&×4Ñ4Ø)×:Ñ:Ø%×2Ñ2ññ$ &óò &�Fð #×.Ñ.Ø#×0Ñ0Ø"×.Ñ.Ø$×2Ñ2Ø"×.Ñ.Ø &§¡Ø#)×#6Ñ#6ôñ &ññ 
ˆð4 ×#Ñ#Ñ/à�}×/Ñ/ð&ˆFð ×(Ñ(Ñ4Ø!.×!:Ñ!:��v‘Ø#�‰NØ×Ñ ×%ñI 2ðT Ø'ñ	
ð€Kô ˜Ó$Ð$ùò=s   Â1AE2
r•   c                 óV   • U c  U $ / nU  H  nX!;  d  M
  UR                  U5        M     U$ rC   )rÕ   )r•   Úunique_tagsÚtags      r    r™   r™   û  s7   € Ø�|ØˆØ€KÛˆØÕ!Ø×Ñ˜sÖ#ñ ð Ðr#   )rI   Úcollectionsr   Údataclassesr   Útypingr   Úhuggingface_hub.utilsr   r   Ú
get_loggerr2   r�   r	   r?   rW   r7   r‰   r‹   r¬   r¾   r9   r<   rš   rÝ   r§   r™   r1   r#   r    Ú<module>rñ      sa  ðÛ Ý #Ý !Ý ç 4ð 
×	Ò	˜HÓ	%€ð ÷Tbð Tbó ðTbðn ÷P"ð P"ó ðP"ðfØ˜t JÑ/Ñ/°$Ñ6ðà�d‘
ðð 
ˆ*Ñôô"~C�Hô ~CôBMJ�hô MJô`N#�Hô N#ðbe¨T°$°s¸C°x±.Ñ-Að eÀeÈCÐQUÐV`ÑQaÐLaÑFbô eòP	ðY%¨Cð Y%¸tÀJÑ?Oð Y%ÐTXÐY]Ð^aÐcfÐ^fÑYgÑThô Y%ðx˜$˜s™) dÑ*ð ¨t°C©y¸4Ñ/?õ r#   