§
    }ŠtjÇ@  ã                   ód  — d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZ d dlmZ d dlmZmZmZmZ d	d
lmZmZ  ej        e¦  «        Z	 	 d,dedefd„Z	 	 d,dededefd„ZdZd e¦   «         › d e¦   «         › d e¦   «         › d�Zdefd„Z defd„Z!	 d-deez  de"eef         dz  fd„Z#e	 d-dededz  fd„¦   «         Z$ed dddddddddd!œ
ded"ed#e%dz  d$edz  de"dz  d%edz  d&e%dz  d'e&e         ez  dz  d(e&e         ez  dz  d)e&e         ez  dz  d*edz  fd+„¦   «         Z'dS ).é    N)ÚPath)ÚDEFAULT_PROTOCOLÚPicklingError)ÚAny)Úversion)Ú	constantsÚsnapshot_download)ÚHfApi)ÚSoftTemporaryDirectoryÚget_fastai_versionÚget_fastcore_versionÚget_python_versioné   )ÚloggingÚvalidate_hf_hub_argsú2.4ú1.3.27Úfastai_min_versionÚfastcore_min_versionc                 ó  — t          ¦   «         pt          ¦   «         dk    r4t          d| › d|› dt          ¦   «         › dt          ¦   «         › d�	¦  «        ‚t          j        t          ¦   «         ¦  «        }t          j        t          ¦   «         ¦  «        }|t          j        | ¦  «        k     r"t          d| › dt          ¦   «         › d	�¦  «        ‚|t          j        |¦  «        k     r"t          d
|› dt          ¦   «         › d�¦  «        ‚dS )a-  
    Checks that the installed fastai and fastcore versions are compatible for pickle serialization.

    Args:
        fastai_min_version (`str`, *optional*):
            The minimum fastai version supported.
        fastcore_min_version (`str`, *optional*):
            The minimum fastcore version supported.

    > [!TIP]
    > Raises the following error:
    >
    >     - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError)
    >       if the fastai or fastcore libraries are not available or are of an invalid version.
    zN/Azfastai>=z and fastcore>=z' are required. Currently using fastai==z and fastcore==ú.zD`push_to_hub_fastai` and `from_pretrained_fastai` require a fastai>=z+ version, but you are using fastai version zA which is incompatible. Upgrade with `pip install fastai==2.5.6`.zF`push_to_hub_fastai` and `from_pretrained_fastai` require a fastcore>=ú- version, but you are using fastcore version zD which is incompatible. Upgrade with `pip install fastcore==1.3.27`.N)r   r   ÚImportErrorr   ÚVersion)r   r   Úcurrent_fastai_versionÚcurrent_fastcore_versions       úZ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/huggingface_hub/fastai_utils.pyÚ_check_fastai_fastcore_versionsr      s\  € õ( 	ÑÔÐ6Õ"4Ñ"6Ô"6¸5Ò@Ð@Ýð4Ð)ð 4ð 4Ð:Nð 4ð 4Ý2DÑ2FÔ2Fð4ð 4å.Ñ0Ô0ð4ð 4ð 4ñ
ô 
ð 	
õ %œ_Õ-?Ñ-AÔ-AÑBÔBÐÝ&œÕ/CÑ/EÔ/EÑFÔFÐà¥¤Ð0BÑ CÔ CÒCÐCÝðØ*ðð å"Ñ$Ô$ðð ð ñ
ô 
ð 	
ð  ¥'¤/Ð2FÑ"GÔ"GÒGÐGÝð/Ø.ð/ð /å,Ñ.Ô.ð/ð /ð /ñ
ô 
ð 	
ð HÐGó    Ústorage_folderc                 óž  — 	 ddl }n# t          $ r t          d¦  «        ‚w xY wt          j                             | › d�¦  «        st                               d¦  «         dS |                     | › d�¦  «        }d| 	                    ¦   «         vrt                               d¦  «         dS |d         }d| 	                    ¦   «         vrt                               d	¦  «         dS |d         }d
„ |D ¦   «         }t          |¦  «        dk    rt                               d¦  «         ntt          |d         ¦  «                             d¦  «        d         }|dk    r@t          j        |¦  «        t          j        |¦  «        k     rt          d|› d|› d�¦  «        ‚d„ |D ¦   «         }	t          |	¦  «        dk    rt                               d¦  «         dS t          |	d         ¦  «                             d¦  «        d         }
|
dk    r@t          j        |
¦  «        t          j        |¦  «        k     rt          d|› d|
› d�¦  «        ‚dS dS )að  
    Checks that the `pyproject.toml` file in the directory `storage_folder` has fastai and fastcore versions
    that are compatible with `from_pretrained_fastai` and `push_to_hub_fastai`. If `pyproject.toml` does not exist
    or does not contain versions for fastai and fastcore, then it logs a warning.

    Args:
        storage_folder (`str`):
            Folder to look for the `pyproject.toml` file.
        fastai_min_version (`str`, *optional*):
            The minimum fastai version supported.
        fastcore_min_version (`str`, *optional*):
            The minimum fastcore version supported.

    > [!TIP]
    > Raises the following errors:
    >
    >     - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError)
    >       if the `toml` module is not installed.
    >     - [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError)
    >       if the `pyproject.toml` indicates a lower than minimum supported version of fastai or fastcore.
    r   Nzn`push_to_hub_fastai` and `from_pretrained_fastai` require the toml module. Install it with `pip install toml`.z/pyproject.tomlzàThere is no `pyproject.toml` in the repository that contains the fastai `Learner`. The `pyproject.toml` would allow us to verify that your fastai and fastcore versions are compatible with those of the model you want to load.zbuild-systemzúThere is no `build-system` section in the pyproject.toml of the repository that contains the fastai `Learner`. The `build-system` would allow us to verify that your fastai and fastcore versions are compatible with those of the model you want to load.ÚrequireszòThere is no `requires` section in the pyproject.toml of the repository that contains the fastai `Learner`. The `requires` would allow us to verify that your fastai and fastcore versions are compatible with those of the model you want to load.c                 ó<   — g | ]}|                      d ¦  «        ¯|‘ŒS )Úfastai©Ú
startswith©Ú.0Úpcks     r   ú
<listcomp>z=_check_fastai_fastcore_pyproject_versions.<locals>.<listcomp>‹   s)   € ÐSÐSÐS˜s¸#¿.º.ÈÑ:RÔ:RÐS�sÐSÐSÐSr   zPThe repository does not have a fastai version specified in the `pyproject.toml`.ú=é   Ú z*`from_pretrained_fastai` requires fastai>=z$ version but the model to load uses z which is incompatible.c                 ó<   — g | ]}|                      d ¦  «        ¯|‘ŒS )Úfastcorer%   r'   s     r   r*   z=_check_fastai_fastcore_pyproject_versions.<locals>.<listcomp>˜   s)   € ÐWÐWÐW ¸C¿NºNÈ:Ñ<VÔ<VÐW˜ÐWÐWÐWr   zRThe repository does not have a fastcore version specified in the `pyproject.toml`.z,`from_pretrained_fastai` requires fastcore>=r   )ÚtomlÚModuleNotFoundErrorr   ÚosÚpathÚisfileÚloggerÚwarningÚloadÚkeysÚlenÚstrÚ	partitionr   r   )r    r   r   r0   Úpyproject_tomlÚbuild_system_tomlÚpackage_versionsÚfastai_packagesÚfastai_versionÚfastcore_packagesÚfastcore_versions              r   Ú)_check_fastai_fastcore_pyproject_versionsrC   G   sÔ  € ð6
ØˆˆˆˆøÝð 
ð 
ð 
Ýð3ñ
ô 
ð 	
ð
øøøõ Œ7�>Š>˜^Ð<Ð<Ð<Ñ=Ô=ð Ý�Šðñ	
ô 	
ð 	
ð 	ˆØ—Y’Y .ÐAÐAÐAÑBÔB€Nà˜^×0Ò0Ñ2Ô2Ð2Ð2Ý�Šð.ñ	
ô 	
ð 	
ð 	ˆØ& ~Ô6ÐàÐ*×/Ò/Ñ1Ô1Ð1Ð1Ý�Šð.ñ	
ô 	
ð 	
ð 	ˆØ(¨Ô4Ðð TÐSÐ&6ÐSÑSÔS€OÝ
ˆ?ÑÔ˜qÒ Ð Ý�ŠÐiÑjÔjÐjÐjõ ˜_¨QÔ/Ñ0Ô0×:Ò:¸3Ñ?Ô?ÀÔBˆØ˜RÒÐ¥G¤O°NÑ$CÔ$CÅgÄoÐVhÑFiÔFiÒ$iÐ$iÝð<Ø.ð<ð <à"ð<ð <ð <ñô ð ð XÐWÐ(8ÐWÑWÔWÐÝ
ÐÑÔ Ò"Ð"Ý�ŠÐkÑlÔlÐlÐlÐlõ Ð0°Ô3Ñ4Ô4×>Ò>¸sÑCÔCÀAÔFÐØ˜rÒ!Ð!¥g¤oÐ6FÑ&GÔ&GÍ'Ì/ÐZnÑJoÔJoÒ&oÐ&oÝðFØ2ðFð Fà,ðFð Fð Fñô ð ð "Ð!Ð&oÐ&os   ‚ ‡!u   ---
tags:
- fastai
---

# Amazing!

ðŸ¥³ Congratulations on hosting your fastai model on the Hugging Face Hub!

# Some next steps
1. Fill out this model card with more information (see the template below and the [documentation here](https://huggingface.co/docs/hub/model-repos))!

2. Create a demo in Gradio or Streamlit using ðŸ¤— Spaces ([documentation here](https://huggingface.co/docs/hub/spaces)).

3. Join the fastai community on the [Fastai Discord](https://discord.com/invite/YKrxeNn)!

Greetings fellow fastlearner ðŸ¤�! Don't forget to delete this content from your model card.


---


# Model card

## Model description
More information needed

## Intended uses & limitations
More information needed

## Training and evaluation data
More information needed
zB[build-system]
requires = ["setuptools>=40.8.0", "wheel", "python=z", "fastai=z", "fastcore=z6"]
build-backend = "setuptools.build_meta:__legacy__"
Úrepo_dirc                 óÐ   — | dz  }|                      ¦   «         sL|                     dd¬¦  «        5 }|                     t          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS dS )z‹
    Creates a model card for the repository.

    Args:
        repo_dir (`Path`):
            Directory where model card is created.
    z	README.mdÚwúutf-8©ÚencodingN)ÚexistsÚopenÚwriteÚREADME_TEMPLATE)rD   Úreadme_pathÚfs      r   Ú_create_model_cardrP   Î   s¸   € ð ˜[Ñ(€Kà×ÒÑÔð %Ø×Ò˜c¨GÐÑ4Ô4ð 	%¸Ø�GŠG•OÑ$Ô$Ð$ð	%ð 	%ð 	%ñ 	%ô 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%øøøð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð%ð %ó   ±AÁAÁ Ac                 óÐ   — | dz  }|                      ¦   «         sL|                     dd¬¦  «        5 }|                     t          ¦  «         ddd¦  «         dS # 1 swxY w Y   dS dS )z—
    Creates a `pyproject.toml` for the repository.

    Args:
        repo_dir (`Path`):
            Directory where `pyproject.toml` is created.
    zpyproject.tomlrF   rG   rH   N)rJ   rK   rL   ÚPYPROJECT_TEMPLATE)rD   Úpyproject_pathrO   s      r   Ú_create_model_pyprojectrU   Ý   sº   € ð Ð 0Ñ0€Nà× Ò Ñ"Ô"ð (Ø× Ò  ¨wÐ Ñ7Ô7ð 	(¸1Ø�GŠGÕ&Ñ'Ô'Ð'ð	(ð 	(ð 	(ñ 	(ô 	(ð 	(ð 	(ð 	(ð 	(ð 	(ð 	(ð 	(øøøð 	(ð 	(ð 	(ð 	(ð 	(ð 	(ð(ð (rQ   Úsave_directoryÚconfigc                 óÂ  — t          ¦   «          t          j        |d¬¦  «         |�œt          |t          ¦  «        s t          dt          |¦  «        › d�¦  «        ‚t          j                             |t          j
        ¦  «        }t          |d¦  «        5 }t          j        ||¦  «         ddd¦  «         n# 1 swxY w Y   t          t          |¦  «        ¦  «         t!          t          |¦  «        ¦  «         t          |¦  «        | _        t          j        |d¬¦  «         	 |                      dt$          ¬¦  «         dS # t&          $ r t'          d	¦  «        ‚w xY w)
aú  
    Saves a fastai learner to `save_directory` in pickle format using the default pickle protocol for the version of python used.

    Args:
        learner (`Learner`):
            The `fastai.Learner` you'd like to save.
        save_directory (`str` or `Path`):
            Specific directory in which you want to save the fastai learner.
        config (`dict`, *optional*):
            Configuration object. Will be uploaded as a .json file. Example: 'https://huggingface.co/espejelomar/fastai-pet-breeds-classification/blob/main/config.json'.

    > [!TIP]
    > Raises the following error:
    >
    >     - [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError)
    >       if the config file provided is not a dictionary.
    T)Úexist_okNz(Provided config should be a dict. Got: 'ú'rF   ú	model.pkl)ÚfnameÚpickle_protocolzÀYou are using a lambda function, i.e., an anonymous function. `pickle` cannot pickle function objects and requires that all functions have names. One possible solution is to name the function.)r   r2   ÚmakedirsÚ
isinstanceÚdictÚRuntimeErrorÚtyper3   Újoinr   ÚCONFIG_NAMErK   ÚjsonÚdumprP   r   rU   Úexportr   r   )ÚlearnerrV   rW   r3   rO   s        r   Ú_save_pretrained_fastairi   ì   s£  € õ, $Ñ%Ô%Ð%å„K�¨Ð.Ñ.Ô.Ð.ð ÐÝ˜&¥$Ñ'Ô'ð 	[ÝÐYÍ$ÈvÉ,Ì,ÐYÐYÐYÑZÔZÐZÝŒw�|Š|˜N­IÔ,AÑBÔBˆÝ�$˜‰_Œ_ð 	! ÝŒI�f˜aÑ Ô Ð ð	!ð 	!ð 	!ñ 	!ô 	!ð 	!ð 	!ð 	!ð 	!ð 	!ð 	!øøøð 	!ð 	!ð 	!ð 	!õ •t˜NÑ+Ô+Ñ,Ô,Ð,Ý�D Ñ0Ô0Ñ1Ô1Ð1õ ˜Ñ'Ô'€G„LÝ„K�¨Ð.Ñ.Ô.Ð.ð

Ø�ŠØÝ,ð 	ñ 	
ô 	
ð 	
ð 	
ð 	
øõ ð 
ð 
ð 
ÝðEñ
ô 
ð 	
ð
øøøs   ÂB8Â8B<Â?B<Ä&E ÅEÚrepo_idÚrevisionc                 ó  — t          ¦   «          t          j                             | ¦  «        s t	          | |dt          ¦   «         ¬¦  «        }n| }t          |¦  «         ddlm}  |t          j         	                    |d¦  «        ¦  «        S )ap  
    Load pretrained fastai model from the Hub or from a local directory.

    Args:
        repo_id (`str`):
            The location where the pickled fastai.Learner is. It can be either of the two:
                - Hosted on the Hugging Face Hub. E.g.: 'espejelomar/fatai-pet-breeds-classification' or 'distilgpt2'.
                  You can add a `revision` by appending `@` at the end of `repo_id`. E.g.: `dbmdz/bert-base-german-cased@main`.
                  Revision is the specific model version to use. Since we use a git-based system for storing models and other
                  artifacts on the Hugging Face Hub, it can be a branch name, a tag name, or a commit id.
                - Hosted locally. `repo_id` would be a directory containing the pickle and a pyproject.toml
                  indicating the fastai and fastcore versions used to build the `fastai.Learner`. E.g.: `./my_model_directory/`.
        revision (`str`, *optional*):
            Revision at which the repo's files are downloaded. See documentation of `snapshot_download`.

    Returns:
        The `fastai.Learner` model in the `repo_id` repo.
    r$   )rj   rk   Úlibrary_nameÚlibrary_versionr   )Úload_learnerr[   )
r   r2   r3   Úisdirr	   r   rC   Úfastai.learnerro   rc   )rj   rk   r    ro   s       r   Úfrom_pretrained_fastairr   !  s—   € õ. $Ñ%Ô%Ð%õ
 Œ7�=Š=˜Ñ!Ô!ð !Ý*ØØØ!Ý.Ñ0Ô0ð	
ñ 
ô 
ˆˆð !ˆå-¨nÑ=Ô=Ð=à+Ð+Ð+Ð+Ð+Ð+àˆ<�œŸš ^°[ÑAÔAÑBÔBÐBr   z(Push FastAI model using huggingface_hub.)
Úcommit_messageÚprivateÚtokenrW   ÚbranchÚ	create_prÚallow_patternsÚignore_patternsÚdelete_patternsÚapi_endpointrs   rt   ru   rv   rw   rx   ry   rz   r{   c                óN  — t          ¦   «          t          |¬¦  «        }|                     |||d¬¦  «        j        }t	          ¦   «         5 }t          |¦  «        |z  }t          | ||¬¦  «         |                     ||||||||	|
¬¦	  «	        cddd¦  «         S # 1 swxY w Y   dS )a½	  
    Upload learner checkpoint files to the Hub.

    Use `allow_patterns` and `ignore_patterns` to precisely filter which files should be pushed to the hub. Use
    `delete_patterns` to delete existing remote files in the same commit. See [`upload_folder`] reference for more
    details.

    Args:
        learner (`Learner`):
            The `fastai.Learner' you'd like to push to the Hub.
        repo_id (`str`):
            The repository id for your model in Hub in the format of "namespace/repo_name". The namespace can be your individual account or an organization to which you have write access (for example, 'stanfordnlp/stanza-de').
        commit_message (`str`, *optional*):
            Message to commit while pushing. Will default to :obj:`"add model"`.
        private (`bool`, *optional*):
            Whether or not the repository created should be private.
            If `None` (default), will default to been public except if the organization's default is private.
        token (`str`, *optional*):
            The Hugging Face account token to use as HTTP bearer authorization for remote files. If :obj:`None`, the token will be asked by a prompt.
        config (`dict`, *optional*):
            Configuration object to be saved alongside the model weights.
        branch (`str`, *optional*):
            The git branch on which to push the model. This defaults to
            the default branch as specified in your repository, which
            defaults to `"main"`.
        create_pr (`boolean`, *optional*):
            Whether or not to create a Pull Request from `branch` with that commit.
            Defaults to `False`.
        api_endpoint (`str`, *optional*):
            The API endpoint to use when pushing the model to the hub.
        allow_patterns (`list[str]` or `str`, *optional*):
            If provided, only files matching at least one pattern are pushed.
        ignore_patterns (`list[str]` or `str`, *optional*):
            If provided, files matching any of the patterns are not pushed.
        delete_patterns (`list[str]` or `str`, *optional*):
            If provided, remote files matching any of the patterns will be deleted from the repo.

    Returns:
        The url of the commit of your model in the given repository.

    > [!TIP]
    > Raises the following error:
    >
    >     - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
    >       if the user is not log on to the Hugging Face Hub.
    )ÚendpointT)rj   ru   rt   rY   )rW   )	rj   ru   Úfolder_pathrs   rk   rw   rx   ry   rz   N)r   r
   Úcreate_reporj   r   r   ri   Úupload_folder)rh   rj   rs   rt   ru   rW   rv   rw   rx   ry   rz   r{   ÚapiÚtmpÚ
saved_paths                  r   Úpush_to_hub_fastair„   N  s  € õ| $Ñ%Ô%Ð%Ý
˜Ð
&Ñ
&Ô
&€CØ�oŠo g°UÀGÐVZˆoÑ[Ô[Ôc€Gõ 
 Ñ	!Ô	!ð 
 SÝ˜#‘Y”Y Ñ(ˆ
Ý ¨¸FÐCÑCÔCÐCØ× Ò ØØØ"Ø)ØØØ)Ø+Ø+ð !ñ 

ô 

ð
ð 
ð 
ð 
ñ 
ô 
ð 
ð 
ð 
ð 
ð 
ð 
øøøð 
ð 
ð 
ð 
ð 
ð 
s   ÁABÂBÂ!B)r   r   )N)(re   r2   Úpathlibr   Úpickler   r   Útypingr   Ú	packagingr   Úhuggingface_hubr   r	   Úhuggingface_hub.hf_apir
   Úhuggingface_hub.utilsr   r   r   r   Úutilsr   r   Ú
get_loggerÚ__name__r5   r:   r   rC   rM   rS   rP   rU   r`   ri   rr   ÚboolÚlistr„   © r   r   ú<module>r’      s«  ðØ €€€Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð à 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø (Ð (Ð (Ð (Ð (Ð (ðð ð ð ð ð ð ð ð ð ð ð ð 1Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0ð 
ˆÔ	˜HÑ	%Ô	%€ð $Ø (ð,
ð ,
Øð,
àð,
ð ,
ð ,
ð ,
ðb $Ø (ð\ð \Øð\àð\ð ð\ð \ð \ð \ð~ €ðDØ4FÐ4FÑ4HÔ4Hðð ØUgÐUgÑUiÔUiðð ð yMð  yMñ  yOô  yOðð ð Ð ð% ð %ð %ð %ð %ð( dð (ð (ð (ð (ð$ %)ð2
ð 2
à˜$‘Jð2
ð ��c�ŒN˜TÑ!ð2
ð 2
ð 2
ð 2
ðj ð  ð)Cð )CØð)Cà�D‰jð)Cð )Cð )Cñ Ôð)CðX ð
 EØØØØØ!Ø-1Ø.2Ø.2Ø#ðO
ð O
ð O
ð ðO
ð ð	O
ð
 �D‰[ðO
ð �‰:ðO
ð �4‰KðO
ð �$‰JðO
ð �d‰{ðO
ð ˜”I ‘O dÑ*ðO
ð ˜#”Y ‘_ tÑ+ðO
ð ˜#”Y ‘_ tÑ+ðO
ð ˜‘*ðO
ð O
ð O
ñ ÔðO
ð O
ð O
r   